]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
restructuration of prerequisites detection as in SMESH, add GDAL info for reloaded...
authorPaul RASCLE <paul.rascle@openfields.fr>
Tue, 8 Sep 2020 17:12:31 +0000 (19:12 +0200)
committerYOANN AUDOUIN <B61570@dsp0851742.postes.calibre.edf.fr>
Fri, 30 Oct 2020 16:08:09 +0000 (17:08 +0100)
CMakeLists.txt

index d366cbfa3e9fa893b7366d7f693d59108af48c51..8d537f43400c784fbf6cc59602d7db6db5714984 100644 (file)
@@ -3,16 +3,13 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
 PROJECT(SalomeHYDRO C CXX)
 INCLUDE(CMakeDependentOption)
 
-# Ensure a proper linker behavior:
-CMAKE_POLICY(SET CMP0003 NEW)
-
 # Versioning
 # ===========
 # Project name, upper case
 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
 
 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 2)
-SET(${PROJECT_NAME_UC}_MINOR_VERSION 0)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 2)
 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
 SET(${PROJECT_NAME_UC}_VERSION
   ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
@@ -28,7 +25,7 @@ ENDIF(WIN32)
 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
   LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
-  INCLUDE(SalomeMacros)
+  INCLUDE(SalomeMacros NO_POLICY_SCOPE)
 ELSE()
   MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
 ENDIF()
@@ -37,53 +34,19 @@ ENDIF()
 # ==============
 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
 IF( EXISTS ${KERNEL_ROOT_DIR} )
-  LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
-  INCLUDE(SalomeMacros)
   FIND_PACKAGE(SalomeKERNEL REQUIRED)
+  KERNEL_WITH_CORBA() #check whether KERNEL built with CORBA
   ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
   INCLUDE_DIRECTORIES(${KERNEL_INCLUDE_DIRS})
 ELSE( EXISTS ${KERNEL_ROOT_DIR} )
   MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR or turn option SALOME_HYDRO_USE_KERNEL to OFF !")
 ENDIF( EXISTS ${KERNEL_ROOT_DIR} )
 
-# Find SALOME GUI (optional)
-# ==============
-OPTION(SALOME_BUILD_GUI "Build GUI of HYDRO" ON)
-IF(SALOME_BUILD_GUI)
-  SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
-  IF(EXISTS ${GUI_ROOT_DIR})
-    LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
-    FIND_PACKAGE(SalomeGUI)
-  ELSE(EXISTS ${GUI_ROOT_DIR})
-    MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR or turn option SALOME_BUILD_GUI to OFF !")
-  ENDIF(EXISTS ${GUI_ROOT_DIR})
-  SALOME_LOG_OPTIONAL_PACKAGE(SalomeGUI SALOME_BUILD_GUI)
-ENDIF(SALOME_BUILD_GUI)
-
-# Find GEOM
-# ===========
-SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR} CACHE PATH "Path to the Salome GEOM")
-IF(EXISTS ${GEOM_ROOT_DIR})
-  LIST(APPEND CMAKE_MODULE_PATH "${GEOM_ROOT_DIR}/adm_local/cmake_files")
-  FIND_PACKAGE(SalomeGEOM REQUIRED)
-  ADD_DEFINITIONS(${GEOM_DEFINITIONS})
-  INCLUDE_DIRECTORIES(${GEOM_INCLUDE_DIRS})
-  IF(SALOME_BUILD_GUI)
-    IF(NOT SALOME_GEOM_BUILD_GUI)
-      MESSAGE(FATAL_ERROR "We absolutely need a Salome GEOM with GUI, please set SALOME_BUILD_GUI=ON in GEOM module")
-    ENDIF(NOT SALOME_GEOM_BUILD_GUI)
-  ENDIF(SALOME_BUILD_GUI)
-ELSE(EXISTS ${GEOM_ROOT_DIR})
-  MESSAGE(FATAL_ERROR "We absolutely need a Salome GEOM, please define GEOM_ROOT_DIR")
-ENDIF(EXISTS ${GEOM_ROOT_DIR})
-
 # Platform setup
 # ==============
-INCLUDE(SalomeSetupPlatform)   # From SalomeMacros
+INCLUDE(SalomeSetupPlatform)   # From KERNEL
 # Always build libraries as shared objects:
 SET(BUILD_SHARED_LIBS TRUE)
-# Local macros:
-LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm/cmake")
 
 # User options
 # ============
@@ -103,11 +66,8 @@ OPTION(SALOME_BUILD_TESTS "Build HYDRO tests" ON)
 
 # Mandatory products:
 
-#FIND_PACKAGE(SalomePython REQUIRED)
 FIND_PACKAGE(SalomePythonInterp REQUIRED)
 FIND_PACKAGE(SalomePythonLibs REQUIRED)
-FIND_PACKAGE(SalomeCAS     REQUIRED)
-FIND_PACKAGE(SalomeVTK     REQUIRED)
 FIND_PACKAGE(SalomeOmniORB REQUIRED)
 
 # Optional products:
@@ -129,31 +89,67 @@ IF(SALOME_BUILD_DOC)
   SALOME_LOG_OPTIONAL_PACKAGE(Sphinx SALOME_BUILD_DOC)
 ENDIF()
 
+# Find SALOME GUI (optional)
+# ==============
+SET(GDAL_ROOT_DIR $ENV{GDALHOME})          # When looking for Salome GUI, reloading targets from Paraview
+IF(EXISTS ${GDAL_ROOT_DIR})
+  SET(GDAL_LIBRARY ${GDAL_ROOT_DIR}/lib)
+  SET(GDAL_INCLUDE_DIR ${GDAL_ROOT_DIR}/include)
+ENDIF(EXISTS ${GDAL_ROOT_DIR})
+
+OPTION(SALOME_BUILD_GUI "Build GUI of HYDRO" ON)
+IF(SALOME_BUILD_GUI)
+  SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
+  IF(EXISTS ${GUI_ROOT_DIR})
+    FIND_PACKAGE(SalomeGUI)
+    SALOME_GUI_WITH_CORBA() #check whether GUI built with CORBA
+    SALOME_GUI_MODE(SALOME_USE_VTKVIEWER SALOME_USE_SALOMEOBJECT 
+                    OPTIONAL SALOME_USE_PLOT2DVIEWER SALOME_USE_PYCONSOLE)
+    ##
+    ## Prerequisites From GUI:
+    ##
+    # Qt
+    FIND_PACKAGE(SalomeQt5 REQUIRED)
+    # SIP
+    FIND_PACKAGE(SalomeSIP REQUIRED)  # should come after Python and before PyQt5
+    # PyQt
+    FIND_PACKAGE(SalomePyQt5 REQUIRED)
+    # Qwt
+    FIND_PACKAGE(SalomeQwt REQUIRED)
+  ELSE(EXISTS ${GUI_ROOT_DIR})
+    MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR or turn option SALOME_BUILD_GUI to OFF !")
+  ENDIF(EXISTS ${GUI_ROOT_DIR})
+  SALOME_LOG_OPTIONAL_PACKAGE(SalomeGUI SALOME_BUILD_GUI)
+ENDIF(SALOME_BUILD_GUI)
+
+# Find GEOM
+# ===========
+SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR} CACHE PATH "Path to the Salome GEOM")
+IF(EXISTS ${GEOM_ROOT_DIR})
+  FIND_PACKAGE(SalomeGEOM REQUIRED)
+  ADD_DEFINITIONS(${GEOM_DEFINITIONS})
+  INCLUDE_DIRECTORIES(${GEOM_INCLUDE_DIRS})
+  IF(SALOME_BUILD_GUI)
+    IF(NOT SALOME_GEOM_BUILD_GUI)
+      MESSAGE(FATAL_ERROR "We absolutely need a Salome GEOM with GUI, please set SALOME_BUILD_GUI=ON in GEOM module")
+    ENDIF(NOT SALOME_GEOM_BUILD_GUI)
+  ENDIF(SALOME_BUILD_GUI)
+ELSE(EXISTS ${GEOM_ROOT_DIR})
+  MESSAGE(FATAL_ERROR "We absolutely need a Salome GEOM, please define GEOM_ROOT_DIR")
+ENDIF(EXISTS ${GEOM_ROOT_DIR})
+
+
 ##
 ## From GUI:
 ##
 
+FIND_PACKAGE(SalomeOpenCASCADE REQUIRED) 
+FIND_PACKAGE(SalomeVTK     REQUIRED)
 FIND_PACKAGE(SalomeSIP REQUIRED)  # should come after Python and before PyQt4
 
-# Qt
-#IF(NOT SALOME_GUI_BUILD_WITH_QT5)
-#  FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL QtNetwork QtTest)
-#  SET(QT_ROOT_DIR "${QT4_ROOT_DIR}")
-#  SALOME_CONFIGURE_PREPARE(HYDROData HYDROGUI HYDROPy Qt4 PyQt4)
-#ELSE()
-  FIND_PACKAGE(SalomeQt5 REQUIRED)
-  SET(QT_ROOT_DIR "${QT5_ROOT_DIR}")
-  SALOME_CONFIGURE_PREPARE(HYDROData HYDROGUI HYDROPy Qt5 PyQt5)
-#ENDIF()
-
-# PyQt
-#IF(NOT SALOME_GUI_BUILD_WITH_QT5)
-#  FIND_PACKAGE(SalomePyQt4 REQUIRED)
-#  SET(PYQT_ROOT_DIR "${PYQT4_ROOT_DIR}")
-#ELSE()
-  FIND_PACKAGE(SalomePyQt5 REQUIRED)
-  SET(PYQT_ROOT_DIR "${PYQT5_ROOT_DIR}")
-#ENDIF()
+SET(QT_ROOT_DIR "${QT5_ROOT_DIR}")
+SET(PYQT_ROOT_DIR "${PYQT5_ROOT_DIR}")
+SALOME_CONFIGURE_PREPARE(HYDROData HYDROGUI HYDROPy Qt5 PyQt5)
 
 # Detection summary:
 SALOME_PACKAGE_REPORT_AND_CHECK()