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