From ed3fcf9546eb8a6a3b89b20dcf1ff5d9bc5f3e55 Mon Sep 17 00:00:00 2001 From: onelin Date: Sat, 15 Mar 2025 20:15:20 +0100 Subject: Add common compile flags --- CMakeLists.txt | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bf9871..06e20d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,11 +60,27 @@ if(DAW_BUILD_UBSAN AND DAW_BUILD_ASAN) message(FATAL_ERROR "You cannot build both asan and ubsan") endif() +# These are not actually used (TODO) +set(DEFAULT_ARGS + -m64 # Target 64-bit architechture + -Wall -Wextra # All the good default warnings + -Wfloat-equal + -Wundef + -Wshadow + -Wpointer-arith + -Wcast-align + -Wstrict-prototypes + -Wwrite-strings + -Wswitch-default + -Wconversion +) + +# These are not actually used (TODO) if(DAW_BUILD_DEBUG) - set(BUILD_OPTS -m64 -Og -ggdb3 -fno-omit-frame-pointer) + set(BUILD_OPTS ${DEFAULT_ARGS} -Og -ggdb3 -fno-omit-frame-pointer) else() - set(BUILD_OPTS -m64 -O2 -flto=auto -fuse-linker-plugin -ffat-lto-objects - -funroll-loops -ffast-math -fno-signed-zeros -fno-trapping-math + set(BUILD_OPTS ${DEFAULT_ARGS} -O2 -flto=auto -fuse-linker-plugin -ffat-lto-objects + -funroll-loops -fno-signed-zeros -fno-trapping-math -ffunction-sections -fdata-sections) endif() -- cgit v1.3