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