-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
205 lines (161 loc) · 6.76 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# Copyright (C) 2015 3D Repo Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Code to automatically generate CMakeList.txt in sub directories
# This project compiles a library with source files span across multiple directories
# So this generates a CMakeList.txt for each sub directory within the src folder
# update the SOURCES and HEADERS variable, and include their child directory
include(CMakeDependentOption)
project("3drepobouncer")
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -std=c++14 -pthread")
if(${APPLE})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -framework Foundation")
endif()
if(${WIN32})
add_definitions( -DWIN32_LEAN_AND_MEAN )
endif()
option (REPO_BUILD_COVERAGE "Building with coverage report" OFF)
option (ODA_SUPPORT "If ODA library is present" OFF)
option (SYNCHRO_SUPPORT "If Synchro library is present" OFF)
option (LICENSE_CHECK "Build with a license check" OFF)
if(REPO_BUILD_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 --coverage")
endif()
#================BOOST SETTINGS=======================
set(Boost_NO_BOOST_CMAKE ON)
#add_definitions(-DBOOST_ALL_NO_LIB)
add_definitions(-DBOOST_ALL_DYN_LINK)
add_definitions(-DBOOST_LOG_DYN_LINK)
add_definitions(-DBOOST_PROGRAM_OPTIONS_DYN_LINK)
add_definitions(-DBOOST_UUID_NO_SIMD)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
unset(Boost_INCLUDE_DIR CACHE)
unset(Boost_LIBRARY_DIRS CACHE)
if(WIN32)
find_package(Boost REQUIRED COMPONENTS system thread chrono log log_setup filesystem program_options regex zlib bzip2 iostreams date_time)
else()
find_package(Boost REQUIRED COMPONENTS system thread chrono log log_setup filesystem program_options regex iostreams date_time)
endif()
add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
add_definitions(-DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE)
if(NOT ${Boost_FOUND})
message(FATAL_ERROR "Cannot find boost")
endif()
#================MONGO SETTINGS=======================
find_package(Mongo REQUIRED)
if(NOT ${MONGO_FOUND})
message(FATAL_ERROR "Cannot find mongo cxx driver")
endif()
#================ASSIMP SETTINGS=======================
find_package(ASSIMPM REQUIRED)
if(NOT ${ASSIMPM_FOUND})
message(FATAL_ERROR "Cannot find assimp")
endif()
#===============IFCOPENSHELL SETTINGS==================
find_package(OCCT REQUIRED)
find_package(IFCOPENSHELL REQUIRED)
if(NOT ${OCCT_FOUND})
message(FATAL_ERROR "Cannot find OCCT")
endif()
if(NOT ${IFCOPENSHELL_FOUND})
message(FATAL_ERROR "Cannot find IFCOpenShell")
endif()
#===================== ODA ============================
if (ODA_SUPPORT)
add_definitions(-D_TOOLKIT_IN_DLL_)
add_definitions(-DODA_SUPPORT)
find_package(ODA REQUIRED)
endif()
#===================== SYNCHRO ============================
if (SYNCHRO_SUPPORT)
add_definitions(-DSYNCHRO_SUPPORT)
find_package(SYNCHROREADER REQUIRED)
find_package(THRIFT REQUIRED)
find_package(ZLIB REQUIRED)
endif()
#===================== CRYPTOLENS ============================
function (ensureNotEmpty varName data)
if(data STREQUAL "")
message(FATAL_ERROR "${varName} cannot be empty when LICENSE_CHECK is set.")
endif()
endfunction()
if (LICENSE_CHECK )
find_package(CRYPTOLENS REQUIRED)
set(LICENSE_RSA_PUB_KEY_MOD $ENV{LICENSE_RSA_PUB_KEY_MOD} CACHE STRING "Licensing public token modulus")
set(LICENSE_RSA_PUB_KEY_EXP $ENV{LICENSE_RSA_PUB_KEY_EXP} CACHE STRING "Licensing public token exponent")
set(LICENSE_AUTH_TOKEN $ENV{LICENSE_AUTH_TOKEN} CACHE STRING "Access token to communicate with licence server")
set(LICENSE_PRODUCT_ID $ENV{LICENSE_PRODUCT_ID} CACHE STRING "The product ID assigned in the licensing server")
set(LICENSE_TIMEOUT_SECONDS "30" CACHE STRING "Time after which an occupied seat is released")
ensureNotEmpty(LICENSE_RSA_PUB_KEY_MOD "${LICENSE_RSA_PUB_KEY_MOD}")
ensureNotEmpty(LICENSE_RSA_PUB_KEY_EXP "${LICENSE_RSA_PUB_KEY_EXP}")
ensureNotEmpty(LICENSE_AUTH_TOKEN "${LICENSE_AUTH_TOKEN}")
ensureNotEmpty(LICENSE_PRODUCT_ID "${LICENSE_PRODUCT_ID}")
add_definitions(-DREPO_LICENSE_CHECK)
add_definitions(-DLICENSE_RSA_PUB_KEY_MOD="${LICENSE_RSA_PUB_KEY_MOD}")
add_definitions(-DLICENSE_RSA_PUB_KEY_EXP="${LICENSE_RSA_PUB_KEY_EXP}")
add_definitions(-DLICENSE_AUTH_TOKEN="${LICENSE_AUTH_TOKEN}")
add_definitions(-DLICENSE_PRODUCT_ID=${LICENSE_PRODUCT_ID})
add_definitions(-DLICENSE_TIMEOUT_SECONDS=${LICENSE_TIMEOUT_SECONDS})
endif()
#================COMPILE 3D REPO BOUNCER ==============
option (REPO_BUILD_WRAPPER "If the C# wrapper is built in addition to the library" ON)
cmake_dependent_option (REPO_BUILD_WRAPPER_TESTS "If the C# wrapper test suite is built" OFF "REPO_BUILD_WRAPPER" OFF)
option (REPO_BUILD_CLIENT "If the Command Line Client is built in addition to the library" ON)
option (REPO_BUILD_TOOLS "If the Command Line Tool is built in addition to the library" OFF)
option (REPO_BUILD_TESTS "If the test suite for the core bouncer logic is built in addition to the library" OFF)
option (REPO_NO_GZIP "If zlib is not compiled into boost" OFF)
option (REPO_ASSET_GENERATOR_SUPPORT "If the AssetGenerator is present and compiled into the library" ON)
#Build IFCUtils
add_subdirectory(ifcUtils)
if(REPO_NO_GZIP)
add_definitions(-DREPO_BOOST_NO_GZIP)
endif()
# Include the asset generators. This should be called before the bouncer
# subdirectory is added, as that is the point the SOURCES variable is
# committed to the 3drepobouncer target.
if (REPO_ASSET_GENERATOR_SUPPORT)
add_definitions(-DREPO_ASSET_GENERATOR_SUPPORT)
add_subdirectory(submodules/asset_generator)
endif()
#bouncer library
add_subdirectory(bouncer)
#client exe
if (REPO_BUILD_CLIENT)
add_subdirectory(client)
endif()
# gtest
if(REPO_BUILD_TESTS OR REPO_BUILD_WRAPPER_TESTS)
set(gtest_force_shared_crt ON CACHE BOOL "Build gtest as shared library" FORCE)
add_subdirectory(submodules/googletest)
endif()
#tool exe
if (REPO_BUILD_TOOLS)
add_subdirectory(tools)
endif()
#test exe
if (REPO_BUILD_TESTS)
add_subdirectory(test)
endif()
# C# wrapper
if (REPO_BUILD_WRAPPER)
add_subdirectory(wrapper)
endif()
#wrapper test exe
if (REPO_BUILD_WRAPPER_TESTS)
add_subdirectory(wrapper_test)
endif()