-# Copyright (C) 2015-2016 CEA/DEN, EDF R&D
+# Copyright (C) 2015-2022 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11 FATAL_ERROR)
-#INCLUDE(CMakeDependentOption)
+
+# Project name
+# ============
+# original
PROJECT(MEDCoupling C CXX)
+# upper case
+STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
-# Ensure a proper linker behavior:
-CMAKE_POLICY(SET CMP0003 NEW)
-# Versioning
-# ===========
-# Project name, upper case
-STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
+IF (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.3)
+ cmake_policy(SET CMP0057 NEW)
+ IF (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.13)
+ cmake_policy(SET CMP0078 OLD)
+ ENDIF()
+ IF (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.14)
+ cmake_policy(SET CMP0086 OLD)
+ ENDIF()
+ENDIF()
-SET(${PROJECT_NAME_UC}_MAJOR_VERSION 9)
-SET(${PROJECT_NAME_UC}_MINOR_VERSION 1)
-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})
# Common CMake macros
SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake 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()
+# Versioning
+# ===========
+SALOME_SETUP_VERSION(9.10.0)
+MESSAGE(STATUS "Building ${PROJECT_NAME_UC} ${${PROJECT_NAME_UC}_VERSION} from \"${${PROJECT_NAME_UC}_GIT_SHA1}\"")
+
# Platform setup
# ==============
INCLUDE(SalomeSetupPlatform)
+# [ABN]: use the below for aggressive code quality check:
+#if( EXISTS "aaaa")
+# add_definitions(-Weverything)
+# add_definitions(-Wno-inconsistent-missing-override)
+# add_definitions(-Wno-c++98-compat -Wno-c++98-compat-pedantic)
+# add_definitions(-Wno-sign-conversion)
+# add_definitions(-Wno-switch-enum)
+#
+# add_definitions(-Wno-documentation-unknown-command) # \image in Doxygen
+# add_definitions(-Wno-gnu-statement-expression) # assert(...)
+#
+# add_definitions(-Wno-reserved-id-macro -Wno-padded -Wno-weak-vtables -Wdouble-promotion -Wno-comma -Wno-unused-parameter)
+# add_definitions(-Wno-unreachable-code-break -Wno-old-style-cast -Wno-deprecated -Wno-double-promotion)
+# add_definitions(-Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-prototypes)
+# add_definitions(-Wno-covered-switch-default -Wno-weak-template-vtables -Wno-undefined-func-template -Wno-used-but-marked-unused)
+# add_definitions(-Wno-unreachable-code-return -Wno-missing-noreturn -Wno-unused-member-function -Wno-header-hygiene)
+# add_definitions(-Wno-ignored-qualifiers) # because of MED-file
+# add_definitions(-Wno-unused-function -Wno-unused-macros)
+# add_definitions(-Wno-missing-field-initializers)
+# add_definitions(-Wno-shadow) # SWIG generates a lot of those ...
+#
+# add_definitions(-Wno-float-equal) # OUCH
+#endif()
+
#
# User options
# ============
OPTION(MEDCOUPLING_ENABLE_RENUMBER "Build Renumber." ON)
OPTION(MEDCOUPLING_WITH_FILE_EXAMPLES "Install examples of files containing meshes and fields of different formats." ON)
OPTION(MEDCOUPLING_USE_MPI "(Use MPI containers) - For MED this triggers the build of ParaMEDMEM." OFF)
-OPTION(MEDCOUPLING_BUILD_TESTS "Build MED tests." ON)
-OPTION(MEDCOUPLING_BUILD_DOC "Build MED doc." ON)
+OPTION(MEDCOUPLING_BUILD_TESTS "Build MEDCoupling C++ tests." ON)
+OPTION(MEDCOUPLING_BUILD_PY_TESTS "Build MEDCoupling Python tests." ON)
+OPTION(MEDCOUPLING_BUILD_DOC "Build MEDCoupling doc." ON)
OPTION(MEDCOUPLING_BUILD_STATIC "Build MEDCoupling library in static mode." OFF)
+OPTION(MEDCOUPLING_USE_64BIT_IDS "Size of IDs to refer cells and nodes. 32 bits when OFF (default), 64 bits when ON." ON)
+
IF(${MEDCOUPLING_USE_MPI})
SET(USE_METIS_NOT_PARMETIS OFF)
ELSE()
IF(MEDCOUPLING_USE_MPI)
FIND_PACKAGE(SalomeMPI REQUIRED)
ADD_DEFINITIONS("-DHAVE_MPI")
+ SALOME_ADD_MPI_TO_HDF5()
IF(MEDCOUPLING_PARTITIONER_PARMETIS)
FIND_PACKAGE(SalomeParMetis)
SALOME_LOG_OPTIONAL_PACKAGE(ParMetis MEDCOUPLING_PARTITIONER_PARMETIS)
IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
MESSAGE(STATUS "Using Python 3")
ENDIF()
+ IF ("${SWIG_VERSION}" VERSION_GREATER_EQUAL "4")
+ SET(MEDCOUPLING_SWIG4_COMPAT TRUE CACHE BOOL "SWIG 4 compatibility (experimental)")
+ ELSE()
+ SET(MEDCOUPLING_SWIG4_COMPAT FALSE)
+ ENDIF()
+ IF(MEDCOUPLING_SWIG4_COMPAT)
+ LIST(APPEND CMAKE_SWIG_FLAGS "-DMEDCOUPLING_SWIG4_COMPAT")
+ ENDIF()
ENDIF(MEDCOUPLING_ENABLE_PYTHON)
IF(MEDCOUPLING_BUILD_DOC)
# Header configuration
# ====================
-SALOME_XVERSION(${PROJECT_NAME})
SALOME_CONFIGURE_FILE(MEDCoupling_version.h.in MEDCoupling_version.h INSTALL ${MEDCOUPLING_INSTALL_HEADERS})
# Accumulate environment variables for MED module
ADD_DEFINITIONS("-D_USE_MATH_DEFINES")
ENDIF(WIN32)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
+
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(adm_local)
# List of targets in this project we want to make visible to the rest of the world.
# They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
SET(_${PROJECT_NAME}_exposed_targets
- interpkernel medcouplingcpp medcouplingremapper)
+ interpkernel medcouplingcpp medcouplingremapper medicoco)
IF(NOT MEDCOUPLING_MICROMED)
LIST(APPEND _${PROJECT_NAME}_exposed_targets medloader)