From d052c79b938c9e3b23ea26f1a58e9e9a72cc9d57 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 4 Oct 2021 14:08:13 +0300 Subject: [PATCH] bos #26458 Versioning of sources via git commit id (sha1) --- CMakeLists.txt | 24 +++++++++++------------- src/PyWrapping/CMakeLists.txt | 2 +- src/PyWrapping/medcoupling.i | 2 ++ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ea2c09cea..5acc55c7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,8 +18,13 @@ # 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) IF (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.3) @@ -33,17 +38,6 @@ IF (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.3) ENDIF() -# Versioning -# =========== -# Project name, upper case -STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC) - -SET(${PROJECT_NAME_UC}_MAJOR_VERSION 9) -SET(${PROJECT_NAME_UC}_MINOR_VERSION 7) -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}) @@ -53,6 +47,11 @@ ELSE() MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !") ENDIF() +# Versioning +# =========== +SALOME_SETUP_VERSION(9.7.0) +MESSAGE(STATUS "Building ${PROJECT_NAME_UC} ${${PROJECT_NAME_UC}_VERSION} from \"${${PROJECT_NAME_UC}_GIT_SHA1}\"") + # Platform setup # ============== INCLUDE(SalomeSetupPlatform) @@ -262,7 +261,6 @@ MARK_AS_ADVANCED(MEDCOUPLING_INSTALL_PYTHON MEDCOUPLING_INSTALL_PYTHON_SHARED ME # 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 diff --git a/src/PyWrapping/CMakeLists.txt b/src/PyWrapping/CMakeLists.txt index e406b1d08..4ddf50cc2 100644 --- a/src/PyWrapping/CMakeLists.txt +++ b/src/PyWrapping/CMakeLists.txt @@ -21,7 +21,7 @@ FIND_PACKAGE(SWIG REQUIRED) INCLUDE(${SWIG_USE_FILE}) -ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS}) +ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS} -DMEDCOUPLING_GIT_SHA1=\"${MEDCOUPLING_GIT_SHA1}\") SET_SOURCE_FILES_PROPERTIES(medcoupling.i PROPERTIES CPLUSPLUS ON) IF(WIN32) diff --git a/src/PyWrapping/medcoupling.i b/src/PyWrapping/medcoupling.i index 3c7a0e6d1..08f56b79e 100644 --- a/src/PyWrapping/medcoupling.i +++ b/src/PyWrapping/medcoupling.i @@ -48,6 +48,8 @@ %include "ParaMEDMEMCommon.i" #endif +%constant const char __version__[]=MEDCOUPLING_GIT_SHA1; + %{ static const char SEQ_INTERPOL_EXT[]="Sequential interpolator"; static const char MEDFILEIO_EXT[]="MED file I/O"; -- 2.39.2