0029684: Configuration: modification of build Inspector tool standalone on occt
[occt.git] / samples / tools / TStandalone / CMakeLists.txt
1 cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
2 project (TStandalone)
3
4 set (CASROOT "" CACHE PATH "Third party OpenCascade dir" )
5 set (3RDPARTY_DIR "" CACHE PATH "Third party dir" )
6 set (INSTALL_DIR "" CACHE PATH "Where to install" )
7
8 if (NOT "$ENV{CASROOT}" STREQUAL "" AND EXISTS "$ENV{CASROOT}")
9   set (CASROOT "$ENV{CASROOT}")
10   #set (3RDPARTY_OCCT_DIR "${CASROOT}")
11   #message("Environment CASROOT: ${CASROOT}")
12   #message("Environment 3RDPARTY_OCCT_DIR: ${CASROOT}")
13 endif()
14
15 if (NOT "$ENV{THIRDPARTY_DIR}" STREQUAL ""  AND EXISTS "$ENV{THIRDPARTY_DIR}")
16   set (3RDPARTY_DIR "$ENV{THIRDPARTY_DIR}")
17   message("Environment THIRDPARTY_DIR: ${3RDPARTY_DIR}")
18 endif()
19
20 if (NOT "$ENV{INSTALL_DIR}" STREQUAL "")
21   set (INSTALL_DIR "$ENV{INSTALL_DIR}")
22   message("Environment INSTALL_DIR: ${INSTALL_DIR}")
23 endif()
24
25 # Define the next variable to has defined 3rdParties DLL dir variables
26 set (BUILD_SHARED_LIBS ON)
27
28 set (CASROOT_SOURCE_FILES "${CMAKE_SOURCE_DIR}/../../.."  CACHE PATH "OCCT sources dir to find tools packages" )
29 if ("${CASROOT}" STREQUAL "")
30   set (CASROOT "${CASROOT_SOURCE_FILES}/work/install"  CACHE PATH "OCCT sources dir to find tools packages" )
31 endif()
32
33 macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
34   include (${CASROOT_SOURCE_FILES}/${BEING_INCLUDED_FILE}.cmake)
35 endmacro()
36
37 macro (OCCT_INCLUDE_CMAKE_FILE_STANDALONE BEING_INCLUDED_FILE)
38   include (${CMAKE_SOURCE_DIR}/${BEING_INCLUDED_FILE}.cmake)
39 endmacro()
40
41 set (ADDITIONAL_DLL_DIR "" CACHE PATH "Additional paths that should be included into PATH" )
42 if (NOT "$ENV{ADDITIONAL_DLL_DIR}" STREQUAL "")
43   set (ADDITIONAL_DLL_DIR "$ENV{ADDITIONAL_DLL_DIR}")
44   message("Environment ADDITIONAL_DLL_DIR: ${ADDITIONAL_DLL_DIR}")
45 endif()
46
47 set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE)
48
49 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/3rdparty_macro")
50 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
51
52 OCCT_INCLUDE_CMAKE_FILE_STANDALONE("adm/cmake/occt")
53 if (OCCT_LIBRARY_NOT_FOUND)
54   message (FATAL_ERROR "Could NOT find OCCT Library in : ${3RDPARTY_OCCT_LIBRARY_DIR}" )
55 endif()
56
57 OCCT_MAKE_OS_WITH_BITNESS()
58 OCCT_MAKE_COMPILER_SHORT_NAME()
59
60 set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE )
61 set (INSTALL_API_DIR "${INSTALL_DIR}/api" CACHE PATH "" FORCE)
62 set (INSTALL_DIR_BIN "${OS_WITH_BIT}/${COMPILER}/bin" CACHE PATH "" FORCE)
63 set (INSTALL_DIR_LIB "${OS_WITH_BIT}/${COMPILER}/lib" CACHE PATH "" FORCE)
64 set (INSTALL_DIR_INCLUDE "inc" CACHE PATH "")
65
66 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype")
67 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimage")
68 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps")
69 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb")
70 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/qt")
71 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
72
73 #include (${CMAKE_SOURCE_DIR}/adm/cmake/3rdparty.cmake)
74
75 set (3RDPARTY_DLL_PATH "${USED_3RDPARTY_OCCT_DIRS};\
76 ${USED_3RDPARTY_FREETYPE_DIR};\
77 ${USED_3RDPARTY_FREEIMAGE_DIRS};\
78 ${USED_3RDPARTY_GL2PS_DIRS};\
79 ${3RDPARTY_QT_DIR}/bin;\
80 ${3RDPARTY_TBB_DLL_DIR}")
81
82 if (ADDITIONAL_DLL_DIR)
83   set (3RDPARTY_DLL_PATH "${3RDPARTY_DLL_PATH};\
84 ${ADDITIONAL_DLL_DIR}")
85 endif()
86
87 set (3RDPARTY_DLL_DEB_PATH "${3RDPARTY_DLL_PATH}")
88
89
90 set (BUILD_TOOLKITS
91   TKTInspectorAPI
92   TKView
93   TKTreeModel
94   TKDFBrowser
95   TKVInspector
96   TKShapeView
97   TKTInspector
98   TKToolsDraw
99 )
100
101 string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
102 message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all header files into ${CMAKE_BINARY_DIR}/inc ...")
103 # collect all the headers to <binary dir>/inc folder
104 COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOLKITS}" "${CASROOT_SOURCE_FILES}/tools" "${INSTALL_DIR_INCLUDE}/inspector")
105
106 OCCT_INCLUDE_CMAKE_FILE_STANDALONE ("adm/cmake/standalone_macros")
107 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/qt_macro")
108
109 set (BUILD_PROJECTS
110   TInspectorAPI
111   View
112   TreeModel
113   DFBrowserPane
114   DFBrowserPaneXDE
115   DFBrowser
116   ShapeView
117   VInspector
118   TInspector
119   TInspectorEXE
120   ToolsDraw
121 )
122 # include patched toolkit projects or original ones
123 foreach (PROJECT_ITEM ${BUILD_PROJECTS})
124   OCCT_ADD_SUBDIRECTORY ("src/${PROJECT_ITEM}")
125 endforeach()