0024156: It's necessary to add TODO in test cases to avoid known regressions on MacOS
[occt.git] / CMakeLists.txt
CommitLineData
03c69aec 1cmake_minimum_required ( VERSION 2.6)
166d6cd7 2
03c69aec 3if (NOT BUILD_TYPE)
4 set(BUILD_TYPE "Release" CACHE STRING "Build type of the OCCT" FORCE)
5 SET_PROPERTY(CACHE BUILD_TYPE PROPERTY STRINGS Release Debug)
6endif()
166d6cd7 7
03c69aec 8set(CMAKE_CONFIGURATION_TYPES ${BUILD_TYPE} CACHE INTERNAL "" FORCE)
9
10project(OCCT)
11
12set_property(GLOBAL PROPERTY 3RDPARTY_USE_FOLDERS ON)
13
14set(BUILD_SHARED_LIBS ON)
15
16IF("${BUILD_TYPE}" STREQUAL "${CMAKE_BUILD_TYPE}" AND "${BUILD_BITNESS}" STREQUAL "${BUILD_BITNESS1}")
17 SET(CHANGES_ARE_NEEDED OFF)
18ELSE()
19 SET(CHANGES_ARE_NEEDED ON)
20ENDIF()
21
22set(BUILD_BITNESS 32 CACHE STRING "Bitness of the OCCT project")
23SET_PROPERTY(CACHE BUILD_BITNESS PROPERTY STRINGS 32 64)
24
25SET(BUILD_BITNESS1 ${BUILD_BITNESS} CACHE INTERNAL "Temporary bitness is created to check whether change 3rdparty paths or not" FORCE)
26
27SET( CMAKE_BUILD_TYPE ${BUILD_TYPE} CACHE INTERNAL "Build type of the OCCT" FORCE )
28
29SET( INSTALL_DIR "" CACHE PATH "Directory contains install files of the OCCT" )
30SET( CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE )
31
32set (BUILD_TOOLKITS "" CACHE STRING "Toolkits are included in OCCT")
33separate_arguments(BUILD_TOOLKITS)
34
35include(adm/cmake/CMakeModules.txt)
36
37if (WIN32)
38 set(SCRIPT_EXT bat)
39else()
40 set(SCRIPT_EXT sh)
41endif()
42
43if (DEFINED MSVC70)
44 SET(COMPILER vc7)
45elseif (DEFINED MSVC80)
46 SET(COMPILER vc8)
47elseif (DEFINED MSVC90)
48 SET(COMPILER vc9)
49elseif (DEFINED MSVC10)
50 SET(COMPILER vc10)
51elseif (DEFINED MSVC11)
52 SET(COMPILER vc11)
53else()
54 SET(COMPILER ${CMAKE_GENERATOR})
55endif()
56
57if (${BUILD_BITNESS} STREQUAL 64)
58 add_definitions(-D_OCC64)
59endif()
60
61add_definitions(-DCSFDB)
62if(WIN32)
63 add_definitions(/DWNT -wd4996)
64elseif(APPLE)
65 add_definitions(-fexceptions -fPIC -DOCC_CONVERT_SIGNALS -DHAVE_WOK_CONFIG_H -DHAVE_CONFIG_H)
66else()
67 add_definitions(-fexceptions -fPIC -DOCC_CONVERT_SIGNALS -DHAVE_WOK_CONFIG_H -DHAVE_CONFIG_H -DLIN)
68endif()
69
70string(REGEX MATCH "EHsc" ISFLAG "${CMAKE_CXX_FLAGS}")
71IF(ISFLAG)
72 STRING(REGEX REPLACE "EHsc" "EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
73ELSEIF(WIN32)
74 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -EHa")
75ENDIF()
76
77IF(WIN32)
78 IF(NOT DEFINED MSVC70 AND NOT DEFINED MSVC80)
79 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -MP")
80 ENDIF()
81ENDIF()
82
83SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
84SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
85
86SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEB")
87SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEB")
88
89set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/lib)
90set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/lib)
91set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/bin)
92
93# RESOURCES
94install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/DrawResources" DESTINATION "${INSTALL_DIR}/src" )
95install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/StdResource" DESTINATION "${INSTALL_DIR}/src" )
96install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/SHMessage" DESTINATION "${INSTALL_DIR}/src" )
97install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/Textures" DESTINATION "${INSTALL_DIR}/src" )
98install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/XSMessage" DESTINATION "${INSTALL_DIR}/src" )
99install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/TObj" DESTINATION "${INSTALL_DIR}/src" )
100install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/XSTEPResource" DESTINATION "${INSTALL_DIR}/src" )
101install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/XmlOcafResource" DESTINATION "${INSTALL_DIR}/src" )
102
103install(FILES "${CMAKE_SOURCE_DIR}/src/UnitsAPI/Lexi_Expr.dat" DESTINATION "${INSTALL_DIR}/src/UnitsAPI" )
104install(FILES "${CMAKE_SOURCE_DIR}/src/UnitsAPI/Units.dat" DESTINATION "${INSTALL_DIR}/src/UnitsAPI" )
105
106IF("${BUILD_TYPE}" STREQUAL "Release")
107 SET(BUILD_SUFFIX "")
108ELSE()
109 SET(BUILD_SUFFIX "") # debug == release
110ENDIF()
111
112FUNCTION(SUBDIRECTORY_NAMES MAIN_DIRECTORY RESULT)
113 file(GLOB SUB_ITEMS "${MAIN_DIRECTORY}/*")
114
115 foreach(ITEM ${SUB_ITEMS})
116 if(IS_DIRECTORY "${ITEM}")
117 GET_FILENAME_COMPONENT(ITEM_NAME "${ITEM}" NAME)
118 LIST(APPEND LOCAL_RESULT "${ITEM_NAME}")
119 endif()
120 endforeach()
121 set (${RESULT} ${LOCAL_RESULT} PARENT_SCOPE)
122ENDFUNCTION()
123
124FUNCTION(FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
125 string( TOLOWER "${PRODUCT_NAME}" lower_PRODUCT_NAME )
126
127 LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*${COMPILER}.*${BUILD_BITNESS}")
128 LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${COMPILER}.*${BUILD_BITNESS}")
129 LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${BUILD_BITNESS}")
130 LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+")
131 LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}")
132
133 SUBDIRECTORY_NAMES( "${ROOT_DIR}" SUBDIR_NAME_LIST)
134
135 FOREACH( SEARCH_TEMPLATE ${SEARCH_TEMPLATES})
136 IF(LOCAL_RESULT)
137 BREAK()
138 ENDIF()
139
140 FOREACH(SUBDIR_NAME ${SUBDIR_NAME_LIST})
141 string( TOLOWER "${SUBDIR_NAME}" lower_SUBDIR_NAME )
142
143 STRING(REGEX MATCH "${SEARCH_TEMPLATE}" DUMMY_VAR "${lower_SUBDIR_NAME}")
144 IF(DUMMY_VAR)
145 LIST(APPEND LOCAL_RESULT ${SUBDIR_NAME})
146 ENDIF()
147 ENDFOREACH()
148 ENDFOREACH()
149
150 IF(LOCAL_RESULT)
151 LIST(LENGTH "${LOCAL_RESULT}" LOC_LEN)
152 MATH(EXPR LAST_ELEMENT_INDEX "${LOC_LEN}-1")
153 LIST(GET LOCAL_RESULT ${LAST_ELEMENT_INDEX} DUMMY)
154 SET(${RESULT} ${DUMMY} PARENT_SCOPE)
155 ENDIF()
156ENDFUNCTION()
157
158IF(WIN32)
159 SET(DLL_SO "dll")
160 SET(DLL_SO_FOLDER "bin")
161 SET(DLL_SO_PREFIX "")
162ELSEIF(APPLE)
163 SET(DLL_SO "dylib")
164 SET(DLL_SO_FOLDER "lib")
165 SET(DLL_SO_PREFIX "lib")
166ELSE()
167 SET(DLL_SO "so")
168 SET(DLL_SO_FOLDER "lib")
169 SET(DLL_SO_PREFIX "lib")
170ENDIF()
171
172SET(3RDPARTY_DIR "" CACHE PATH "Directory contains required 3rdparty products")
173SET(3RDPARTY_INCLUDE_DIRS "")
174SET(3RDPARTY_NOT_INCLUDED)
175
176IF(APPLE)
177 SET(3RDPARTY_USE_GLX OFF CACHE BOOL "whether use X11 OpenGL on OSX or not")
178ENDIF()
179
180SET(3RDPARTY_USE_GL2PS OFF CACHE BOOL "whether use gl2ps product or not")
181SET(3RDPARTY_USE_FREEIMAGE OFF CACHE BOOL "whether use freeimage product or not")
182SET(3RDPARTY_USE_TBB OFF CACHE BOOL "whether use tbb product or not")
183
184SET(INSTALL_TESTS OFF CACHE BOOL "Is tests copy to install directory")
185
186MACRO(THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME)
187 IF(NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DIR)
188 SET(3RDPARTY_${PRODUCT_NAME}_DIR "" CACHE PATH "Directory contains ${PRODUCT_NAME} product")
189 ENDIF()
190
191 IF(3RDPARTY_DIR AND ("${3RDPARTY_${PRODUCT_NAME}_DIR}" STREQUAL "" OR CHANGES_ARE_NEEDED))
192 FIND_PRODUCT_DIR("${3RDPARTY_DIR}" ${PRODUCT_NAME} ${PRODUCT_NAME}_DIR_NAME)
193 IF("${${PRODUCT_NAME}_DIR_NAME}" STREQUAL "")
194 MESSAGE(STATUS "${PRODUCT_NAME} DON'T FIND")
195 ELSE()
196 SET(3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_DIR}/${${PRODUCT_NAME}_DIR_NAME}" CACHE PATH "Directory contains ${PRODUCT_NAME} product" FORCE)
197 ENDIF()
198 ENDIF()
199
200 SET(INSTALL_${PRODUCT_NAME} OFF CACHE BOOL "Is ${PRODUCT_NAME} lib copy to install directory")
201
202 IF(3RDPARTY_${PRODUCT_NAME}_DIR)
203 IF("${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND")
204 SET(3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "Directory contains headers of the ${PRODUCT_NAME} product" FORCE)
205 FIND_PATH(3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR ${HEADER_NAME} PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}/include" NO_DEFAULT_PATH)
206
207 IF("${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND")
208 FIND_PATH(3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR ${HEADER_NAME})
209 ENDIF()
210
211 ENDIF()
212
213 IF("${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND")
214 SET(3RDPARTY_${PRODUCT_NAME}_LIBRARY "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "Directory contains library of the ${PRODUCT_NAME} product" FORCE)
215 FIND_LIBRARY(3RDPARTY_${PRODUCT_NAME}_LIBRARY ${LIBRARY_NAME} PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}/lib" NO_DEFAULT_PATH)
216
217 # check default path for library search
218 IF("${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND")
219 FIND_LIBRARY(3RDPARTY_${PRODUCT_NAME}_LIBRARY ${LIBRARY_NAME})
220 ENDIF()
221 ENDIF()
222
223 IF("${3RDPARTY_${PRODUCT_NAME}_DLL}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_${PRODUCT_NAME}_DLL}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND")
224 SET(3RDPARTY_${PRODUCT_NAME}_DLL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND" CACHE FILEPATH "Directory contains shared library of the ${PRODUCT_NAME} product" FORCE)
225 FIND_FILE(3RDPARTY_${PRODUCT_NAME}_DLL "${DLL_SO_PREFIX}${LIBRARY_NAME}.${DLL_SO}" PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}/${DLL_SO_FOLDER}" NO_DEFAULT_PATH)
226
227 IF("${3RDPARTY_${PRODUCT_NAME}_DLL}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND")
228 FIND_FILE(3RDPARTY_${PRODUCT_NAME}_DLL "${DLL_SO_PREFIX}${LIBRARY_NAME}.${DLL_SO}")
229 ENDIF()
230 ENDIF()
231 MARK_AS_ADVANCED(3RDPARTY_${PRODUCT_NAME}_DIR)
232 ENDIF()
233
234 IF(3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR)
235 SET(3RDPARTY_INCLUDE_DIRS "${3RDPARTY_INCLUDE_DIRS};${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
236 ELSE()
237 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR)
238 ENDIF()
239
240 IF(3RDPARTY_${PRODUCT_NAME}_LIBRARY)
241 GET_FILENAME_COMPONENT(3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
242 SET(3RDPARTY_LIBRARY_DIRS "${3RDPARTY_LIBRARY_DIRS};${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
243 ELSE()
244 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_LIBRARY)
245 ENDIF()
246
247 IF(3RDPARTY_${PRODUCT_NAME}_DLL)
248 #
249 ELSE()
250 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL)
251 ENDIF()
252
253 IF(INSTALL_${PRODUCT_NAME})
254 INSTALL(FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}" DESTINATION "${INSTALL_DIR}/${DLL_SO_FOLDER}")
255 SET(3RDPARTY_${PRODUCT_NAME}_DLL_DIR "")
256 ELSE()
257 GET_FILENAME_COMPONENT(3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
258 ENDIF()
259ENDMACRO()
260
261# TCL
262
263#tcl85 - win; tcl8.5 - lin
264IF(WIN32)
265 SET(TCL_SEP "")
266ELSE()
267 SET(TCL_SEP ".")
268ENDIF()
269
270THIRDPARTY_PRODUCT("TCL" "tcl.h" "tcl8${TCL_SEP}5")
271
272#install tk and libs
273IF(INSTALL_TCL)
274 GET_FILENAME_COMPONENT(3RDPARTY_TK_LIB_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
275 GET_FILENAME_COMPONENT(3RDPARTY_TK_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH)
276
277 INSTALL(FILES "${3RDPARTY_TK_DLL_DIR}/${DLL_SO_PREFIX}tk8${TCL_SEP}5.${DLL_SO}" DESTINATION "${INSTALL_DIR}/${DLL_SO_FOLDER}")
278 INSTALL(DIRECTORY "${3RDPARTY_TK_LIB_DIR}/tcl8.5" DESTINATION "${INSTALL_DIR}/lib")
279 INSTALL(DIRECTORY "${3RDPARTY_TK_LIB_DIR}/tk8.5" DESTINATION "${INSTALL_DIR}/lib")
280ENDIF()
281
282# GLX
283IF(3RDPARTY_USE_GLX)
284 ADD_DEFINITIONS(-DMACOSX_USE_GLX)
285
286 IF(NOT DEFINED 3RDPARTY_GLX_DIR)
287 SET(3RDPARTY_GLX_DIR "" CACHE PATH "Directory contains GLX product")
288 ENDIF()
289
290 IF(3RDPARTY_DIR AND ("${3RDPARTY_GLX_DIR}" STREQUAL "" OR CHANGES_ARE_NEEDED))
291 FIND_PRODUCT_DIR("${3RDPARTY_DIR}" GLX GLX_DIR_NAME)
292 IF("${GLX_DIR_NAME}" STREQUAL "")
293 MESSAGE(STATUS "GLX DON'T FIND")
294 ELSE()
295 SET(3RDPARTY_GLX_DIR "${3RDPARTY_DIR}/${GLX_DIR_NAME}" CACHE PATH "Directory contains GLX product" FORCE)
296 ENDIF()
297 ENDIF()
298
299 IF(3RDPARTY_GLX_DIR)
300 SET(3RDPARTY_GLX_INCLUDE_DIR "${3RDPARTY_GLX_DIR}/include" CACHE FILEPATH "Directory contains headers of the GLX product" FORCE)
301 SET(3RDPARTY_GLX_LIBRARY_DIR "${3RDPARTY_GLX_DIR}/lib" CACHE FILEPATH "Directory contains library of the GLX product" FORCE)
302
303 SET(3RDPARTY_INCLUDE_DIRS "${3RDPARTY_INCLUDE_DIRS};${3RDPARTY_GLX_INCLUDE_DIR}")
304 SET(3RDPARTY_LIBRARY_DIRS "${3RDPARTY_LIBRARY_DIRS};${3RDPARTY_GLX_LIBRARY_DIR}")
305
306 MARK_AS_ADVANCED(3RDPARTY_GLX_DIR)
307 ELSE()
308 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_GLX_INCLUDE_DIR)
309 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_GLX_LIBRARY_DIR)
310 ENDIF()
311ENDIF()
312
313# FREETYPE
314THIRDPARTY_PRODUCT("FREETYPE" "ft2build.h" "freetype${BUILD_SUFFIX}")
315
316IF("${3RDPARTY_FREETYPE_INCLUDE_DIR}" STREQUAL "" OR "${3RDPARTY_FREETYPE_INCLUDE_DIR}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND")
317
318ELSEIF(EXISTS "${3RDPARTY_FREETYPE_INCLUDE_DIR}/freetype2/")
319 SET(3RDPARTY_INCLUDE_DIRS "${3RDPARTY_INCLUDE_DIRS};${3RDPARTY_FREETYPE_INCLUDE_DIR}/freetype2")
320ENDIF()
321
322# FREEIMAGE
323IF(3RDPARTY_USE_FREEIMAGE)
324 ADD_DEFINITIONS(-DHAVE_FREEIMAGE)
325
326 THIRDPARTY_PRODUCT("FREEIMAGE" "FreeImage.h" "freeimage${BUILD_SUFFIX}")
327 IF(WIN32)
328 IF("${3RDPARTY_FREEIMAGE_DIR}" STREQUAL "")
329 ELSE()
330 SET (3RDPARTY_FREEIMAGEPLUS_DIR "${3RDPARTY_FREEIMAGE_DIR}")
331 ENDIF()
332
333 THIRDPARTY_PRODUCT("FREEIMAGEPLUS" "FreeImagePlus.h" "freeimageplus${BUILD_SUFFIX}")
334
335 ENDIF()
336ENDIF()
337
338# GL2PS
339IF(3RDPARTY_USE_GL2PS)
340 ADD_DEFINITIONS(-DHAVE_GL2PS)
341 THIRDPARTY_PRODUCT("GL2PS" "gl2ps.h" "gl2ps${BUILD_SUFFIX}")
342ENDIF()
343
344# TBB
345IF (3RDPARTY_USE_TBB)
346 ADD_DEFINITIONS(-DHAVE_TBB)
347
348 IF(${BUILD_BITNESS} STREQUAL 32)
349 SET (TBB_ARCH_NAME ia32)
350 ELSE()
351 SET (TBB_ARCH_NAME intel64)
352 ENDIF()
353
354 IF(NOT DEFINED 3RDPARTY_TBB_DIR)
355 SET(3RDPARTY_TBB_DIR "" CACHE PATH "Directory contains tbb product")
356 ENDIF()
357
358 SET(3RDPARTY_TBB_DIR_NAME "")
359 IF(3RDPARTY_DIR AND ("${3RDPARTY_TBB_DIR}" STREQUAL "" OR CHANGES_ARE_NEEDED))
360 FIND_PRODUCT_DIR("${3RDPARTY_DIR}" "TBB" 3RDPARTY_TBB_DIR_NAME)
361 IF("${3RDPARTY_TBB_DIR_NAME}" STREQUAL "")
362 MESSAGE(STATUS "TBB DON'T FIND")
363 ELSE()
364 SET(3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${3RDPARTY_TBB_DIR_NAME}" CACHE PATH "Directory contains tbb product" FORCE)
365 ENDIF()
366 ENDIF()
367
368 SET(INSTALL_TBB OFF CACHE BOOL "Is tbb lib copy to install directory")
369
370 IF(3RDPARTY_TBB_DIR)
371 IF("${3RDPARTY_TBB_INCLUDE_DIR}" STREQUAL "" OR CHANGES_ARE_NEEDED)
372 SET(3RDPARTY_TBB_INCLUDE_DIR "3RDPARTY_TBB_INCLUDE_DIR-NOTFOUND" CACHE PATH "Directory contains headers of the tbb product" FORCE)
373 FIND_PATH(3RDPARTY_TBB_INCLUDE_DIR tbb/tbb.h PATHS "${3RDPARTY_TBB_DIR}/include")
374 ENDIF()
375
376 SET(TBB_DEBUG_POSTFIX "")
377 if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
378 SET(TBB_DEBUG_POSTFIX "") # _debug postfix removed
379 ENDIF()
380
381 IF("${3RDPARTY_TBB_LIBRARY}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_TBB_LIBRARY}" STREQUAL "3RDPARTY_TBB_LIBRARY-NOTFOUND")
382 SET(3RDPARTY_TBB_LIBRARY "3RDPARTY_TBB_LIBRARY-NOTFOUND" CACHE PATH "Directory contains library of the tbb product" FORCE)
383 FIND_LIBRARY(3RDPARTY_TBB_LIBRARY tbb${TBB_DEBUG_POSTFIX} PATHS "${3RDPARTY_TBB_DIR}/lib/${TBB_ARCH_NAME}/${COMPILER}" NO_DEFAULT_PATH)
384
385 IF("${3RDPARTY_TBB_LIBRARY}" STREQUAL "3RDPARTY_TBB_LIBRARY-NOTFOUND")
386 FIND_LIBRARY(3RDPARTY_TBB_LIBRARY tbb${TBB_DEBUG_POSTFIX})
387 ENDIF()
388 ENDIF()
389
390 IF("${3RDPARTY_TBB_MALLOC_LIBRARY}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_TBB_MALLOC_LIBRARY}" STREQUAL "3RDPARTY_TBB_MALLOC_LIBRARY-NOTFOUND")
391 SET(3RDPARTY_TBB_MALLOC_LIBRARY "3RDPARTY_TBB_MALLOC_LIBRARY-NOTFOUND" CACHE PATH "Directory contains library of the tbb malloc product" FORCE)
392 FIND_LIBRARY(3RDPARTY_TBB_MALLOC_LIBRARY tbbmalloc${TBB_DEBUG_POSTFIX} PATHS "${3RDPARTY_TBB_DIR}/lib/${TBB_ARCH_NAME}/${COMPILER}" NO_DEFAULT_PATH)
393
394 IF("${3RDPARTY_TBB_MALLOC_LIBRARY}" STREQUAL "3RDPARTY_TBB_MALLOC_LIBRARY-NOTFOUND")
395 FIND_LIBRARY(3RDPARTY_TBB_MALLOC_LIBRARY tbbmalloc${TBB_DEBUG_POSTFIX})
396 ENDIF()
397 ENDIF()
398
399
400
401 IF("${3RDPARTY_TBB_DLL}" STREQUAL "" OR CHANGES_ARE_NEEDED)
402 SET(3RDPARTY_TBB_DLL "3RDPARTY_TBB_DLL-NOTFOUND" CACHE PATH "Directory contains shared library of the tbb product" FORCE)
403 FIND_FILE(3RDPARTY_TBB_DLL "${DLL_SO_PREFIX}tbb${TBB_DEBUG_POSTFIX}.${DLL_SO}" PATHS "${3RDPARTY_TBB_DIR}/${DLL_SO_FOLDER}/${TBB_ARCH_NAME}/${COMPILER}" NO_DEFAULT_PATH)
404
405 IF("${3RDPARTY_TBB_DLL}" STREQUAL "3RDPARTY_TBB_DLL-NOTFOUND")
406 FIND_FILE(3RDPARTY_TBB_DLL "${DLL_SO_PREFIX}tbb${TBB_DEBUG_POSTFIX}.${DLL_SO}")
407 ENDIF()
408 ENDIF()
409
410 IF("${3RDPARTY_TBB_MALLOC_DLL}" STREQUAL "" OR CHANGES_ARE_NEEDED)
411 SET(3RDPARTY_TBB_MALLOC_DLL "3RDPARTY_TBB_MALLOC_DLL-NOTFOUND" CACHE PATH "Directory contains shared library of the tbb malloc product" FORCE)
412 FIND_FILE(3RDPARTY_TBB_MALLOC_DLL "${DLL_SO_PREFIX}tbbmalloc${TBB_DEBUG_POSTFIX}.${DLL_SO}" PATHS "${3RDPARTY_TBB_DIR}/${DLL_SO_FOLDER}/${TBB_ARCH_NAME}/${COMPILER}" NO_DEFAULT_PATH)
413
414 IF("${3RDPARTY_TBB_MALLOC_DLL}" STREQUAL "3RDPARTY_TBB_MALLOC_DLL-NOTFOUND")
415 FIND_FILE(3RDPARTY_TBB_MALLOC_DLL "${DLL_SO_PREFIX}tbbmalloc${TBB_DEBUG_POSTFIX}.${DLL_SO}")
416 ENDIF()
417 ENDIF()
418
419 MARK_AS_ADVANCED(3RDPARTY_TBB_DIR_NAME)
420 ELSE()
421 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_DIR)
422 ENDIF()
423
424 IF(3RDPARTY_TBB_INCLUDE_DIR)
425 SET(3RDPARTY_INCLUDE_DIRS "${3RDPARTY_INCLUDE_DIRS};${3RDPARTY_TBB_INCLUDE_DIR}")
426 ELSE()
427 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
428 ENDIF()
429
430 IF(3RDPARTY_TBB_LIBRARY)
431 GET_FILENAME_COMPONENT(3RDPARTY_TBB_LIBRARY_DIR "${3RDPARTY_TBB_LIBRARY}" PATH)
432 SET(3RDPARTY_LIBRARY_DIRS "${3RDPARTY_LIBRARY_DIRS};${3RDPARTY_TBB_LIBRARY_DIR}")
433 ELSE()
434 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_LIBRARY)
435 ENDIF()
436
437 IF(3RDPARTY_TBB_MALLOC_LIBRARY)
438 GET_FILENAME_COMPONENT(3RDPARTY_TBB_LIBRARY_DIR "${3RDPARTY_TBB_MALLOC_LIBRARY}" PATH)
439 SET(3RDPARTY_LIBRARY_DIRS "${3RDPARTY_LIBRARY_DIRS};${3RDPARTY_TBB_LIBRARY_DIR}")
440 ELSE()
441 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_MALLOC_LIBRARY)
442 ENDIF()
443
444 IF(3RDPARTY_TBB_DLL)
445 #
446 ELSE()
447 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_DLL)
448 ENDIF()
449
450 IF(3RDPARTY_TBB_MALLOC_DLL)
451 #
452 ELSE()
453 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_MALLOC_DLL)
454 ENDIF()
455
456 IF(INSTALL_TBB)
457 INSTALL(FILES "${3RDPARTY_TBB_DLL}" "${3RDPARTY_TBB_MALLOC_DLL}" DESTINATION "${INSTALL_DIR}/${DLL_SO_FOLDER}")
458
459 SET(3RDPARTY_TBB_DLL_DIR "")
460 SET(3RDPARTY_TBB_MALLOC_DLL_DIR "")
461 ELSE()
462 GET_FILENAME_COMPONENT(3RDPARTY_TBB_DLL_DIR "${3RDPARTY_TBB_DLL}" PATH)
463 GET_FILENAME_COMPONENT(3RDPARTY_TBB_MALLOC_DLL_DIR "${3RDPARTY_TBB_MALLOC_DLL}" PATH)
464 ENDIF()
465ENDIF()
466
467string( REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}")
468
469#CHECK ALL 3RDPARTY PATHS
470IF(3RDPARTY_NOT_INCLUDED)
471 MESSAGE(FATAL_ERROR "NOT FOUND: ${3RDPARTY_NOT_INCLUDED}" )
472ENDIF()
473
474list(REMOVE_DUPLICATES 3RDPARTY_INCLUDE_DIRS)
475string( REGEX REPLACE ";" "\n\t" 3RDPARTY_INCLUDE_DIRS_WITH_ENDS "${3RDPARTY_INCLUDE_DIRS}")
476MESSAGE(STATUS "3RDPARTY_INCLUDE_DIRS: ${3RDPARTY_INCLUDE_DIRS_WITH_ENDS}")
477include_directories( ${3RDPARTY_INCLUDE_DIRS} )
478
479list(REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS)
480string( REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}")
481MESSAGE(STATUS "3RDPARTY_LIBRARY_DIRS: ${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}")
482link_directories( ${3RDPARTY_LIBRARY_DIRS} )
483
484#
485SET(RUN_PROJECT "")
486SET(CASROOT_DEFINITION "set \"CASROOT=${CMAKE_SOURCE_DIR}\"")
487SET(BIN_DIR_POSTFIX "bin")
488SET(RESOURCE_DIR_PREFIX "%SCRIPTROOT%\\src")
489
490IF("${INSTALL_DIR}" STREQUAL "")
491 MESSAGE(FATAL_ERROR "INSTALL_DIR is empty")
492ELSE()
493 # inc,data,tests DIRECTORY
494 install(DIRECTORY "${CMAKE_SOURCE_DIR}/inc" DESTINATION "${INSTALL_DIR}" )
495 install(DIRECTORY "${CMAKE_SOURCE_DIR}/data" DESTINATION "${INSTALL_DIR}" )
496 IF(INSTALL_TESTS)
497 install(DIRECTORY "${CMAKE_SOURCE_DIR}/tests" DESTINATION "${INSTALL_DIR}" )
498 ENDIF()
499
500 # DRAW.BAT or DRAW.SH
501 install(FILES "${CMAKE_SOURCE_DIR}/adm/cmake/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
502 GROUP_READ GROUP_WRITE GROUP_EXECUTE
503 WORLD_READ WORLD_WRITE WORLD_EXECUTE)
504
505 configure_file("${CMAKE_SOURCE_DIR}/adm/cmake/env.${SCRIPT_EXT}.in" env.${SCRIPT_EXT} @ONLY)
506 install(FILES "${OCCT_BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" )
507ENDIF()
508
509IF(MSVC AND "${BUILD_TYPE}" STREQUAL "Debug")
510 SET(RUN_PROJECT "start OCCT.sln")
511 SET(BIN_DIR_POSTFIX "out\\bin\\Debug")
512 SET(RESOURCE_DIR_PREFIX "%CASROOT%\\src")
513 configure_file("${CMAKE_SOURCE_DIR}/adm/cmake/env.bat.in" OCCT.bat @ONLY)
514ENDIF()
515
516include(adm/cmake/CMakeToolKitsDeps.txt)