Salome HOME
0022523: [CEA 1096] Add a colomn "biquadratic" in "Mesh Information"
[modules/smesh.git] / CMakeLists.txt
index 43a11d3..441f79c 100755 (executable)
@@ -1,9 +1,9 @@
-# Copyright (C) 2012-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
-PROJECT(SalomeSMESH C CXX Fortran)
+PROJECT(SalomeSMESH C CXX)
 
 # Ensure a proper linker behavior:
 CMAKE_POLICY(SET CMP0003 NEW)
@@ -28,7 +28,7 @@ CMAKE_POLICY(SET CMP0003 NEW)
 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
 
 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7)
-SET(${PROJECT_NAME_UC}_MINOR_VERSION 2)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 3)
 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})
@@ -41,32 +41,35 @@ 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 builded with CORBA
 ELSE(EXISTS ${KERNEL_ROOT_DIR})
   MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
 
-IF(SALOME_LIGHT_ONLY)
-  MESSAGE(FATAL_ERROR "SMESH module can't be built in Light mode (without CORBA)")
-ENDIF()
-
 # Platform setup
 # ==============
 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_local/cmake_files")
+LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files") 
 
 # User options
-# (some options have already been defined in KERNEL) 
 # ============
-#OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ${SALOME_BUILD_TESTS}) For use in the future
-OPTION(SALOME_BUILD_DOC "Generate SALOME SMESH documentation" ${SALOME_BUILD_DOC})
+OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
+OPTION(SALOME_BUILD_DOC "Generate SALOME SMESH documentation" ON)
   
 # Advanced options:
-OPTION(SALOME_BUILD_GUI       "Enable GUI" ON)
-OPTION(SALOME_SMESH_USE_CGNS  "Enable shape recognition from picture" OFF)
-OPTION(SALOME_SMESH_USE_TBB   "Enable shape recognition from picture" OFF)
+OPTION(SALOME_BUILD_GUI            "Enable GUI" ON)
+OPTION(SALOME_SMESH_USE_CGNS       "Enable import/export to CGNS format" OFF)
+OPTION(SALOME_SMESH_USE_TBB        "Enable parallel computation" OFF)
+
+#On Linux use Fortran to compile MEFISTO2D
+IF(NOT WIN32)
+  ENABLE_LANGUAGE(Fortran)
+  SET(SALOME_SMESH_ENABLE_MEFISTO ON)
+  ADD_DEFINITIONS(-DENABLE_MEFISTO)
+ENDIF(NOT WIN32)
 
 MARK_AS_ADVANCED(SALOME_BUILD_GUI SALOME_SMESH_USE_CGNS SALOME_SMESH_USE_TBB)
 
@@ -101,7 +104,11 @@ FIND_PACKAGE(SalomeHDF5 REQUIRED COMPONENTS C)
 IF(SALOME_USE_MPI)
   FIND_PACKAGE(SalomeMPI) # needed for doc generation by Sphinx
 ENDIF()
-
+IF(SALOME_BUILD_TESTS)
+  ENABLE_TESTING()
+  FIND_PACKAGE(SalomeCppUnit)
+  SALOME_LOG_OPTIONAL_PACKAGE(CppUnit SALOME_BUILD_TESTS)
+ENDIF()
 IF(SALOME_BUILD_DOC)
   FIND_PACKAGE(SalomeDoxygen)
   FIND_PACKAGE(SalomeSphinx)
@@ -115,7 +122,7 @@ IF(SALOME_BUILD_GUI)
   IF(EXISTS ${GUI_ROOT_DIR})
     LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
     FIND_PACKAGE(SalomeGUI)
-
+    FULL_GUI(TRUE) #check whether GUI builded in full mode and with CORBA
     ##
     ## Prerequisites From GUI:
     ##
@@ -126,7 +133,7 @@ IF(SALOME_BUILD_GUI)
     # PyQt4
     FIND_PACKAGE(SalomePyQt4 REQUIRED)
     # Qwt
-    FIND_PACKAGE(SalomeQwt)
+    FIND_PACKAGE(SalomeQwt REQUIRED)
   ELSE(EXISTS ${GUI_ROOT_DIR})
     MESSAGE(FATAL_ERROR "GUI_ROOT_DIR is not well defined, SMESH will be built without GUI!!!")
   ENDIF(EXISTS ${GUI_ROOT_DIR})
@@ -139,6 +146,13 @@ 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})
@@ -155,15 +169,36 @@ FIND_PACKAGE(SalomeCAS REQUIRED)
 IF(SALOME_SMESH_USE_CGNS)
   FIND_PACKAGE(SalomeCGNS)
   SALOME_LOG_OPTIONAL_PACKAGE(CGNS SALOME_SMESH_USE_CGNS)
+  ADD_DEFINITIONS(-DWITH_CGNS)
 ENDIF(SALOME_SMESH_USE_CGNS)
 
 IF(SALOME_SMESH_USE_TBB)
   FIND_PACKAGE(SalomeTBB)
   SALOME_LOG_OPTIONAL_PACKAGE(TBB SALOME_SMESH_USE_TBB)
+  ADD_DEFINITIONS(-DWITH_TBB)
 ENDIF(SALOME_SMESH_USE_TBB)
 
 FIND_PACKAGE(SalomeMEDFile REQUIRED)
 
+#On Windows use f2c to generate C MEFISTO2D code
+IF(WIN32)
+  SET(SALOME_SMESH_ENABLE_MEFISTO OFF)
+  FIND_PACKAGE(Salomef2c QUIET)
+  IF(${F2C_FOUND})
+    ADD_DEFINITIONS(-DENABLE_MEFISTO)
+    SET(SALOME_SMESH_ENABLE_MEFISTO ON)
+    MESSAGE(STATUS "Build MEFISTO2D mesher using Fortran to C generator")
+  ELSE(${F2C_FOUND})
+    MESSAGE(STATUS "Fortran to C generator is not found: MEFISTO2D mesher will be unavailable.")
+  ENDIF(${F2C_FOUND})  
+ENDIF(WIN32)
+
+IF(SALOME_SMESH_ENABLE_MEFISTO)
+ SET(MEFISTO2D_NAME "MEFISTO_2D")
+ELSE(SALOME_SMESH_ENABLE_MEFISTO)
+ SET(MEFISTO2D_NAME "NOT_FOUND")
+ENDIF(SALOME_SMESH_ENABLE_MEFISTO)
+
 # Detection summary:
 SALOME_PACKAGE_REPORT_AND_CHECK()
 
@@ -207,6 +242,12 @@ MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
 MARK_AS_ADVANCED(SALOME_SMESH_INSTALL_RES_DATA SALOME_SMESH_INSTALL_PLUGINS)
 
+# Accumulate environment variables for SMESH module
+SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
+                                                 ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON}
+                                                 ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON_SHARED})
+SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS}) 
+
 # Sources 
 # ========
 
@@ -234,13 +275,18 @@ INCLUDE(CMakePackageConfigHelpers)
 SET(_${PROJECT_NAME}_exposed_targets 
   SMESHControls MeshDriver MeshDriverDAT MeshDriverGMF MeshDriverMED
   MeshDriverSTL MeshDriverUNV MEDWrapperBase MEDWrapper MEDWrapper_V2_2
-  MEFISTO2D SMDS SMESHimpl SMESHEngine SMESHClient SMESHDS
+  SMDS SMESHimpl SMESHEngine SMESHClient SMESHDS
   SMESHUtils StdMeshers StdMeshersEngine MeshJobManagerEngine
   SPADDERPluginTesterEngine SalomeIDLSMESH SalomeIDLSPADDER
 )
 
+IF(SALOME_SMESH_ENABLE_MEFISTO)
+  LIST(APPEND _${PROJECT_NAME}_exposed_targets
+       MEFISTO2D) 
+ENDIF(SALOME_SMESH_ENABLE_MEFISTO)
+
 IF(SALOME_BUILD_GUI)
-  LIST(APPEND _${PROJECT_NAME}_exposed_targets.
+  LIST(APPEND _${PROJECT_NAME}_exposed_targets
       SMESHObject SMESHFiltersSelection SMESH GeomSelectionTools StdMeshersGUI
   )
 ENDIF(SALOME_BUILD_GUI)
@@ -260,15 +306,20 @@ EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
 
 # Ensure the variables are always defined for the configure:
 SET(GEOM_ROOT_DIR "${GEOM_ROOT_DIR}")
+SET(MEDFILE_ROOT_DIR "${MEDFILE_ROOT_DIR}")
 SET(CGNS_ROOT_DIR "${CGNS_ROOT_DIR}")
 SET(TBB_ROOT_DIR  "${TBB_ROOT_DIR}")
  
 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
+
+# Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
+SALOME_CONFIGURE_PREPARE(CGNS TBB MEDFile)
+
 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
     ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
     INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
     PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
-    GEOM_ROOT_DIR CGNS_ROOT_DIR TBB_ROOT_DIR)
+    GEOM_ROOT_DIR MEDFILE_ROOT_DIR CGNS_ROOT_DIR TBB_ROOT_DIR)
 
 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
     VERSION ${${PROJECT_NAME_UC}_VERSION}