From 3fc7ca9294172dcdc74396369b2301dba881c010 Mon Sep 17 00:00:00 2001 From: Ben Nibbelink Date: Thu, 21 Mar 2024 14:32:55 -0500 Subject: [PATCH 1/4] propagate version number from CMakeLists.txt --- CMakeLists.txt | 8 ++++---- install.py | 5 ----- src/CMakeLists.txt | 1 - src/cycamore_version.h.in | 8 ++++---- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 155f41b9a8..a28150e99f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) ENDIF() # This project name is cycamore. -PROJECT(CYCAMORE) +PROJECT(CYCAMORE VERSION 1.5.5) # check for and enable c++11 support (required for cyclus) INCLUDE(CheckCXXCompilerFlag) @@ -344,9 +344,9 @@ IF(NOT CYCLUS_DOC_ONLY) SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.rst") # Version - SET(CPACK_PACKAGE_VERSION_MAJOR "1") - SET(CPACK_PACKAGE_VERSION_MINOR "4") - SET(CPACK_PACKAGE_VERSION_PATCH "0") + SET(CPACK_PACKAGE_VERSION_MAJOR "${CMAKE_PROJECT_VERSION_MAJOR}") + SET(CPACK_PACKAGE_VERSION_MINOR "${CMAKE_PROJECT_VERSION_MINOR}") + SET(CPACK_PACKAGE_VERSION_PATCH "${CMAKE_PROJECT_VERSION_PATCH}") # Dependencies SET(CPACK_DEBIAN_PACKAGE_DEPENDS "cyclus (>= 1.4.0)") diff --git a/install.py b/install.py index 3c86465ff7..f476c575ff 100755 --- a/install.py +++ b/install.py @@ -84,8 +84,6 @@ def install_cyclus(args): ] if args.build_type: cmake_cmd += ['-DCMAKE_BUILD_TYPE=' + args.build_type] - if args.core_version: - cmake_cmd += ['-DCORE_VERSION=' + args.core_version] if args.D is not None: cmake_cmd += ['-D' + x for x in args.D] if args.cmake_debug: @@ -188,9 +186,6 @@ def main(): build_type = "the CMAKE_BUILD_TYPE" parser.add_argument('--build-type', '--build_type', help=build_type) - parser.add_argument('--core-version', dest='core_version', default=None, - help='Sets the core version number.') - parser.add_argument('-D', metavar='VAR', action='append', help='Set enviornment variable(s).') parser.add_argument('--cmake-debug', action='store_true', default=False, diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b626877cf5..509175b344 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,5 @@ # ------------------- Add all Concrete Agents ---------------------------- -EXECUTE_PROCESS(COMMAND git describe --tags OUTPUT_VARIABLE cycamore_version OUTPUT_STRIP_TRAILING_WHITESPACE) CONFIGURE_FILE(cycamore_version.h.in "${CMAKE_CURRENT_SOURCE_DIR}/cycamore_version.h" @ONLY) SET(CYCLUS_CUSTOM_HEADERS "cycamore_version.h") diff --git a/src/cycamore_version.h.in b/src/cycamore_version.h.in index b3dc3de861..13ffd5b1a3 100644 --- a/src/cycamore_version.h.in +++ b/src/cycamore_version.h.in @@ -1,9 +1,9 @@ #ifndef CYCAMORE_SRC_VERSION_H_ #define CYCAMORE_SRC_VERSION_H_ -#define CYCAMORE_VERSION_MAJOR 1 -#define CYCAMORE_VERSION_MINOR 5 -#define CYCAMORE_VERSION_MICRO 5 -#define CYCAMORE_VERSION "@cycamore_version@" +#define CYCAMORE_VERSION_MAJOR @CMAKE_PROJECT_VERSION_MAJOR@ +#define CYCAMORE_VERSION_MINOR @CMAKE_PROJECT_VERSION_MINOR@ +#define CYCAMORE_VERSION_MICRO @CMAKE_PROJECT_VERSION_PATCH@ +#define CYCAMORE_VERSION "@CMAKE_PROJECT_VERSION@" #endif // CYCAMORE_SRC_VERSION_H_ From ec74c01b6ab2d97921842aa1174aa282dd372084 Mon Sep 17 00:00:00 2001 From: Ben Nibbelink Date: Thu, 21 Mar 2024 14:36:30 -0500 Subject: [PATCH 2/4] update changelog --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 663c69d09f..baf3cc3eaa 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -17,6 +17,7 @@ cycamore Change Log * Updated build procedure to use newer versions of packages in 2023 (#549) * Added active/dormant and request size variation from buy policy to Storage (#546, #568, #586, #587) * Update build procedure to force a rebuild when a test file is changed (#584) +* Define the version number in `CMakeLists.txt` and rely on CMake to propagate the version throughout the code (#589) v1.5.5 ==================== From 9669568aba44c61af160eec2d66436abb71e8a23 Mon Sep 17 00:00:00 2001 From: Ben Nibbelink Date: Thu, 21 Mar 2024 14:37:44 -0500 Subject: [PATCH 3/4] remove --core-version arg from dockerfile --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index fb08841ade..68f3badf24 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -8,7 +8,7 @@ ARG make_cores=2 COPY . /cycamore WORKDIR /cycamore -RUN python install.py -j ${make_cores} --build-type=Release --core-version 999999.999999 +RUN python install.py -j ${make_cores} --build-type=Release FROM cycamore as cycamore-test RUN cycamore_unit_tests From 580504c58d0515ad8bdd8efb9272a6fd43b32d0d Mon Sep 17 00:00:00 2001 From: Ben Nibbelink Date: Thu, 21 Mar 2024 15:08:25 -0500 Subject: [PATCH 4/4] update minimum cmake version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a28150e99f..b67d493ae8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +CMAKE_MINIMUM_REQUIRED(VERSION 3.16) #taken from http://geant4.cern.ch/support/source/geant4/CMakeLists.txt IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) message(STATUS "Cycamore requires an out-of-source build.")