-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
160 lines (142 loc) · 5.11 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
153
154
155
156
157
158
159
cmake_minimum_required( VERSION 3.1 )
project( ItalianPlug )
set( GLFW_BUILD_DOCS OFF CACHE BOOL "GLFW lib only" FORCE)
set( GLFW_BUILD_EXAMPLES OFF CACHE BOOL "GLFW lib only" FORCE)
set( GLFW_BUILD_TESTS OFF CACHE BOOL "GLFW lib only" FORCE)
set( GLFW_INSTALL OFF CACHE BOOL "GLFW lib only" FORCE)
set(ASSIMP_BUILD_TESTS OFF)
set(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT OFF)
set(ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT OFF)
set(ASSIMP_BUILD_OFF_IMPORTER TRUE)
set(ASSIMP_BUILD_PLY_IMPORTER TRUE)
set(ASSIMP_BUILD_ASSIMP_TOOLS OFF)
# Needed for compilation?
set(ASSIMP_BUILD_ASSBIN_EXPORTER TRUE)
set(ASSIMP_BUILD_ASSXML_EXPORTER TRUE)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
set(ALLOW_DUPLICATE_CUSTOM_TARGETS TRUE)
add_subdirectory( external/glfw )
add_subdirectory( external/assimp )
include_directories(
external/glfw/include
external/glm
external/glad/include
external/imgui
external/imgui/backends
external/implot
external/libigl/include
external/eigen
external/quickhull
external/quickhull/Structs
external/bhtsne
)
if( MSVC )
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:mainCRTStartup" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
endif()
set( SRC
external/glad/src/glad.c
external/imgui/imgui_draw.cpp
external/imgui/imgui_tables.cpp
external/imgui/imgui_widgets.cpp
external/imgui/imgui.cpp
external/imgui/backends/imgui_impl_glfw.cpp
external/imgui/backends/imgui_impl_opengl3.cpp
external/implot/implot.cpp
external/implot/implot_items.cpp
external/quickhull/QuickHull.cpp
external/bhtsne/sptree.cpp
src/renderer.cpp
src/mesh.cpp
src/mesh_base.cpp
src/convex_hull.cpp
src/shader.cpp
src/utils.cpp
src/normalization.cpp
src/descriptors.cpp
src/input_handler.cpp
src/mesh_repair.cpp
src/shader_map.cpp
src/camera.cpp
src/mesh_map.cpp
src/unit_cube.cpp
src/shape_retriever.cpp
src/tsne_runner.cpp
)
if (UNIX)
set (LIBS
dl
pthread
glfw
assimp)
else()
set (LIBS
glfw
assimp)
endif()
#set(CXX_OPTIONS -g )
add_executable( ItalianPlug WIN32 ${SRC} src/italianplug.cpp)
target_link_libraries( ItalianPlug ${LIBS})
target_compile_options( ItalianPlug PRIVATE ${CXX_OPTIONS})
set_property(TARGET ItalianPlug PROPERTY CXX_STANDARD 17)
add_executable( FeaturesExtractor WIN32 ${SRC} src/features_extractor.cpp)
target_link_libraries( FeaturesExtractor ${LIBS})
target_compile_options( FeaturesExtractor PRIVATE ${CXX_OPTIONS})
set_property(TARGET FeaturesExtractor PROPERTY CXX_STANDARD 17)
add_executable( StatsExtractor WIN32 ${SRC} src/stats_extractor.cpp)
target_link_libraries( StatsExtractor ${LIBS})
target_compile_options( StatsExtractor PRIVATE ${CXX_OPTIONS})
set_property(TARGET StatsExtractor PROPERTY CXX_STANDARD 17)
add_executable( Normalizer WIN32 ${SRC} src/normalizer.cpp)
target_link_libraries( Normalizer ${LIBS})
target_compile_options( Normalizer PRIVATE ${CXX_OPTIONS})
set_property(TARGET Normalizer PROPERTY CXX_STANDARD 17)
add_executable( Retrieval WIN32 ${SRC} src/retrieval.cpp)
target_link_libraries( Retrieval ${LIBS})
target_compile_options( Retrieval PRIVATE ${CXX_OPTIONS})
set_property(TARGET Retrieval PROPERTY CXX_STANDARD 17)
add_executable( Evaluation WIN32 ${SRC} src/evaluation.cpp)
target_link_libraries( Evaluation ${LIBS})
target_compile_options( Evaluation PRIVATE ${CXX_OPTIONS})
set_property(TARGET Evaluation PROPERTY CXX_STANDARD 17)
add_executable( Timing WIN32 ${SRC} src/timing.cpp)
target_link_libraries( Timing ${LIBS})
target_compile_options( Timing PRIVATE ${CXX_OPTIONS})
set_property(TARGET Timing PROPERTY CXX_STANDARD 17)
if( UNIX )
add_custom_command(
TARGET ItalianPlug
POST_BUILD COMMAND ${CMAKE_COMMAND} -E
create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/Scripts ${CMAKE_BINARY_DIR}/Scripts)
add_custom_command(
TARGET ItalianPlug
POST_BUILD COMMAND ${CMAKE_COMMAND} -E
create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/shaders ${CMAKE_BINARY_DIR}/shaders)
else()
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/shaders" _dstDir)
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/shaders" _srcDir)
execute_process(COMMAND cmd.exe /c mklink /J "${_dstDir}" "${_srcDir}")
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/Scripts" _dstDir)
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Scripts" _srcDir)
execute_process(COMMAND cmd.exe /c mklink /J "${_dstDir}" "${_srcDir}")
endif()
if( WIN32 )
add_custom_command (
TARGET ItalianPlug
PRE_BUILD
COMMAND ${CMAKE_SOURCE_DIR}/get_sources.bat
)
else()
add_custom_command (
TARGET ItalianPlug
PRE_BUILD
COMMAND ${CMAKE_SOURCE_DIR}/get_sources.sh
)
endif()
if( MSVC )
if(${CMAKE_VERSION} VERSION_LESS "3.6.0")
message( "\n\t[ WARNING ]\n\n\tCMake version lower than 3.6.\n\n\t - Please update CMake and rerun; OR\n\t - Manually set 'GLFW-CMake-starter' as StartUp Project in Visual Studio.\n" )
else()
set_property( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT GLFW-CMake-starter )
endif()
endif()