-
Notifications
You must be signed in to change notification settings - Fork 77
/
CMakeLists.txt
executable file
·152 lines (130 loc) · 4.14 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
cmake_minimum_required(VERSION 3.1)
project(QuadriFlow LANGUAGES CXX)
option(BUILD_PERFORMANCE_TEST "More subdivisition for performance test" OFF)
option(BUILD_LOG "Enable verbose log" OFF)
option(BUILD_GUROBI "Enable GUROBI for comparison ONLY" OFF)
option(BUILD_OPENMP "Enable support for OpenMP" OFF)
option(BUILD_TBB "Enable support for TBB" OFF)
option(BUILD_FREE_LICENSE "Only use libraries with permissive licenses" OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
set(Boost_USE_STATIC_LIBS ON)
find_package(Eigen REQUIRED)
find_package(Boost REQUIRED)
if (BUILD_GUROBI)
find_package(GUROBI REQUIRED)
endif(BUILD_GUROBI)
if (BUILD_TBB)
find_package(TBB REQUIRED)
endif(BUILD_TBB)
set(LEMON_3RD_PATH 3rd/lemon-1.3.1)
find_path(
LEMON_SOURCE_ROOT_DIR
CMakeLists.txt
PATHS ${CMAKE_SOURCE_DIR}/${LEMON_3RD_PATH} NO_DEFAULT_PATH
DOC "Location of LEMON source as a CMAKE subproject"
)
if (EXISTS ${LEMON_SOURCE_ROOT_DIR})
add_subdirectory(${LEMON_SOURCE_ROOT_DIR})
set(LEMON_INCLUDE_DIRS ${LEMON_SOURCE_ROOT_DIR} ${PROJECT_BINARY_DIR}/${LEMON_3RD_PATH})
set(LEMON_LIBRARIES lemon)
unset(LEMON_ROOT_DIR CACHE)
unset(LEMON_DIR CACHE)
unset(LEMON_INCLUDE_DIR CACHE)
unset(LEMON_LIBRARY CACHE)
else()
find_package(LEMON QUIET NO_MODULE)
find_package(LEMON REQUIRED)
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_RELEASE "-O3") # enable assert
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g") # enable assert
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS}")
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG}")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fopenmp -Wno-int-in-bool-context -Wno-sign-compare")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address")
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS}")
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fsanitize=address")
endif()
if(MSVC)
# Enable M_PI and disable fopen() etc. warnings
ADD_DEFINITIONS(-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS)
# Disable the following warnings : C4267 and 4244 (conversions) C4018 (sign compare) and C4800 (bool to int)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /wd4267 /wd4244 /wd4018 /wd4800")
endif()
include_directories(src)
include_directories(3rd/pcg32)
include_directories(3rd/pss)
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${EIGEN_INCLUDE_DIRS})
include_directories(${GLM_INCLUDE_DIRS})
include_directories(${GLUT_INCLUDE_DIRS})
include_directories(${LEMON_INCLUDE_DIRS})
include_directories(${TBB_INCLUDE_DIRS})
include_directories(${GUROBI_INCLUDE_DIRS})
if (BUILD_PERFORMANCE_TEST)
add_definitions(-DPERFORMANCE_TEST)
endif(BUILD_PERFORMANCE_TEST)
if (BUILD_OPENMP)
add_definitions(-DWITH_OMP)
endif(BUILD_OPENMP)
if (BUILD_LOG)
add_definitions(-DLOG_OUTPUT)
endif(BUILD_LOG)
if (BUILD_GUROBI)
add_definitions(-DWITH_GUROBI)
endif(BUILD_GUROBI)
if (BUILD_TBB)
add_definitions(-DWITH_TBB)
endif(BUILD_TBB)
if (BUILD_FREE_LICENSE)
add_definitions(-DEIGEN_MPL2_ONLY)
endif(BUILD_FREE_LICENSE)
set(
quadriflow_SRC
src/adjacent-matrix.cpp
src/adjacent-matrix.hpp
src/compare-key.hpp
src/config.hpp
src/dedge.cpp
src/dedge.hpp
src/disajoint-tree.hpp
src/dset.hpp
src/field-math.hpp
src/flow.hpp
src/hierarchy.cpp
src/hierarchy.hpp
src/loader.cpp
src/loader.hpp
src/localsat.cpp
src/localsat.hpp
src/main.cpp
src/merge-vertex.cpp
src/merge-vertex.hpp
src/optimizer.cpp
src/optimizer.hpp
src/parametrizer.cpp
src/parametrizer-flip.cpp
src/parametrizer-int.cpp
src/parametrizer-mesh.cpp
src/parametrizer-scale.cpp
src/parametrizer-sing.cpp
src/parametrizer.hpp
src/serialize.hpp
src/subdivide.cpp
src/subdivide.hpp
)
add_executable(
quadriflow
${quadriflow_SRC}
)
target_link_libraries(
quadriflow
${TBB_LIBRARIES}
${LEMON_LIBRARIES}
${GUROBI_LIBRARIES}
)