]> SALOME platform Git repositories - modules/shaper.git/blob - CMakeLists.txt
Salome HOME
Issue #2825: Set the same deflection value from preferences on highlighting as on...
[modules/shaper.git] / CMakeLists.txt
1 ## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 ##
3 ## This library is free software; you can redistribute it and/or
4 ## modify it under the terms of the GNU Lesser General Public
5 ## License as published by the Free Software Foundation; either
6 ## version 2.1 of the License, or (at your option) any later version.
7 ##
8 ## This library is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 ## Lesser General Public License for more details.
12 ##
13 ## You should have received a copy of the GNU Lesser General Public
14 ## License along with this library; if not, write to the Free Software
15 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 ##
17 ## See http:##www.salome-platform.org/ or
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 ##
20
21 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.10)
22
23 PROJECT (SHAPER)
24 # Ensure a proper linker behavior:
25 CMAKE_POLICY(SET CMP0003 NEW)
26 IF(WIN32)
27   CMAKE_POLICY(SET CMP0020 OLD) # disable automatic linking to qtmain.lib
28 ENDIF(WIN32)
29
30 SET (SHAPER_Version 9.2.0)
31
32 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeCommon" ${CMAKE_MODULE_PATH})
33 OPTION(SHAPER_BUILD_DOC "Generate SHAPER documentation" ON)
34
35 INCLUDE(SalomeMacros)
36
37 INCLUDE(FindEclipse)
38 INCLUDE(Common)
39 INCLUDE(FindSalomeQt5)
40 INCLUDE(FindSalome)
41 INCLUDE(FindSUIT)
42 INCLUDE(FindTInspector)
43
44 IF(${HAVE_SALOME})
45   SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
46   IF(EXISTS ${CONFIGURATION_ROOT_DIR})
47     LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
48     INCLUDE(SalomeMacros)
49   ELSE()
50     MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
51   ENDIF()
52   SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
53   IF(EXISTS ${KERNEL_ROOT_DIR})
54     LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
55     FIND_PACKAGE(SalomeKERNEL REQUIRED)
56     ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
57     INCLUDE_DIRECTORIES(${KERNEL_INCLUDE_DIRS})
58   ELSE(EXISTS ${KERNEL_ROOT_DIR})
59     MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
60   ENDIF(EXISTS ${KERNEL_ROOT_DIR})
61   INCLUDE(SalomeSetupPlatform)   # From CONFIGURATION
62
63   FIND_PACKAGE(SalomePythonInterp REQUIRED)
64   FIND_PACKAGE(SalomePythonLibs REQUIRED)
65
66   FIND_PACKAGE(SalomeOpenCASCADE REQUIRED)
67
68 ELSE(${HAVE_SALOME})
69   INCLUDE(FindPython)
70   INCLUDE(FindSalomeOpenCASCADE)
71 ENDIF(${HAVE_SALOME})
72
73 # Common CMake macros
74 # ===================
75
76
77 # Find LibXml2
78 IF(DEFINED ENV{LIBXML2_ROOT_DIR})
79     IF(WIN32)
80         FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/lib/libxml2.lib LIBXML2_LIBRARIES)
81         FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/include LIBXML2_INCLUDE_DIR)
82     ELSE()
83         FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/lib/libxml2.so LIBXML2_LIBRARIES)
84         FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/include/libxml2 LIBXML2_INCLUDE_DIR)
85     ENDIF()
86 ENDIF()
87 # It could be called only once
88 FIND_PACKAGE(LibXml2 REQUIRED)
89
90 SET(_pydir lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/salome)
91 SET(SHAPER_INSTALL_PYTHON_API ${_pydir}/salome/shaper CACHE INTERNAL "" FORCE)
92 SET(SHAPER_INSTALL_SWIG ${_pydir} CACHE INTERNAL "" FORCE)
93 IF(${HAVE_SALOME})
94     SET(SHAPER_INSTALL_ADDONS bin/salome CACHE INTERNAL "" FORCE)
95     SET(SHAPER_INSTALL_BIN lib/salome CACHE INTERNAL "" FORCE)
96     SET(SHAPER_INSTALL_PLUGIN_FILES lib/salome CACHE INTERNAL "" FORCE)
97     SET(SHAPER_INSTALL_PYTHON_FILES bin/salome CACHE INTERNAL "" FORCE)
98     SET(SHAPER_INSTALL_RESOURCES share/salome/resources/shaper CACHE INTERNAL "" FORCE)
99     SET(SHAPER_INSTALL_QM_RESOURCES share/salome/resources/shaper CACHE INTERNAL "" FORCE)
100     SET(SHAPER_INSTALL_XML_RESOURCES share/salome/resources/shaper CACHE INTERNAL "" FORCE)
101     SET(SHAPER_INSTALL_GUI_DOC share/doc/salome/gui/SHAPER CACHE INTERNAL "" FORCE)
102     SET(SHAPER_INSTALL_TUI_DOC share/doc/salome/tui/SHAPER CACHE INTERNAL "" FORCE)
103     # without SALOME there is another kind of documentation, separated one
104 ELSE(${HAVE_SALOME})
105     SET(SHAPER_INSTALL_ADDONS addons CACHE INTERNAL "" FORCE)
106     SET(SHAPER_INSTALL_BIN bin CACHE INTERNAL "" FORCE)
107     SET(SHAPER_INSTALL_PLUGIN_FILES plugins CACHE INTERNAL "" FORCE)
108     SET(SHAPER_INSTALL_PYTHON_FILES plugins CACHE INTERNAL "" FORCE)
109     SET(SHAPER_INSTALL_RESOURCES resources CACHE INTERNAL "" FORCE)
110     SET(SHAPER_INSTALL_QM_RESOURCES bin CACHE INTERNAL "" FORCE)
111     SET(SHAPER_INSTALL_XML_RESOURCES plugins CACHE INTERNAL "" FORCE)
112     SET(SHAPER_INSTALL_GUI_DOC doc CACHE INTERNAL "" FORCE)
113     SET(SHAPER_INSTALL_TUI_DOC doc CACHE INTERNAL "" FORCE)
114 ENDIF(${HAVE_SALOME})
115
116 # Sketcher: Change radius of circular edges while dragging a point on the edge
117 SET(SKETCHER_CHANGE_RADIUS_WHEN_MOVE TRUE)
118
119 ADD_SUBDIRECTORY (src/Config)
120 ADD_SUBDIRECTORY (src/Events)
121 ADD_SUBDIRECTORY (src/Selector)
122 ADD_SUBDIRECTORY (src/Model)
123 ADD_SUBDIRECTORY (src/XAO)
124 ADD_SUBDIRECTORY (src/GeomAPI)
125 ADD_SUBDIRECTORY (src/ModelAPI)
126 ADD_SUBDIRECTORY (src/ModelGeomAlgo)
127 ADD_SUBDIRECTORY (src/GeomAlgoAPI)
128 ADD_SUBDIRECTORY (src/GeomAlgoImpl)
129 ADD_SUBDIRECTORY (src/GeomData)
130 ADD_SUBDIRECTORY (src/GeomDataAPI)
131 ADD_SUBDIRECTORY (src/PartSetPlugin)
132 ADD_SUBDIRECTORY (src/ConstructionPlugin)
133 ADD_SUBDIRECTORY (src/BuildPlugin)
134 ADD_SUBDIRECTORY (src/PrimitivesPlugin)
135 ADD_SUBDIRECTORY (src/GDMLPlugin)
136 ADD_SUBDIRECTORY (src/FeaturesPlugin)
137 ADD_SUBDIRECTORY (src/CollectionPlugin)
138 ADD_SUBDIRECTORY (src/SamplePanelPlugin)
139 ADD_SUBDIRECTORY (src/SketcherPrs)
140 ADD_SUBDIRECTORY (src/SketchPlugin)
141 ADD_SUBDIRECTORY (src/SketchSolver)
142 ADD_SUBDIRECTORY (src/ModuleBase)
143 ADD_SUBDIRECTORY (src/PartSet)
144
145 ADD_SUBDIRECTORY (src/XGUI)
146 ADD_SUBDIRECTORY (src/ExchangePlugin)
147 ADD_SUBDIRECTORY (src/GeomValidators)
148 ADD_SUBDIRECTORY (src/InitializationPlugin)
149 ADD_SUBDIRECTORY (src/ParametersPlugin)
150 ADD_SUBDIRECTORY (src/PythonAddons)
151 ADD_SUBDIRECTORY (src/PythonAPI)
152 # High Level C++/Python API
153 ADD_SUBDIRECTORY (src/ModelHighAPI)
154 ADD_SUBDIRECTORY (src/BuildAPI)
155 ADD_SUBDIRECTORY (src/ConstructionAPI)
156 ADD_SUBDIRECTORY (src/ExchangeAPI)
157 ADD_SUBDIRECTORY (src/FeaturesAPI)
158 ADD_SUBDIRECTORY (src/CollectionAPI)
159 ADD_SUBDIRECTORY (src/ParametersAPI)
160 ADD_SUBDIRECTORY (src/PartSetAPI)
161 ADD_SUBDIRECTORY (src/PrimitivesAPI)
162 ADD_SUBDIRECTORY (src/SketchAPI)
163 ADD_SUBDIRECTORY (src/GDMLAPI)
164 ADD_SUBDIRECTORY (src/ConnectorAPI)
165 # Tests
166 ADD_SUBDIRECTORY (test.API/SHAPER)
167
168 IF(${HAVE_SALOME})
169     ADD_SUBDIRECTORY (src/SHAPERGUI)
170     ADD_SUBDIRECTORY (src/ConnectorPlugin)
171 ENDIF(${HAVE_SALOME})
172
173 ENABLE_TESTING()
174
175 IF(ADD_MODELS_TESTS)
176   ADD_SUBDIRECTORY (test.models)
177   ADD_CUSTOM_TARGET(run_unit_tests COMMAND ${CMAKE_CTEST_COMMAND} -C "${CMAKE_BUILD_TYPE}" -LE "models_tests")
178 ENDIF(ADD_MODELS_TESTS)
179
180
181 IF(SHAPER_BUILD_DOC)
182     INCLUDE(FindSphinx)
183     ADD_SUBDIRECTORY (doc)
184 ENDIF(SHAPER_BUILD_DOC)
185
186
187
188 # Add the uninstall target for eclipse IDE
189 if (CMAKE_GENERATOR MATCHES "NMake Makefiles")
190 configure_file("${CMAKE_SOURCE_DIR}/CMakeCommon/cmake_uninstall.cmake.in"
191                "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
192                IMMEDIATE @ONLY)
193 add_custom_target(uninstall
194                   COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
195 endif (CMAKE_GENERATOR MATCHES "NMake Makefiles")
196
197 # Add special Git hooks
198 if((EXISTS "${CMAKE_SOURCE_DIR}/.git") AND (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git"))
199   if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git")
200     set(GIT_SUBMODULE_PATH ".git")
201   else()
202     file(READ "${CMAKE_CURRENT_SOURCE_DIR}/.git" GIT_SUBMODULE_PATH)
203     string(REGEX REPLACE "gitdir: " "" GIT_SUBMODULE_PATH "${GIT_SUBMODULE_PATH}")
204     string(REGEX REPLACE "\n" "" GIT_SUBMODULE_PATH "${GIT_SUBMODULE_PATH}")
205   endif()
206
207   configure_file("${CMAKE_CURRENT_SOURCE_DIR}/GitHooks/pre-commit.in"
208                  "${CMAKE_CURRENT_SOURCE_DIR}/${GIT_SUBMODULE_PATH}/hooks/pre-commit")
209 endif()