-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
63 lines (51 loc) · 2.19 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
cmake_minimum_required(VERSION 3.22)
project(biliardo_triangolare)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# richiedi l'uso di C++17, senza estensioni non-standard offerte dal compilatore usato
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED OFF)
set(CMAKE_CXX_EXTENSIONS OFF)
# abilita warning
string(APPEND CMAKE_CXX_FLAGS
" -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion"
" -Wshadow -Wimplicit-fallthrough -Wextra-semi -Wold-style-cast")
# rimuovi le ottimizzazioni se si deve profilare l'eseguibile
if (PROFILE OR VALGRIND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0")
endif ()
# abilita l'address sanitizer e l'undefined-behaviour sanitizer in debug mode quando non si usa valgrind
if (NOT VALGRIND)
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -fsanitize=address,undefined -fno-omit-frame-pointer")
string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG " -fsanitize=address,undefined -fno-omit-frame-pointer")
endif ()
find_package(ROOT 6.26 COMPONENTS CONFIG REQUIRED)
find_package(SFML 2.5 COMPONENTS graphics REQUIRED)
find_package(TGUI 1.0 REQUIRED)
find_package(Boost 1.35 COMPONENTS container REQUIRED)
find_package(TBB REQUIRED)
# compila il backend
add_subdirectory(TPool)
# crea l'app per il frontend
add_executable(biliardo_triangolare
main.cpp App.cpp
Designer.cpp
Gui.cpp)
add_dependencies(biliardo_triangolare tpool)
target_include_directories(biliardo_triangolare PRIVATE include)
target_link_libraries(biliardo_triangolare PRIVATE tpool ROOT::Core ROOT::Hist ROOT::Gpad sfml-graphics TGUI::TGUI TBB::tbb)
# copia le texture nella directory di build
add_custom_command(
TARGET biliardo_triangolare POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_SOURCE_DIR}/resources/Black.png
${CMAKE_CURRENT_BINARY_DIR}/Black.png &&
${CMAKE_COMMAND} -E copy_if_different
${CMAKE_SOURCE_DIR}/resources/Black.txt
${CMAKE_CURRENT_BINARY_DIR}/Black.txt
)
# se il testing e' abilitato...
# per disabilitare il testing, passare -DBUILD_TESTING=OFF a cmake durante la fase di configurazione
if (BUILD_TESTING)
add_subdirectory(tests)
endif ()