From 3b5de7680f20a0cce98d491ccb5c27284d1fcd0c Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Fri, 4 Aug 2023 10:26:14 +0200 Subject: [PATCH] Include `H5Version.hpp` in the sources. --- .github/workflows/version_file.yml | 36 ++++++++++++++++++++++++++++++ CMake/HighFiveTargetExport.cmake | 1 - CMakeLists.txt | 7 +----- include/highfive/H5Version.hpp | 33 +++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/version_file.yml create mode 100644 include/highfive/H5Version.hpp diff --git a/.github/workflows/version_file.yml b/.github/workflows/version_file.yml new file mode 100644 index 000000000..816137e95 --- /dev/null +++ b/.github/workflows/version_file.yml @@ -0,0 +1,36 @@ +name: HighFive Check Version File + +on: + push: + branches: + - ci_test + - release/** + pull_request: + branches: + - master + - release/** + +jobs: + CheckVersion: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: "Install libraries" + run: | + sudo apt-get -qq update + sudo apt-get -qq install libhdf5-dev ninja-build + + - name: Build + run: | + # Will trigger `configure_file` for H5Version.hpp. + cmake -DHIGHFIVE_USE_BOOST=Off -B build . + + - name: Test + run: | + # Check that the file hasn't changed, i.e. was updated + # after changing the version number. + ! git status | grep include/highfive/H5Version.hpp diff --git a/CMake/HighFiveTargetExport.cmake b/CMake/HighFiveTargetExport.cmake index 011f7f483..9906f3951 100644 --- a/CMake/HighFiveTargetExport.cmake +++ b/CMake/HighFiveTargetExport.cmake @@ -4,7 +4,6 @@ add_library(libheaders INTERFACE) target_include_directories(libheaders INTERFACE "$" - "$" "$") # Combined HighFive diff --git a/CMakeLists.txt b/CMakeLists.txt index a9deba113..463cc48be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ endif() project(HighFive VERSION 2.7.1) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/highfive/H5Version.hpp.in - ${CMAKE_CURRENT_BINARY_DIR}/include/highfive/H5Version.hpp) + ${CMAKE_CURRENT_SOURCE_DIR}/include/highfive/H5Version.hpp) # INCLUDES list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake @@ -103,11 +103,6 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION "include" PATTERN "*.in" EXCLUDE) -# Installation of configured headers -install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ - DESTINATION "include") - - # Preparing local building (tests, examples) # ------------------------------------------ diff --git a/include/highfive/H5Version.hpp b/include/highfive/H5Version.hpp new file mode 100644 index 000000000..49b0e8016 --- /dev/null +++ b/include/highfive/H5Version.hpp @@ -0,0 +1,33 @@ +/* + * Copyright (c), 2020 + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#pragma once + +#define HIGHFIVE_VERSION_MAJOR 2 +#define HIGHFIVE_VERSION_MINOR 7 +#define HIGHFIVE_VERSION_PATCH 1 + +/** \brief Concatenated representation of the HighFive version. + * + * \warning The macro `HIGHFIVE_VERSION` by itself isn't valid C/C++. + * + * However, it can be stringified with two layers of macros, e.g., + * \code{.cpp} + * #define STRINGIFY_VALUE(s) STRINGIFY_NAME(s) + * #define STRINGIFY_NAME(s) #s + * + * std::cout << STRINGIFY_VALUE(HIGHFIVE_VERSION) << "\n"; + * \endcode + */ +#define HIGHFIVE_VERSION 2.7.1 + +/** \brief String representation of the HighFive version. + * + * \warning This macro only exists from 2.7.1 onwards. + */ +#define HIGHFIVE_VERSION_STRING "2.7.1"