1 # Copyright (C) 2014-2016 OPEN CASCADE
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.8 FATAL_ERROR)
21 PROJECT(SalomeCANRECPLUGIN C CXX)
23 # Ensure a proper linker behavior:
24 CMAKE_POLICY(SET CMP0003 NEW)
28 # Project name, upper case
29 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
31 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 8)
32 SET(${PROJECT_NAME_UC}_MINOR_VERSION 4)
33 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
34 SET(${PROJECT_NAME_UC}_VERSION
35 ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
36 SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
40 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
41 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
42 LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
45 MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
50 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the SALOME KERNEL")
51 IF(EXISTS ${KERNEL_ROOT_DIR})
52 LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
54 FIND_PACKAGE(SalomeKERNEL REQUIRED)
55 KERNEL_WITH_CORBA() #check whether KERNEL is built with CORBA
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})
64 INCLUDE(SalomeSetupPlatform) # From KERNEL
65 # Always build libraries as shared objects:
66 SET(BUILD_SHARED_LIBS TRUE)
68 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
72 SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR} CACHE PATH "Path to the SALOME Geometry")
73 IF(EXISTS ${GEOM_ROOT_DIR})
74 LIST(APPEND CMAKE_MODULE_PATH "${GEOM_ROOT_DIR}/adm_local/cmake_files")
75 FIND_PACKAGE(SalomeGEOM REQUIRED)
76 ADD_DEFINITIONS(${GEOM_DEFINITIONS})
77 INCLUDE_DIRECTORIES(${GEOM_INCLUDE_DIRS})
78 ELSE(EXISTS ${GEOM_ROOT_DIR})
79 MESSAGE(FATAL_ERROR "We absolutely need a SALOME Geometry, please define GEOM_ROOT_DIR")
80 ENDIF(EXISTS ${GEOM_ROOT_DIR})
84 OPTION(SALOME_BUILD_GUI "Enable GUI" ${SALOME_GEOM_BUILD_GUI})
85 OPTION(SALOME_BUILD_DOC "Generate SALOME CANRECPLUGIN documentation" ON)
86 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
87 OPTION(CANREC_LICENSE "OCCT Canonical recognition license key" "")
92 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the SALOME GUI")
93 IF(EXISTS ${GUI_ROOT_DIR})
94 LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
95 FIND_PACKAGE(SalomeGUI)
96 SALOME_GUI_WITH_CORBA() #check whether GUI builded with CORBA
97 ELSE(EXISTS ${GUI_ROOT_DIR})
98 MESSAGE(FATAL_ERROR "We absolutely need a SALOME GUI, please define GUI_ROOT_DIR")
99 ENDIF(EXISTS ${GUI_ROOT_DIR})
100 IF(NOT SALOME_GEOM_BUILD_GUI)
101 MESSAGE(FATAL_ERROR "SALOME Geometry module is built without GUI")
102 ENDIF(NOT SALOME_GEOM_BUILD_GUI)
103 SALOME_LOG_OPTIONAL_PACKAGE(SalomeGUI SALOME_BUILD_GUI)
104 ENDIF(SALOME_BUILD_GUI)
106 IF(SALOME_BUILD_TESTS)
111 ADD_DEFINITIONS(-DCANREC_HASLICENSE)
113 MESSAGE(WARNING "OCCT Canonical recognition license key is not specified! Runtime license will be required!")
118 FIND_PACKAGE(SalomePythonInterp REQUIRED)
119 FIND_PACKAGE(SalomePythonLibs REQUIRED)
120 FIND_PACKAGE(SalomeCAS REQUIRED)
121 FIND_PACKAGE(SalomeCR REQUIRED)
122 FIND_PACKAGE(SalomeOmniORB REQUIRED)
123 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
125 IF(NOT SALOME_GUI_BUILD_WITH_QT5)
126 FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui)
128 FIND_PACKAGE(SalomeQt5 REQUIRED)
130 ENDIF(SALOME_BUILD_GUI)
132 FIND_PACKAGE(SalomeDoxygen)
133 SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
137 SALOME_PACKAGE_REPORT_AND_CHECK()
141 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
142 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
143 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
144 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
145 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
146 "Install path: SALOME scripts")
147 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
148 "Install path: SALOME script data")
149 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
150 "Install path: SALOME Python scripts")
151 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
152 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
153 "Install path: SALOME Python shared modules")
154 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
155 "Install path: local SALOME CMake files")
156 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
157 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
159 # Specific to CANRECPLUGIN:
160 SET(SALOME_CANRECPLUGIN_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/canrecplugin" CACHE PATH
161 "Install path: SALOME CANRECPLUGIN specific data")
163 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
164 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
165 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
166 MARK_AS_ADVANCED(SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES SALOME_INSTALL_DOC)
167 MARK_AS_ADVANCED(SALOME_CANRECPLUGIN_INSTALL_RES_DATA)
169 # Accumulate environment variables for CANRECPLUGIN module
170 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON})
171 SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
175 ADD_SUBDIRECTORY(idl)
176 ADD_SUBDIRECTORY(adm_local)
177 ADD_SUBDIRECTORY(resources)
178 ADD_SUBDIRECTORY(src)
180 ADD_SUBDIRECTORY(doc)
181 ENDIF(SALOME_BUILD_DOC)
183 # Header configuration
184 # ====================
185 SALOME_XVERSION(${PROJECT_NAME})
186 SALOME_CONFIGURE_FILE(CANRECPlugin_version.h.in CANRECPlugin_version.h INSTALL ${SALOME_INSTALL_HEADERS})
188 # Configuration export
189 # (here only the level 1 prerequisites are exposed)
190 # ====================
191 INCLUDE(CMakePackageConfigHelpers)
193 # List of targets in this project we want to make visible to the rest of the world.
194 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
195 SET(_${PROJECT_NAME}_exposed_targets
196 SalomeIDLCANRECPlugin CANRECPluginEngine
200 LIST(APPEND _${PROJECT_NAME}_exposed_targets
203 ENDIF(SALOME_BUILD_GUI)
205 # Add all targets to the build-tree export set
206 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
207 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
209 # Ensure the variables are always defined for the configure:
210 SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}")
211 SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}")
212 SET(GEOM_ROOT_DIR "${GEOM_ROOT_DIR}")
213 SET(CR_ROOT_DIR "${CR_ROOT_DIR}")
214 SET(OCCLICENSE_ROOT_DIR "${OCCLICENSE_ROOT_DIR}")
216 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
218 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
219 SALOME_CONFIGURE_PREPARE(CR)
221 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
222 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
223 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
224 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
225 KERNEL_ROOT_DIR GUI_ROOT_DIR GEOM_ROOT_DIR CR_ROOT_DIR OCCLICENSE_ROOT_DIR)
227 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
228 VERSION ${${PROJECT_NAME_UC}_VERSION}
229 COMPATIBILITY AnyNewerVersion)
231 # Install the CMake configuration files:
233 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
234 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
235 DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
237 # Install the export set for use with the install-tree
238 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
239 FILE ${PROJECT_NAME}Targets.cmake)
241 # Install README file
242 INSTALL(FILES README DESTINATION ${SALOME_CANRECPLUGIN_INSTALL_RES_DATA})