Commit Graph

5 Commits

Author SHA1 Message Date
Avi Kivity
1c6c7992e4 Revert "build: cmake: use -O0 for debug build"
This reverts commit 8a54e478ba. As
commit 7dadd38161 ("Revert "configure: Switch debug build from
-O0 to -Og") was reverted (by b7627085cb, "Revert "Revert
"configure: Switch debug build from -O0 to -Og""")), we do the
same to cmake to keep the two build systems in sync.

Closes #14286
2023-06-19 14:31:28 +03:00
Kefu Chai
8a54e478ba build: cmake: use -O0 for debug build
per clang's document, -Og is like -O1, which is in turn an optimization
level between -O0 and -O2. -O0 "generates the most debuggable code".
for instance, with -O0, presumably, the variables are not allocated in
the registers and later get overwritten, they are always allocated on
the stack. this helps with the debugging.

in this change, -O0 is used for better debugging experience. the
downside is that the emitted code size will be greater than the one
emitted from -Og, and the executable will be slower.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes #14210
2023-06-13 18:25:36 +03:00
Kefu Chai
ecd5bf98d9 build: cmake: set stack frame limits
* transpose include(mode.common) and include (mode.${build_mode}),
  so the former can reference the value defined by the latter.
* set stack_usage_threshold for supported build modes.

please note, this compiler option (-Wstack-usage=<bytes>) is only
supported by GCC so far.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-04-04 15:33:20 +08:00
Kefu Chai
066e9567ee build: cmake: use -O0 on aarch64, otherwise -Og
this addresses an oversight in b234c839e4,
which is supposed to mirror the behavior of `configure.py`.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-04-04 15:33:20 +08:00
Kefu Chai
b234c839e4 build: cmake: add build mode support
Scylla uses different build mode to customize the build for different
purposes. in this change, instead of having it in a python dictionary,
the customized settings are located in their own files, and loaded
on demand. we don't support multi-config generator yet.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-02-16 00:07:37 +08:00