fxos: set optimization level depending on build type

This commit is contained in:
Lephenixnoir 2023-09-03 19:19:13 +02:00
parent 3e620280c0
commit b5d7947958
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
2 changed files with 11 additions and 4 deletions

View File

@ -3,8 +3,11 @@ project(fxos LANGUAGES C CXX)
find_package(FLEX 2.6)
add_compile_options(
-Wall -Wextra -D_GNU_SOURCE -std=c++17 -O2
-fmacro-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}/=)
-Wall -Wextra -D_GNU_SOURCE -std=c++17
-fmacro-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}/=
$<$<CONFIG:Debug>:-O0> $<$<CONFIG:Debug>:-g>
$<$<CONFIG:Release>:-O2>)
# Diagnostic options to clean up output a little bit
if(FXOS_CLEAN_LOGS)

View File

@ -33,14 +33,18 @@ requirements.
* flex (2.6.4)
* CMake (3.15) and make (eg. 4.2.1)
There are two configure options:
There are three configure options:
* `-DCMAKE_BUILD_TYPE=Debug|Release`: default is debug.
* `-DCMAKE_INSTALL_PREFIX=<PATH>`: the install path. CMake's default is
`/usr/local`; a viable alternative is `$HOME/.local`.
* `-DFXOS_CLEAN_LOGS=1`: enables basic compiler output filtering to get error messages under control. Tested with GCC.
```sh
% cmake -B build # -DCMAKE_INSTALL_PREFIX=$HOME/.local -DFXOS_CLEAN_LOGS=1
% cmake -B build
# -DCMAKE_BUILD_TYPE=Debug
# -DCMAKE_INSTALL_PREFIX=$HOME/.local
# -DFXOS_CLEAN_LOGS=1
% make -C build -j$(nproc) install
```