diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 663c69d09..baf3cc3ea 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 ==================== diff --git a/CMakeLists.txt b/CMakeLists.txt index 155f41b9a..b67d493ae 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.") @@ -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/docker/Dockerfile b/docker/Dockerfile index fb08841ad..68f3badf2 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 diff --git a/install.py b/install.py index 3c86465ff..f476c575f 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 b626877cf..509175b34 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 b3dc3de86..13ffd5b1a 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_