]> SALOME platform Git repositories - modules/jobmanager.git/blob - CMakeLists.txt
Salome HOME
b88d4d623bec0a968f3297a24189fe892a49d38d
[modules/jobmanager.git] / CMakeLists.txt
1 # Copyright (C) 2012-2016  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 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
20 PROJECT(SalomeJOBMANAGER C CXX)
21
22 # Ensure a proper linker behavior:
23 CMAKE_POLICY(SET CMP0003 NEW)
24 IF(WIN32)
25   CMAKE_POLICY(SET CMP0020 OLD) # disable automatic linking to qtmain.lib 
26 ENDIF(WIN32)
27
28 # Versioning
29 # ===========
30 # Project name, upper case
31 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
32
33 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 8)
34 SET(${PROJECT_NAME_UC}_MINOR_VERSION 0)
35 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
36 SET(${PROJECT_NAME_UC}_VERSION
37   ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
38 SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
39
40 # Find KERNEL
41 # ===========
42 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
43 IF(EXISTS ${KERNEL_ROOT_DIR})
44   LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
45   INCLUDE(SalomeMacros)
46   FIND_PACKAGE(SalomeKERNEL REQUIRED)
47   KERNEL_WITH_CORBA() # check whether KERNEL builded with CORBA
48 ELSE(EXISTS ${KERNEL_ROOT_DIR})
49   MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
50 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
51
52 # Platform setup
53 # ==============
54 INCLUDE(SalomeSetupPlatform)   # From KERNEL
55 # Always build libraries as shared objects:
56 SET(BUILD_SHARED_LIBS TRUE)
57 # Local macros:
58 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
59
60 # User options
61 # ============
62 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
63 OPTION(SALOME_BUILD_DOC "Generate SALOME JOBMANAGER documentation" ON)
64
65 IF(SALOME_BUILD_TESTS)
66   ENABLE_TESTING()
67 ENDIF()
68
69 ##
70 ## From KERNEL:
71 ##
72
73 # Various
74 # Boost
75 FIND_PACKAGE(SalomeBoost REQUIRED)
76 # CORBA
77 FIND_PACKAGE(SalomeOmniORB REQUIRED)
78
79 # Other KERNEL optionals:
80 IF(SALOME_USE_MPI)
81   FIND_PACKAGE(SalomeMPI) # needed for doc generation by Sphinx
82 ENDIF()
83 IF(SALOME_BUILD_DOC)
84   FIND_PACKAGE(SalomeSphinx)
85   SALOME_LOG_OPTIONAL_PACKAGE(Sphinx SALOME_BUILD_DOC)
86 ENDIF()
87
88 # Find GUI
89 # ===========
90 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
91 IF(EXISTS ${GUI_ROOT_DIR})
92   LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
93   FIND_PACKAGE(SalomeGUI REQUIRED)
94   ADD_DEFINITIONS(${GUI_DEFINITIONS})
95   INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
96 ELSE(EXISTS ${GUI_ROOT_DIR})
97   MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
98 ENDIF(EXISTS ${GUI_ROOT_DIR})
99
100 # Qt
101 IF(NOT SALOME_GUI_BUILD_WITH_QT5)
102   FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml)
103 ELSE()
104   FIND_PACKAGE(SalomeQt5 REQUIRED)
105 ENDIF()
106
107 # Detection summary:
108 SALOME_PACKAGE_REPORT_AND_CHECK()
109
110 # Directories
111 # (default values taken from KERNEL)
112 # ===========
113 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
114 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
115 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
116 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
117 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH 
118    "Install path: SALOME scripts")
119 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH 
120    "Install path: SALOME script data")
121 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH 
122    "Install path: SALOME Python scripts")
123 SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH 
124    "Install path: SALOME application skeleton - scripts")
125 SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH 
126    "Install path: SALOME application skeleton - Python")
127 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
128 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH 
129    "Install path: SALOME Python shared modules")
130 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH 
131     "Install path: local SALOME CMake files") 
132 SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
133   "Install path: local SALOME config files (obsolete, to be removed)")
134 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
135 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
136
137 # Specific to JOBMANAGER:
138 SET(SALOME_JOBMANAGER_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/jobmanager" CACHE PATH 
139     "Install path: SALOME JOBMANAGER specific data")
140
141 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
142 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
143 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS  SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
144 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
145 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
146 MARK_AS_ADVANCED(SALOME_JOBMANAGER_INSTALL_RES_DATA)
147
148 # Accumulate environment variables for JOBMANAGER module
149 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS})
150 SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS}) 
151
152 # Sources 
153 # ========
154
155 ADD_SUBDIRECTORY(idl)
156 ADD_SUBDIRECTORY(adm_local)
157 ADD_SUBDIRECTORY(src)
158 IF(SALOME_BUILD_DOC)
159   ADD_SUBDIRECTORY(doc)
160 ENDIF(SALOME_BUILD_DOC)
161
162 # Header configuration
163 # ====================
164 SALOME_XVERSION(${PROJECT_NAME})
165 SALOME_CONFIGURE_FILE(JOBMANAGER_version.h.in JOBMANAGER_version.h INSTALL ${SALOME_INSTALL_HEADERS})
166
167 # Configuration export
168 # (here only the level 1 prerequisites are exposed)
169 # ====================
170 INCLUDE(CMakePackageConfigHelpers)
171
172 # List of targets in this project we want to make visible to the rest of the world.
173 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
174 SET(_${PROJECT_NAME}_exposed_targets 
175   BL_Bases BL_Engine BL_GenericGui JOBMANAGER BL_Wrappers_Qt BL_Wrappers_SALOME JOBMANAGER_IDL
176 )
177
178 # Add all targets to the build-tree export set
179 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
180   FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
181
182 # Create the configuration files:
183 #   - in the build tree:
184
185 # Ensure the variables are always defined for the configure:
186 SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}")
187  
188 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
189
190 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
191 # SALOME_CONFIGURE_PREPARE() #For use in the future
192
193 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
194     ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
195     INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
196     PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
197     GUI_ROOT_DIR)
198
199 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
200     VERSION ${${PROJECT_NAME_UC}_VERSION}
201     COMPATIBILITY AnyNewerVersion)
202
203 # Install the CMake configuration files:
204 INSTALL(FILES
205   "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
206   "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
207   DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
208
209 # Install the export set for use with the install-tree
210 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" 
211   FILE ${PROJECT_NAME}Targets.cmake)