1 # Copyright (C) 2014-2020 CEA/DEN, EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.10)
23 # Ensure a proper linker behavior:
24 CMAKE_POLICY(SET CMP0003 NEW)
26 CMAKE_POLICY(SET CMP0020 OLD) # disable automatic linking to qtmain.lib
29 SET (SHAPER_Version 9.5.0)
31 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeCommon" ${CMAKE_MODULE_PATH})
33 IF (NOT CADBUILDER_BUILD_DOC)
34 OPTION(SHAPER_BUILD_DOC "Generate SHAPER documentation" ON)
35 ENDIF(NOT CADBUILDER_BUILD_DOC)
41 INCLUDE(FindSalomeQt5)
44 INCLUDE(FindTInspector)
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")
52 MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
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
65 FIND_PACKAGE(SalomePythonInterp REQUIRED)
66 FIND_PACKAGE(SalomePythonLibs REQUIRED)
68 FIND_PACKAGE(SalomeOpenCASCADE REQUIRED)
72 INCLUDE(FindSalomeOpenCASCADE)
80 IF(DEFINED ENV{LIBXML2_ROOT_DIR})
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)
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)
91 # It could be called only once
92 FIND_PACKAGE(LibXml2 REQUIRED)
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)
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
110 SALOME_INSTALL_SCRIPTS("shaper_test.py" ${SHAPER_INSTALL_PYTHON_FILES})
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})
124 # Sketcher: Change radius of circular edges while dragging a point on the edge
125 SET(SKETCHER_CHANGE_RADIUS_WHEN_MOVE TRUE)
127 SET(MAKE_TRANSLATION YES)
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)
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)
180 ADD_SUBDIRECTORY (test.API/SHAPER)
183 ADD_SUBDIRECTORY (src/SHAPERGUI)
184 ADD_SUBDIRECTORY (src/ConnectorPlugin)
185 ENDIF(${HAVE_SALOME})
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)
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)
200 ADD_SUBDIRECTORY (test.hdfs)
205 ADD_SUBDIRECTORY (doc)
206 ENDIF(SHAPER_BUILD_DOC)
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"
215 add_custom_target(uninstall
216 COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
217 endif (CMAKE_GENERATOR MATCHES "NMake Makefiles")
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")
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}")
229 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/GitHooks/pre-commit.in"
230 "${CMAKE_CURRENT_SOURCE_DIR}/${GIT_SUBMODULE_PATH}/hooks/pre-commit")