1 ## Copyright (C) 2014-2017 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
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.10)
24 # Ensure a proper linker behavior:
25 CMAKE_POLICY(SET CMP0003 NEW)
27 CMAKE_POLICY(SET CMP0020 OLD) # disable automatic linking to qtmain.lib
30 SET (SHAPER_Version 9.2.0)
32 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeCommon" ${CMAKE_MODULE_PATH})
33 OPTION(SHAPER_BUILD_DOC "Generate SHAPER documentation" ON)
39 INCLUDE(FindSalomeQt5)
42 INCLUDE(FindTInspector)
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")
50 MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
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
63 FIND_PACKAGE(SalomePythonInterp REQUIRED)
64 FIND_PACKAGE(SalomePythonLibs REQUIRED)
66 FIND_PACKAGE(SalomeOpenCASCADE REQUIRED)
70 INCLUDE(FindSalomeOpenCASCADE)
78 IF(DEFINED ENV{LIBXML2_ROOT_DIR})
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)
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)
87 # It could be called only once
88 FIND_PACKAGE(LibXml2 REQUIRED)
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)
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
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})
116 # Sketcher: Change radius of circular edges while dragging a point on the edge
117 SET(SKETCHER_CHANGE_RADIUS_WHEN_MOVE TRUE)
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)
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)
166 ADD_SUBDIRECTORY (test.API/SHAPER)
169 ADD_SUBDIRECTORY (src/SHAPERGUI)
170 ADD_SUBDIRECTORY (src/ConnectorPlugin)
171 ENDIF(${HAVE_SALOME})
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)
183 ADD_SUBDIRECTORY (doc)
184 ENDIF(SHAPER_BUILD_DOC)
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"
193 add_custom_target(uninstall
194 COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
195 endif (CMAKE_GENERATOR MATCHES "NMake Makefiles")
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")
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}")
207 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/GitHooks/pre-commit.in"
208 "${CMAKE_CURRENT_SOURCE_DIR}/${GIT_SUBMODULE_PATH}/hooks/pre-commit")