-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
62 lines (49 loc) · 1.95 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
cmake_minimum_required(VERSION 3.2.0)
project(polytri VERSION 0.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
# -----------------------------------------------------------------------------
set(SOURCE_DIR ${CMAKE_SOURCE_DIR}/src)
# -----------------------------------------------------------------------------
if( (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
list(APPEND CXX_FLAGS
-Wall -Wextra -Wshadow -Wpedantic
-Wnon-virtual-dtor -Woverloaded-virtual
-Wuseless-cast -Wcast-align
#-Wold-style-cast
-Wlogical-op
-Wno-unused-function -Wno-unused-parameter -Wno-missing-field-initializers
-fvisibility=hidden -fno-strict-aliasing -fno-builtin-memcmp
)
list(APPEND CXX_FLAGS_RELEASE -O2)
list(APPEND CXX_FLAGS_DEBUG -g -O0 -Wconversion)
else()
message(WARNING "Compiler not tested")
endif()
# -----------------------------------------------------------------------------
set(Sources
${SOURCE_DIR}/trapezoidal_decomposition.cc
${SOURCE_DIR}/monotone_partitioning.cc
${SOURCE_DIR}/polygon_triangulation.cc
)
set(Headers
${SOURCE_DIR}/polygon_triangulation.h
)
# -----------------------------------------------------------------------------
add_library(${PROJECT_NAME} STATIC ${Sources} ${Headers})
target_compile_options(${PROJECT_NAME} PRIVATE
"${CXX_FLAGS}"
"$<$<CONFIG:Debug>:${CXX_FLAGS_DEBUG}>"
"$<$<CONFIG:Release>:${CXX_FLAGS_RELEASE}>"
)
target_include_directories(${PROJECT_NAME} PRIVATE ${SOURCE_DIR})
# -----------------------------------------------------------------------------
set(TargetName polytri-cli)
add_executable(${TargetName}
${SOURCE_DIR}/polytri-cli.cc
${Headers}
)
target_include_directories(${TargetName} PRIVATE ${SOURCE_DIR} )
target_link_libraries(${TargetName} ${PROJECT_NAME})
target_compile_definitions(${TargetName} PRIVATE -DAPP_DIRECTORY="${CMAKE_CURRENT_LIST_DIR}/")
# -----------------------------------------------------------------------------