commit 3b11d056e0aeab3452fcf991bba088991f33ab08
parent 8d73824100226112b1c3b1af35814e208bf10c50
Author: deurzen <max@deurzen.net>
Date: Thu, 2 Jun 2022 09:26:59 +0200
adds debug/release build distinction
Diffstat:
2 files changed, 41 insertions(+), 28 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -12,33 +12,40 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_options(
- -w
- # -fdiagnostics-show-option
- # -Weffc++
- # -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic
- # -Wnon-virtual-dtor
- # -Wold-style-cast
- # -Wcast-align
- # -Wunused
- # -Woverloaded-virtual
- # -Wpedantic
- # -Wconversion
- # -Wsign-conversion
- # -Wmisleading-indentation
- # -Wduplicated-cond
- # -Wduplicated-branches
- # -Wlogical-op
- # -Wnull-dereference
- # -Wuseless-cast
- # -Wdouble-promotion
- # -Wformat=2
- -DXWAYLAND
- -O0
- # debug options
- -g
- # -DTRACING_DISABLED
- # -finstrument-functions -finstrument-functions-exclude-file-list=/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/g++-v11,/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/g++-v11/backward,/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/g++-v11/x86_64-pc-linux-gnu,/usr/local/include -ldl -Wl,--export-dynamic
-
+ $<$<CONFIG:DEBUG>:-fdiagnostics-show-option>
+ $<$<CONFIG:DEBUG>:-Weffc++>
+ $<$<CONFIG:DEBUG>:-Wall>
+ $<$<CONFIG:DEBUG>:-Wextra>
+ $<$<CONFIG:DEBUG>:-Wshadow>
+ $<$<CONFIG:DEBUG>:-Wnon-virtual-dtor>
+ $<$<CONFIG:DEBUG>:-pedantic>
+ $<$<CONFIG:DEBUG>:-Wnon-virtual-dtor>
+ $<$<CONFIG:DEBUG>:-Wold-style-cast>
+ $<$<CONFIG:DEBUG>:-Wcast-align>
+ $<$<CONFIG:DEBUG>:-Wunused>
+ $<$<CONFIG:DEBUG>:-Woverloaded-virtual>
+ $<$<CONFIG:DEBUG>:-Wpedantic>
+ $<$<CONFIG:DEBUG>:-Wconversion>
+ $<$<CONFIG:DEBUG>:-Wsign-conversion>
+ $<$<CONFIG:DEBUG>:-Wmisleading-indentation>
+ $<$<CONFIG:DEBUG>:-Wduplicated-cond>
+ $<$<CONFIG:DEBUG>:-Wduplicated-branches>
+ $<$<CONFIG:DEBUG>:-Wlogical-op>
+ $<$<CONFIG:DEBUG>:-Wnull-dereference>
+ $<$<CONFIG:DEBUG>:-Wuseless-cast>
+ $<$<CONFIG:DEBUG>:-Wdouble-promotion>
+ $<$<CONFIG:DEBUG>:-Wformat=2>
+ $<$<CONFIG:DEBUG>:-DXWAYLAND>
+ $<$<CONFIG:DEBUG>:-O0>
+ $<$<CONFIG:DEBUG>:-g>
+ $<$<CONFIG:RELEASE>:-w>
+ $<$<CONFIG:RELEASE>:-DXWAYLAND>
+ $<$<CONFIG:RELEASE>:-DTRACING_DISABLED>
+ $<$<CONFIG:RELEASE>:-O2>
+)
+
+add_compile_definitions(
+ $<$<CONFIG:DEBUG>:DEBUG>
)
find_program(CCACHE ccache)
@@ -202,6 +209,9 @@ target_include_directories(kranec PRIVATE
${CMAKE_SOURCE_DIR}/include/protocols
)
+install(TARGETS kranewl)
+install(TARGETS kranec)
+
include(CTest)
add_test(NAME kranewl
diff --git a/Makefile b/Makefile
@@ -1,13 +1,16 @@
all: kranewl
kranewl:
- cmake -S . -B build
+ cmake -DCMAKE_BUILD_TYPE=Debug -S . -B build
make -C build
release:
cmake -DCMAKE_BUILD_TYPE=Release -S . -B build
make -C build
+install:
+ make -C build install
+
test: kranewl
ctest --verbose --test-dir build