]> SALOME platform Git repositories - modules/shaper.git/blob - CMakeLists.txt
Salome HOME
Unit test for issue #19931
[modules/shaper.git] / CMakeLists.txt
1 # Copyright (C) 2014-2020  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 email : webmaster.salome@opencascade.com
18 #
19
20 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.10)
21
22 PROJECT (SHAPER)
23 # Ensure a proper linker behavior:
24 CMAKE_POLICY(SET CMP0003 NEW)
25 IF(WIN32)
26   CMAKE_POLICY(SET CMP0020 OLD) # disable automatic linking to qtmain.lib
27 ENDIF(WIN32)
28
29 SET (SHAPER_Version 9.5.0)
30
31 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeCommon" ${CMAKE_MODULE_PATH})
32
33 IF (NOT CADBUILDER_BUILD_DOC)
34   OPTION(SHAPER_BUILD_DOC "Generate SHAPER documentation" ON)
35 ENDIF(NOT CADBUILDER_BUILD_DOC)
36
37 INCLUDE(SalomeMacros)
38
39 INCLUDE(FindEclipse)
40 INCLUDE(Common)
41 INCLUDE(FindSalomeQt5)
42 INCLUDE(FindSalome)
43 INCLUDE(FindSUIT)
44 INCLUDE(FindTInspector)
45
46 IF(${HAVE_SALOME})
47   SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
48   IF(EXISTS ${CONFIGURATION_ROOT_DIR})
49     LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
50     INCLUDE(SalomeMacros)
51   ELSE()
52     MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
53   ENDIF()
54   SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
55   IF(EXISTS ${KERNEL_ROOT_DIR})
56     LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
57     FIND_PACKAGE(SalomeKERNEL REQUIRED)
58     ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
59     INCLUDE_DIRECTORIES(${KERNEL_INCLUDE_DIRS})
60   ELSE(EXISTS ${KERNEL_ROOT_DIR})
61     MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
62   ENDIF(EXISTS ${KERNEL_ROOT_DIR})
63   INCLUDE(SalomeSetupPlatform)   # From CONFIGURATION
64
65   FIND_PACKAGE(SalomePythonInterp REQUIRED)
66   FIND_PACKAGE(SalomePythonLibs REQUIRED)
67
68   FIND_PACKAGE(SalomeOpenCASCADE REQUIRED)
69
70 ELSE(${HAVE_SALOME})
71   INCLUDE(FindPython)
72   INCLUDE(FindSalomeOpenCASCADE)
73 ENDIF(${HAVE_SALOME})
74
75 # Common CMake macros
76 # ===================
77
78
79 # Find LibXml2
80 IF(DEFINED ENV{LIBXML2_ROOT_DIR})
81     IF(WIN32)
82         FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/lib/libxml2.lib LIBXML2_LIBRARIES)
83         FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/include LIBXML2_INCLUDE_DIR)
84     ELSE()
85         IF(NOT "$ENV{LIBXML2_ROOT_DIR}" STREQUAL "/usr")
86             FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/lib/libxml2.so LIBXML2_LIBRARIES)
87             FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/include/libxml2 LIBXML2_INCLUDE_DIR)
88         ENDIF()
89     ENDIF()
90 ENDIF()
91 # It could be called only once
92 FIND_PACKAGE(LibXml2 REQUIRED)
93
94 SET(_pydir lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/salome)
95 SET(SHAPER_INSTALL_PYTHON_API ${_pydir}/salome/shaper CACHE INTERNAL "" FORCE)
96 SET(SHAPER_INSTALL_SWIG ${_pydir} CACHE INTERNAL "" FORCE)
97 IF(${HAVE_SALOME})
98     SET(SHAPER_INSTALL_ADDONS bin/salome CACHE INTERNAL "" FORCE)
99     SET(SHAPER_INSTALL_BIN lib/salome CACHE INTERNAL "" FORCE)
100     SET(SHAPER_INSTALL_PLUGIN_FILES lib/salome CACHE INTERNAL "" FORCE)
101     SET(SHAPER_INSTALL_PYTHON_FILES bin/salome CACHE INTERNAL "" FORCE)
102     SET(SHAPER_INSTALL_HEADERS include/salome CACHE INTERNAL "" FORCE)
103     SET(SHAPER_INSTALL_RESOURCES share/salome/resources/shaper CACHE INTERNAL "" FORCE)
104     SET(SHAPER_INSTALL_QM_RESOURCES share/salome/resources/shaper CACHE INTERNAL "" FORCE)
105     SET(SHAPER_INSTALL_XML_RESOURCES share/salome/resources/shaper CACHE INTERNAL "" FORCE)
106     SET(SHAPER_INSTALL_GUI_DOC share/doc/salome/gui/SHAPER CACHE INTERNAL "" FORCE)
107     SET(SHAPER_INSTALL_TUI_DOC share/doc/salome/tui/SHAPER CACHE INTERNAL "" FORCE)
108     # without SALOME there is another kind of documentation, separated one
109
110     SALOME_INSTALL_SCRIPTS("shaper_test.py" ${SHAPER_INSTALL_PYTHON_FILES})
111 ELSE(${HAVE_SALOME})
112     SET(SHAPER_INSTALL_ADDONS addons CACHE INTERNAL "" FORCE)
113     SET(SHAPER_INSTALL_BIN bin CACHE INTERNAL "" FORCE)
114     SET(SHAPER_INSTALL_HEADERS include CACHE INTERNAL "" FORCE)
115     SET(SHAPER_INSTALL_PLUGIN_FILES plugins CACHE INTERNAL "" FORCE)
116     SET(SHAPER_INSTALL_PYTHON_FILES plugins CACHE INTERNAL "" FORCE)
117     SET(SHAPER_INSTALL_RESOURCES resources CACHE INTERNAL "" FORCE)
118     SET(SHAPER_INSTALL_QM_RESOURCES bin CACHE INTERNAL "" FORCE)
119     SET(SHAPER_INSTALL_XML_RESOURCES plugins CACHE INTERNAL "" FORCE)
120     SET(SHAPER_INSTALL_GUI_DOC doc CACHE INTERNAL "" FORCE)
121     SET(SHAPER_INSTALL_TUI_DOC doc CACHE INTERNAL "" FORCE)
122 ENDIF(${HAVE_SALOME})
123
124 # Sketcher: Change radius of circular edges while dragging a point on the edge
125 SET(SKETCHER_CHANGE_RADIUS_WHEN_MOVE TRUE)
126
127 SET(MAKE_TRANSLATION YES)
128
129     ADD_DEFINITIONS( -DMAKE_TRANSLATION )
130 ADD_SUBDIRECTORY (src/Config)
131 ADD_SUBDIRECTORY (src/Locale)
132 ADD_SUBDIRECTORY (src/Events)
133 ADD_SUBDIRECTORY (src/Selector)
134 ADD_SUBDIRECTORY (src/Model)
135 ADD_SUBDIRECTORY (src/XAO)
136 ADD_SUBDIRECTORY (src/GeomAPI)
137 ADD_SUBDIRECTORY (src/ModelAPI)
138 ADD_SUBDIRECTORY (src/ModelGeomAlgo)
139 ADD_SUBDIRECTORY (src/GeomAlgoAPI)
140 ADD_SUBDIRECTORY (src/GeomAlgoImpl)
141 ADD_SUBDIRECTORY (src/GeomData)
142 ADD_SUBDIRECTORY (src/GeomDataAPI)
143 ADD_SUBDIRECTORY (src/PartSetPlugin)
144 ADD_SUBDIRECTORY (src/ConstructionPlugin)
145 ADD_SUBDIRECTORY (src/BuildPlugin)
146 ADD_SUBDIRECTORY (src/PrimitivesPlugin)
147 ADD_SUBDIRECTORY (src/GDMLPlugin)
148 ADD_SUBDIRECTORY (src/FeaturesPlugin)
149 ADD_SUBDIRECTORY (src/CollectionPlugin)
150 ADD_SUBDIRECTORY (src/SamplePanelPlugin)
151 ADD_SUBDIRECTORY (src/SketcherPrs)
152 ADD_SUBDIRECTORY (src/SketchPlugin)
153 ADD_SUBDIRECTORY (src/SketchSolver)
154 ADD_SUBDIRECTORY (src/ModuleBase)
155 ADD_SUBDIRECTORY (src/PartSet)
156
157 ADD_SUBDIRECTORY (src/XGUI)
158 ADD_SUBDIRECTORY (src/ExchangePlugin)
159 ADD_SUBDIRECTORY (src/GeomValidators)
160 ADD_SUBDIRECTORY (src/FiltersPlugin)
161 ADD_SUBDIRECTORY (src/InitializationPlugin)
162 ADD_SUBDIRECTORY (src/ParametersPlugin)
163 ADD_SUBDIRECTORY (src/PythonAddons)
164 ADD_SUBDIRECTORY (src/PythonAPI)
165 # High Level C++/Python API
166 ADD_SUBDIRECTORY (src/ModelHighAPI)
167 ADD_SUBDIRECTORY (src/BuildAPI)
168 ADD_SUBDIRECTORY (src/ConstructionAPI)
169 ADD_SUBDIRECTORY (src/ExchangeAPI)
170 ADD_SUBDIRECTORY (src/FeaturesAPI)
171 ADD_SUBDIRECTORY (src/CollectionAPI)
172 ADD_SUBDIRECTORY (src/ParametersAPI)
173 ADD_SUBDIRECTORY (src/PartSetAPI)
174 ADD_SUBDIRECTORY (src/PrimitivesAPI)
175 ADD_SUBDIRECTORY (src/SketchAPI)
176 ADD_SUBDIRECTORY (src/GDMLAPI)
177 ADD_SUBDIRECTORY (src/ConnectorAPI)
178 ADD_SUBDIRECTORY (src/FiltersAPI)
179 # Tests
180 ADD_SUBDIRECTORY (test.API/SHAPER)
181
182 IF(${HAVE_SALOME})
183     ADD_SUBDIRECTORY (src/SHAPERGUI)
184     ADD_SUBDIRECTORY (src/ConnectorPlugin)
185 ENDIF(${HAVE_SALOME})
186
187 ENABLE_TESTING()
188
189 IF(ADD_MODELS_TESTS)
190   ADD_SUBDIRECTORY (test.models)
191   ADD_CUSTOM_TARGET(run_model_tests COMMAND ${CMAKE_CTEST_COMMAND} -C "${CMAKE_BUILD_TYPE}" -LE "models_tests")
192 ENDIF(ADD_MODELS_TESTS)
193
194 IF(ADD_COMPATIBILITY_TESTS)
195   ADD_SUBDIRECTORY (test.compatibility)
196   ADD_CUSTOM_TARGET(run_compatibility_tests COMMAND ${CMAKE_CTEST_COMMAND} -C "${CMAKE_BUILD_TYPE}" -LE "tests_compatibility")
197 ENDIF(ADD_COMPATIBILITY_TESTS)
198
199 IF(ADD_HDF_TESTS)
200   ADD_SUBDIRECTORY (test.hdfs)
201 ENDIF(ADD_HDF_TESTS)
202
203 IF(SHAPER_BUILD_DOC)
204     INCLUDE(FindSphinx)
205     ADD_SUBDIRECTORY (doc)
206 ENDIF(SHAPER_BUILD_DOC)
207
208
209
210 # Add the uninstall target for eclipse IDE
211 if (CMAKE_GENERATOR MATCHES "NMake Makefiles")
212 configure_file("${CMAKE_SOURCE_DIR}/CMakeCommon/cmake_uninstall.cmake.in"
213                "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
214                IMMEDIATE @ONLY)
215 add_custom_target(uninstall
216                   COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
217 endif (CMAKE_GENERATOR MATCHES "NMake Makefiles")
218
219 # Add special Git hooks
220 if((EXISTS "${CMAKE_SOURCE_DIR}/.git") AND (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git"))
221   if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git")
222     set(GIT_SUBMODULE_PATH ".git")
223   else()
224     file(READ "${CMAKE_CURRENT_SOURCE_DIR}/.git" GIT_SUBMODULE_PATH)
225     string(REGEX REPLACE "gitdir: " "" GIT_SUBMODULE_PATH "${GIT_SUBMODULE_PATH}")
226     string(REGEX REPLACE "\n" "" GIT_SUBMODULE_PATH "${GIT_SUBMODULE_PATH}")
227   endif()
228
229   configure_file("${CMAKE_CURRENT_SOURCE_DIR}/GitHooks/pre-commit.in"
230                  "${CMAKE_CURRENT_SOURCE_DIR}/${GIT_SUBMODULE_PATH}/hooks/pre-commit")
231 endif()