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