Incrementation of OCCT version up to 6.7.2 dev
[occt.git] / CMakeLists.txt
CommitLineData
03c69aec 1cmake_minimum_required ( VERSION 2.6)
166d6cd7 2
ad211ad3 3if (NOT BUILD_CONFIGURATION)
4 set(BUILD_CONFIGURATION "Release" CACHE STRING "Build type of OCCT" FORCE)
5 SET_PROPERTY(CACHE BUILD_CONFIGURATION PROPERTY STRINGS Release Debug RelWithDebInfo)
03c69aec 6endif()
166d6cd7 7
ad211ad3 8set(CMAKE_CONFIGURATION_TYPES ${BUILD_CONFIGURATION} CACHE INTERNAL "" FORCE)
03c69aec 9
10project(OCCT)
11
ad211ad3 12set_property(GLOBAL PROPERTY USE_FOLDERS ON)
03c69aec 13
14set(BUILD_SHARED_LIBS ON)
15
ad211ad3 16IF("${BUILD_CONFIGURATION}" 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
ad211ad3 24SET( CMAKE_BUILD_TYPE ${BUILD_CONFIGURATION} CACHE INTERNAL "Build type of OCCT" FORCE )
03c69aec 25
ad211ad3 26SET( INSTALL_DIR "" CACHE PATH "Directory that will contain install files of OCCT" )
03c69aec 27SET( CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE )
28
ad211ad3 29set (BUILD_TOOLKITS "" CACHE STRING "Toolkits are also included in OCCT")
03c69aec 30separate_arguments(BUILD_TOOLKITS)
31
234e52be 32IF(MSVC)
33 SET(BUILD_Samples OFF CACHE BOOL "OCCT samples building")
34ENDIF()
35
03c69aec 36include(adm/cmake/CMakeModules.txt)
37
38if (WIN32)
39 set(SCRIPT_EXT bat)
40else()
41 set(SCRIPT_EXT sh)
42endif()
43
ad211ad3 44if (MSVC)
45 add_definitions(/fp:precise)
46endif()
47
4d42a1a5 48# set compiler short name and choose SSE2 option for appropriate MSVC compilers
03c69aec 49if (DEFINED MSVC70)
50 SET(COMPILER vc7)
51elseif (DEFINED MSVC80)
52 SET(COMPILER vc8)
4d42a1a5 53 if (${COMPILER_BITNESS} STREQUAL 32)
54 add_definitions(/arch:SSE2)
55 endif()
03c69aec 56elseif (DEFINED MSVC90)
57 SET(COMPILER vc9)
4d42a1a5 58 if (${COMPILER_BITNESS} STREQUAL 32)
59 add_definitions(/arch:SSE2)
60 endif()
03c69aec 61elseif (DEFINED MSVC10)
62 SET(COMPILER vc10)
4d42a1a5 63 if (${COMPILER_BITNESS} STREQUAL 32)
64 add_definitions(/arch:SSE2)
65 endif()
03c69aec 66elseif (DEFINED MSVC11)
67 SET(COMPILER vc11)
68else()
69 SET(COMPILER ${CMAKE_GENERATOR})
70endif()
71
03c69aec 72add_definitions(-DCSFDB)
73if(WIN32)
74 add_definitions(/DWNT -wd4996)
75elseif(APPLE)
76 add_definitions(-fexceptions -fPIC -DOCC_CONVERT_SIGNALS -DHAVE_WOK_CONFIG_H -DHAVE_CONFIG_H)
77else()
78 add_definitions(-fexceptions -fPIC -DOCC_CONVERT_SIGNALS -DHAVE_WOK_CONFIG_H -DHAVE_CONFIG_H -DLIN)
79endif()
80
4d42a1a5 81# enable structured exceptions for MSVC
03c69aec 82string(REGEX MATCH "EHsc" ISFLAG "${CMAKE_CXX_FLAGS}")
83IF(ISFLAG)
84 STRING(REGEX REPLACE "EHsc" "EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
85ELSEIF(WIN32)
86 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -EHa")
87ENDIF()
88
4d42a1a5 89# enable parallel compilation on MSVC 9 and above
03c69aec 90IF(WIN32)
91 IF(NOT DEFINED MSVC70 AND NOT DEFINED MSVC80)
92 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -MP")
93 ENDIF()
94ENDIF()
95
4d42a1a5 96# increase compiler warnings level (-W4 for MSVC, -Wall for GCC)
d5aedb2c 97IF(MSVC)
98 if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
99 string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
100 else()
101 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
102 endif()
103elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
104 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
105endif()
106
03c69aec 107SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
108SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
109
110SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEB")
111SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEB")
112
113set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/lib)
114set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/lib)
115set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/bin)
116
117# RESOURCES
118install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/DrawResources" DESTINATION "${INSTALL_DIR}/src" )
119install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/StdResource" DESTINATION "${INSTALL_DIR}/src" )
120install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/SHMessage" DESTINATION "${INSTALL_DIR}/src" )
121install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/Textures" DESTINATION "${INSTALL_DIR}/src" )
4058ef10 122install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/Shaders" DESTINATION "${INSTALL_DIR}/src" )
03c69aec 123install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/XSMessage" DESTINATION "${INSTALL_DIR}/src" )
03c69aec 124install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/XSTEPResource" DESTINATION "${INSTALL_DIR}/src" )
125install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/XmlOcafResource" DESTINATION "${INSTALL_DIR}/src" )
126
127install(FILES "${CMAKE_SOURCE_DIR}/src/UnitsAPI/Lexi_Expr.dat" DESTINATION "${INSTALL_DIR}/src/UnitsAPI" )
128install(FILES "${CMAKE_SOURCE_DIR}/src/UnitsAPI/Units.dat" DESTINATION "${INSTALL_DIR}/src/UnitsAPI" )
ad211ad3 129install(FILES "${CMAKE_SOURCE_DIR}/src/TObj/TObj.msg" DESTINATION "${INSTALL_DIR}/src/TObj" )
03c69aec 130
ad211ad3 131IF("${BUILD_CONFIGURATION}" STREQUAL "Release")
03c69aec 132 SET(BUILD_SUFFIX "")
133ELSE()
134 SET(BUILD_SUFFIX "") # debug == release
135ENDIF()
136
137FUNCTION(SUBDIRECTORY_NAMES MAIN_DIRECTORY RESULT)
138 file(GLOB SUB_ITEMS "${MAIN_DIRECTORY}/*")
234e52be 139
03c69aec 140 foreach(ITEM ${SUB_ITEMS})
141 if(IS_DIRECTORY "${ITEM}")
142 GET_FILENAME_COMPONENT(ITEM_NAME "${ITEM}" NAME)
143 LIST(APPEND LOCAL_RESULT "${ITEM_NAME}")
144 endif()
145 endforeach()
146 set (${RESULT} ${LOCAL_RESULT} PARENT_SCOPE)
147ENDFUNCTION()
148
149FUNCTION(FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
150 string( TOLOWER "${PRODUCT_NAME}" lower_PRODUCT_NAME )
234e52be 151
11fca7c1 152 LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*${COMPILER}.*${COMPILER_BITNESS}")
153 LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
154 LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${COMPILER_BITNESS}")
03c69aec 155 LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+")
156 LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}")
234e52be 157
03c69aec 158 SUBDIRECTORY_NAMES( "${ROOT_DIR}" SUBDIR_NAME_LIST)
234e52be 159
03c69aec 160 FOREACH( SEARCH_TEMPLATE ${SEARCH_TEMPLATES})
161 IF(LOCAL_RESULT)
162 BREAK()
163 ENDIF()
234e52be 164
03c69aec 165 FOREACH(SUBDIR_NAME ${SUBDIR_NAME_LIST})
166 string( TOLOWER "${SUBDIR_NAME}" lower_SUBDIR_NAME )
234e52be 167
03c69aec 168 STRING(REGEX MATCH "${SEARCH_TEMPLATE}" DUMMY_VAR "${lower_SUBDIR_NAME}")
169 IF(DUMMY_VAR)
170 LIST(APPEND LOCAL_RESULT ${SUBDIR_NAME})
171 ENDIF()
172 ENDFOREACH()
173 ENDFOREACH()
234e52be 174
03c69aec 175 IF(LOCAL_RESULT)
176 LIST(LENGTH "${LOCAL_RESULT}" LOC_LEN)
177 MATH(EXPR LAST_ELEMENT_INDEX "${LOC_LEN}-1")
178 LIST(GET LOCAL_RESULT ${LAST_ELEMENT_INDEX} DUMMY)
179 SET(${RESULT} ${DUMMY} PARENT_SCOPE)
234e52be 180 ENDIF()
03c69aec 181ENDFUNCTION()
182
183IF(WIN32)
184 SET(DLL_SO "dll")
185 SET(DLL_SO_FOLDER "bin")
186 SET(DLL_SO_PREFIX "")
187ELSEIF(APPLE)
188 SET(DLL_SO "dylib")
189 SET(DLL_SO_FOLDER "lib")
190 SET(DLL_SO_PREFIX "lib")
191ELSE()
192 SET(DLL_SO "so")
193 SET(DLL_SO_FOLDER "lib")
194 SET(DLL_SO_PREFIX "lib")
195ENDIF()
196
7c633a3e 197SET(3RDPARTY_DIR ${CMAKE_SOURCE_DIR} CACHE PATH "Directory contains required 3rdparty products")
03c69aec 198SET(3RDPARTY_INCLUDE_DIRS "")
199SET(3RDPARTY_NOT_INCLUDED)
200
201IF(APPLE)
ad211ad3 202 SET(USE_GLX OFF CACHE BOOL "whether use X11 OpenGL on OSX or not")
03c69aec 203ENDIF()
204
ad211ad3 205SET(USE_GL2PS OFF CACHE BOOL "whether use gl2ps product or not")
206SET(USE_FREEIMAGE OFF CACHE BOOL "whether use freeimage product or not")
207SET(USE_TBB OFF CACHE BOOL "whether use tbb product or not")
208SET(USE_OPENCL OFF CACHE BOOL "whether use OpenCL or not")
03c69aec 209
210SET(INSTALL_TESTS OFF CACHE BOOL "Is tests copy to install directory")
211
a5deedd0 212MACRO (CHECK_AND_UNSET VARNAME)
213 IF(DEFINED ${VARNAME})
214 UNSET(${VARNAME} CACHE)
215 ENDIF()
216ENDMACRO()
217
218MACRO (CHECK_AND_UNSET_GROUP VARNAME)
219 CHECK_AND_UNSET ("${VARNAME}_DIR")
220 CHECK_AND_UNSET ("${VARNAME}_INCLUDE_DIR")
221 CHECK_AND_UNSET ("${VARNAME}_DLL")
222 CHECK_AND_UNSET ("${VARNAME}_LIBRARY")
223ENDMACRO()
224
03c69aec 225MACRO(THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME)
226 IF(NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DIR)
227 SET(3RDPARTY_${PRODUCT_NAME}_DIR "" CACHE PATH "Directory contains ${PRODUCT_NAME} product")
228 ENDIF()
234e52be 229
03c69aec 230 IF(3RDPARTY_DIR AND ("${3RDPARTY_${PRODUCT_NAME}_DIR}" STREQUAL "" OR CHANGES_ARE_NEEDED))
231 FIND_PRODUCT_DIR("${3RDPARTY_DIR}" ${PRODUCT_NAME} ${PRODUCT_NAME}_DIR_NAME)
232 IF("${${PRODUCT_NAME}_DIR_NAME}" STREQUAL "")
233 MESSAGE(STATUS "${PRODUCT_NAME} DON'T FIND")
234 ELSE()
235 SET(3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_DIR}/${${PRODUCT_NAME}_DIR_NAME}" CACHE PATH "Directory contains ${PRODUCT_NAME} product" FORCE)
236 ENDIF()
237 ENDIF()
234e52be 238
03c69aec 239 SET(INSTALL_${PRODUCT_NAME} OFF CACHE BOOL "Is ${PRODUCT_NAME} lib copy to install directory")
240
241 IF(3RDPARTY_${PRODUCT_NAME}_DIR)
242 IF("${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND")
243 SET(3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "Directory contains headers of the ${PRODUCT_NAME} product" FORCE)
244 FIND_PATH(3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR ${HEADER_NAME} PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}/include" NO_DEFAULT_PATH)
03c69aec 245 ENDIF()
234e52be 246
03c69aec 247 IF("${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND")
ad211ad3 248 SET(3RDPARTY_${PRODUCT_NAME}_LIBRARY "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "Path to library of the ${PRODUCT_NAME} product" FORCE)
03c69aec 249 FIND_LIBRARY(3RDPARTY_${PRODUCT_NAME}_LIBRARY ${LIBRARY_NAME} PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}/lib" NO_DEFAULT_PATH)
03c69aec 250 ENDIF()
234e52be 251
03c69aec 252 IF("${3RDPARTY_${PRODUCT_NAME}_DLL}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_${PRODUCT_NAME}_DLL}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND")
ad211ad3 253 SET(3RDPARTY_${PRODUCT_NAME}_DLL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND" CACHE FILEPATH "Path to shared library of the ${PRODUCT_NAME} product" FORCE)
03c69aec 254 FIND_FILE(3RDPARTY_${PRODUCT_NAME}_DLL "${DLL_SO_PREFIX}${LIBRARY_NAME}.${DLL_SO}" PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}/${DLL_SO_FOLDER}" NO_DEFAULT_PATH)
03c69aec 255 ENDIF()
234e52be 256
03c69aec 257 MARK_AS_ADVANCED(3RDPARTY_${PRODUCT_NAME}_DIR)
7c633a3e 258 ELSE()
234e52be 259
7c633a3e 260 ENDIF()
234e52be 261
7c633a3e 262 # check default path (with additions) for header search
263 IF("${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}" STREQUAL "" OR "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND")
264 SET(3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "Directory contains headers of the ${PRODUCT_NAME} product" FORCE)
265 FIND_PATH(3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR ${HEADER_NAME} ${3RDPARTY_${PRODUCT_NAME}_ADDITIONAL_PATH_FOR_HEADER})
266 ENDIF()
267
268 # check default path (with additions) for library search
269 IF("${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" STREQUAL "" OR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND")
270 SET(3RDPARTY_${PRODUCT_NAME}_LIBRARY "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "Directory contains library of the ${PRODUCT_NAME} product" FORCE)
271 FIND_LIBRARY(3RDPARTY_${PRODUCT_NAME}_LIBRARY ${LIBRARY_NAME} ${3RDPARTY_${PRODUCT_NAME}_ADDITIONAL_PATH_FOR_LIB})
272 ENDIF()
273
274 # check default path (with additions) for DLL search
275 IF("${3RDPARTY_${PRODUCT_NAME}_DLL}" STREQUAL "" OR "${3RDPARTY_${PRODUCT_NAME}_DLL}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND")
276 SET(3RDPARTY_${PRODUCT_NAME}_DLL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND" CACHE FILEPATH "Directory contains shared library of the ${PRODUCT_NAME} product" FORCE)
277 FIND_FILE(3RDPARTY_${PRODUCT_NAME}_DLL "${DLL_SO_PREFIX}${LIBRARY_NAME}.${DLL_SO}" ${3RDPARTY_${PRODUCT_NAME}_ADDITIONAL_PATH_FOR_DLL})
03c69aec 278 ENDIF()
279
280 IF(3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR)
281 SET(3RDPARTY_INCLUDE_DIRS "${3RDPARTY_INCLUDE_DIRS};${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
282 ELSE()
283 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR)
284 ENDIF()
285
286 IF(3RDPARTY_${PRODUCT_NAME}_LIBRARY)
287 GET_FILENAME_COMPONENT(3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
288 SET(3RDPARTY_LIBRARY_DIRS "${3RDPARTY_LIBRARY_DIRS};${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
289 ELSE()
290 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_LIBRARY)
291 ENDIF()
234e52be 292
03c69aec 293 IF(3RDPARTY_${PRODUCT_NAME}_DLL)
294 #
295 ELSE()
296 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL)
297 ENDIF()
298
299 IF(INSTALL_${PRODUCT_NAME})
300 INSTALL(FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}" DESTINATION "${INSTALL_DIR}/${DLL_SO_FOLDER}")
301 SET(3RDPARTY_${PRODUCT_NAME}_DLL_DIR "")
302 ELSE()
303 GET_FILENAME_COMPONENT(3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
304 ENDIF()
305ENDMACRO()
306
307# TCL
ad211ad3 308INCLUDE(adm/templates/tcl.cmake)
03c69aec 309
ad211ad3 310#install tcltk
311IF(INSTALL_TCL)
a0726e55 312 SET(3RDPARTY_TCL_DLL_DIR "")
313 SET(3RDPARTY_TCL_LIB_DIR "")
314
315 GET_FILENAME_COMPONENT(3RDPARTY_TCL_LIB_DIR_INSIDE "${3RDPARTY_TCL_LIBRARY}" PATH)
316 GET_FILENAME_COMPONENT(3RDPARTY_TCL_DLL_DIR_INSIDE "${3RDPARTY_TCL_DLL}" PATH)
234e52be 317
ad211ad3 318 IF (IS_TCL_VERSION_FOUND)
319 SET (TCL_VERSION ${TCL_MAJOR_VERSION}${TCL_SEP}${TCL_MINOR_VERSION})
320 SET (TCL_FOLDER_VERSION ${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION})
321 ELSE()
322 SET (TCL_VERSION "")
03c69aec 323
ad211ad3 324 #TODO SEARCH tclX.X & tkX.X subdirs
325 SET (TCL_FOLDER_VERSION "")
326 ENDIF()
327
a0726e55 328 INSTALL(FILES "${3RDPARTY_TCL_DLL_DIR_INSIDE}/${DLL_SO_PREFIX}tcl${TCL_VERSION}.${DLL_SO}" DESTINATION "${INSTALL_DIR}/${DLL_SO_FOLDER}")
329 INSTALL(FILES "${3RDPARTY_TCL_DLL_DIR_INSIDE}/${DLL_SO_PREFIX}tk${TCL_VERSION}.${DLL_SO}" DESTINATION "${INSTALL_DIR}/${DLL_SO_FOLDER}")
03c69aec 330
ad211ad3 331 IF (IS_TCL_VERSION_FOUND)
a0726e55 332 INSTALL(DIRECTORY "${3RDPARTY_TCL_LIB_DIR_INSIDE}/tcl8" DESTINATION "${INSTALL_DIR}/lib")
333 INSTALL(DIRECTORY "${3RDPARTY_TCL_LIB_DIR_INSIDE}/tcl${TCL_FOLDER_VERSION}" DESTINATION "${INSTALL_DIR}/lib")
334 INSTALL(DIRECTORY "${3RDPARTY_TCL_LIB_DIR_INSIDE}/tk${TCL_FOLDER_VERSION}" DESTINATION "${INSTALL_DIR}/lib")
ad211ad3 335 ELSE()
336 MESSAGE(STATUS "\nWarning: tclX.X and tkX.X subdirs won't be copyied during the installation process.")
337 MESSAGE(STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")
338 ENDIF()
a0726e55 339ELSE()
340 GET_FILENAME_COMPONENT(3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH)
341 GET_FILENAME_COMPONENT(3RDPARTY_TCL_LIB_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
03c69aec 342ENDIF()
343
344# GLX
ad211ad3 345IF(USE_GLX)
03c69aec 346 ADD_DEFINITIONS(-DMACOSX_USE_GLX)
234e52be 347
03c69aec 348 IF(NOT DEFINED 3RDPARTY_GLX_DIR)
349 SET(3RDPARTY_GLX_DIR "" CACHE PATH "Directory contains GLX product")
350 ENDIF()
234e52be 351
03c69aec 352 IF(3RDPARTY_DIR AND ("${3RDPARTY_GLX_DIR}" STREQUAL "" OR CHANGES_ARE_NEEDED))
353 FIND_PRODUCT_DIR("${3RDPARTY_DIR}" GLX GLX_DIR_NAME)
354 IF("${GLX_DIR_NAME}" STREQUAL "")
355 MESSAGE(STATUS "GLX DON'T FIND")
356 ELSE()
357 SET(3RDPARTY_GLX_DIR "${3RDPARTY_DIR}/${GLX_DIR_NAME}" CACHE PATH "Directory contains GLX product" FORCE)
358 ENDIF()
359 ENDIF()
234e52be 360
03c69aec 361 IF(3RDPARTY_GLX_DIR)
362 SET(3RDPARTY_GLX_INCLUDE_DIR "${3RDPARTY_GLX_DIR}/include" CACHE FILEPATH "Directory contains headers of the GLX product" FORCE)
363 SET(3RDPARTY_GLX_LIBRARY_DIR "${3RDPARTY_GLX_DIR}/lib" CACHE FILEPATH "Directory contains library of the GLX product" FORCE)
234e52be 364
03c69aec 365 SET(3RDPARTY_INCLUDE_DIRS "${3RDPARTY_INCLUDE_DIRS};${3RDPARTY_GLX_INCLUDE_DIR}")
366 SET(3RDPARTY_LIBRARY_DIRS "${3RDPARTY_LIBRARY_DIRS};${3RDPARTY_GLX_LIBRARY_DIR}")
234e52be 367
03c69aec 368 MARK_AS_ADVANCED(3RDPARTY_GLX_DIR)
369 ELSE()
370 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_GLX_INCLUDE_DIR)
371 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_GLX_LIBRARY_DIR)
372 ENDIF()
373ENDIF()
374
375# FREETYPE
376THIRDPARTY_PRODUCT("FREETYPE" "ft2build.h" "freetype${BUILD_SUFFIX}")
377
378IF("${3RDPARTY_FREETYPE_INCLUDE_DIR}" STREQUAL "" OR "${3RDPARTY_FREETYPE_INCLUDE_DIR}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND")
234e52be 379
03c69aec 380ELSEIF(EXISTS "${3RDPARTY_FREETYPE_INCLUDE_DIR}/freetype2/")
381 SET(3RDPARTY_INCLUDE_DIRS "${3RDPARTY_INCLUDE_DIRS};${3RDPARTY_FREETYPE_INCLUDE_DIR}/freetype2")
382ENDIF()
383
384# FREEIMAGE
ad211ad3 385IF(USE_FREEIMAGE)
234e52be 386 ADD_DEFINITIONS(-DHAVE_FREEIMAGE)
03c69aec 387
388 THIRDPARTY_PRODUCT("FREEIMAGE" "FreeImage.h" "freeimage${BUILD_SUFFIX}")
389 IF(WIN32)
390 IF("${3RDPARTY_FREEIMAGE_DIR}" STREQUAL "")
391 ELSE()
392 SET (3RDPARTY_FREEIMAGEPLUS_DIR "${3RDPARTY_FREEIMAGE_DIR}")
393 ENDIF()
234e52be 394
03c69aec 395 THIRDPARTY_PRODUCT("FREEIMAGEPLUS" "FreeImagePlus.h" "freeimageplus${BUILD_SUFFIX}")
234e52be 396
03c69aec 397 ENDIF()
a5deedd0 398ELSE()
399 CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE")
400 CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGEPLUS")
401 CHECK_AND_UNSET ("INSTALL_FREEIMAGE")
402 CHECK_AND_UNSET ("INSTALL_FREEIMAGEPLUS")
03c69aec 403ENDIF()
404
405# GL2PS
ad211ad3 406IF(USE_GL2PS)
03c69aec 407 ADD_DEFINITIONS(-DHAVE_GL2PS)
408 THIRDPARTY_PRODUCT("GL2PS" "gl2ps.h" "gl2ps${BUILD_SUFFIX}")
a5deedd0 409ELSE()
410 CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
411 CHECK_AND_UNSET ("INSTALL_GL2PS")
03c69aec 412ENDIF()
413
7c633a3e 414# OPENCL
ad211ad3 415IF(USE_OPENCL)
234e52be 416 ADD_DEFINITIONS(-DHAVE_OPENCL)
417
7c633a3e 418 SET (3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_HEADER $ENV{AMDAPPSDKROOT}/include
419 $ENV{INTELOCLSDKROOT}/include
420 $ENV{NVSDKCOMPUTE_ROOT}/OpenCL/common/inc
421 $ENV{ATISTREAMSDKROOT}/include)
234e52be 422
423
7c633a3e 424 IF(${COMPILER_BITNESS} STREQUAL 32)
425 SET (3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_LIB $ENV{AMDAPPSDKROOT}/lib/x86
426 $ENV{INTELOCLSDKROOT}/lib/x86
427 $ENV{NVSDKCOMPUTE_ROOT}/OpenCL/common/lib/Win32
428 $ENV{ATISTREAMSDKROOT}/lib/x86)
429 ELSEIF(${COMPILER_BITNESS} STREQUAL 64)
430 SET (3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_LIB $ENV{AMDAPPSDKROOT}/lib/x86_64
431 $ENV{INTELOCLSDKROOT}/lib/x64
432 $ENV{NVSDKCOMPUTE_ROOT}/OpenCL/common/lib/x64
433 $ENV{ATISTREAMSDKROOT}/lib/x86_64)
434 ENDIF()
234e52be 435
436
7c633a3e 437 THIRDPARTY_PRODUCT("OPENCL" "CL/cl.h" "OpenCL${BUILD_SUFFIX}")
234e52be 438
439 # if CL/cl.h isn't found (and 3RDPARTY_OPENCL_INCLUDE_DIR isn't defined)
7c633a3e 440 # then try to find OpenCL/cl.h (all other variable won't be changed)
441 THIRDPARTY_PRODUCT("OPENCL" "OpenCL/cl.h" "OpenCL${BUILD_SUFFIX}")
a5deedd0 442ELSE()
443 CHECK_AND_UNSET_GROUP ("3RDPARTY_OPENCL")
444 CHECK_AND_UNSET ("3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_LIB")
445 CHECK_AND_UNSET ("3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_LIB")
446 CHECK_AND_UNSET ("INSTALL_OPENCL")
7c633a3e 447ENDIF()
448
03c69aec 449# TBB
ad211ad3 450IF (USE_TBB)
03c69aec 451 ADD_DEFINITIONS(-DHAVE_TBB)
452
ad211ad3 453 INCLUDE(adm/templates/tbb.cmake)
234e52be 454
03c69aec 455 IF(INSTALL_TBB)
456 INSTALL(FILES "${3RDPARTY_TBB_DLL}" "${3RDPARTY_TBB_MALLOC_DLL}" DESTINATION "${INSTALL_DIR}/${DLL_SO_FOLDER}")
457
458 SET(3RDPARTY_TBB_DLL_DIR "")
459 SET(3RDPARTY_TBB_MALLOC_DLL_DIR "")
460 ELSE()
461 GET_FILENAME_COMPONENT(3RDPARTY_TBB_DLL_DIR "${3RDPARTY_TBB_DLL}" PATH)
462 GET_FILENAME_COMPONENT(3RDPARTY_TBB_MALLOC_DLL_DIR "${3RDPARTY_TBB_MALLOC_DLL}" PATH)
463 ENDIF()
a5deedd0 464ELSE()
465 CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
466 CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB_MALLOC")
467 CHECK_AND_UNSET ("3RDPARTY_TBB_DIR_NAME")
468 CHECK_AND_UNSET ("INSTALL_TBB")
03c69aec 469ENDIF()
470
471string( REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}")
472
473#CHECK ALL 3RDPARTY PATHS
474IF(3RDPARTY_NOT_INCLUDED)
475 MESSAGE(FATAL_ERROR "NOT FOUND: ${3RDPARTY_NOT_INCLUDED}" )
476ENDIF()
477
478list(REMOVE_DUPLICATES 3RDPARTY_INCLUDE_DIRS)
479string( REGEX REPLACE ";" "\n\t" 3RDPARTY_INCLUDE_DIRS_WITH_ENDS "${3RDPARTY_INCLUDE_DIRS}")
480MESSAGE(STATUS "3RDPARTY_INCLUDE_DIRS: ${3RDPARTY_INCLUDE_DIRS_WITH_ENDS}")
481include_directories( ${3RDPARTY_INCLUDE_DIRS} )
482
483list(REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS)
484string( REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}")
485MESSAGE(STATUS "3RDPARTY_LIBRARY_DIRS: ${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}")
486link_directories( ${3RDPARTY_LIBRARY_DIRS} )
487
03c69aec 488IF("${INSTALL_DIR}" STREQUAL "")
489 MESSAGE(FATAL_ERROR "INSTALL_DIR is empty")
490ELSE()
491 # inc,data,tests DIRECTORY
492 install(DIRECTORY "${CMAKE_SOURCE_DIR}/inc" DESTINATION "${INSTALL_DIR}" )
493 install(DIRECTORY "${CMAKE_SOURCE_DIR}/data" DESTINATION "${INSTALL_DIR}" )
494 IF(INSTALL_TESTS)
495 install(DIRECTORY "${CMAKE_SOURCE_DIR}/tests" DESTINATION "${INSTALL_DIR}" )
496 ENDIF()
497
498 # DRAW.BAT or DRAW.SH
ad211ad3 499 install(FILES "${CMAKE_SOURCE_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
03c69aec 500 GROUP_READ GROUP_WRITE GROUP_EXECUTE
501 WORLD_READ WORLD_WRITE WORLD_EXECUTE)
234e52be 502 IF (BUILD_Samples)
503 install(FILES "${CMAKE_SOURCE_DIR}/adm/templates/sample.bat" DESTINATION "${INSTALL_DIR}")
504 ENDIF()
03c69aec 505
ad211ad3 506 configure_file("${CMAKE_SOURCE_DIR}/adm/templates/env.${SCRIPT_EXT}.in" env.${SCRIPT_EXT} @ONLY)
03c69aec 507 install(FILES "${OCCT_BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" )
508ENDIF()
509
03c69aec 510include(adm/cmake/CMakeToolKitsDeps.txt)
234e52be 511
512IF (BUILD_Samples)
513 SET (CMAKE_MFC_FLAG 2)
514 SET (OCCT_ROOT ${CMAKE_SOURCE_DIR})
515
516 SET (MFC_STANDARD_SAMPLES_DIR ${OCCT_ROOT}/samples/mfc/standard)
517 SET (COMMON_WINMAIN_FILE ${MFC_STANDARD_SAMPLES_DIR}/Common/Winmain.cpp)
518
519 subdirs(samples/mfc/standard/mfcsample)
520 subdirs(samples/mfc/standard/01_Geometry)
521 subdirs(samples/mfc/standard/02_Modeling)
522 subdirs(samples/mfc/standard/03_Viewer2d)
523 subdirs(samples/mfc/standard/04_Viewer3d)
524 subdirs(samples/mfc/standard/05_ImportExport)
525 subdirs(samples/mfc/standard/06_Ocaf)
526 subdirs(samples/mfc/standard/07_Triangulation)
527 subdirs(samples/mfc/standard/08_HLR)
528 subdirs(samples/mfc/standard/09_Animation)
529 subdirs(samples/mfc/standard/10_Convert)
530ENDIF()