From 9a6ade37d9ea41ce7aeac50fbcbcf4451adfefb2 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Sun, 24 Sep 2023 14:55:56 +0100 Subject: [PATCH] Cache version numbers, so they can be used in other scripts --- .github/workflows/sdrangel.yml | 9 +++++++-- CMakeLists.txt | 2 +- cmake/cpack/CMakeLists.txt | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sdrangel.yml b/.github/workflows/sdrangel.yml index 7d8aae819..cd9fd9d0f 100644 --- a/.github/workflows/sdrangel.yml +++ b/.github/workflows/sdrangel.yml @@ -43,7 +43,11 @@ jobs: echo github.workspace: ${{ github.workspace }} - name: Get version id: get_version - run: echo "version=$(git describe --tags | cut -c2-)" >> $env:GITHUB_OUTPUT + run: echo "version=$(grep sdrangel_VERSION CMakeCache.txt | cut -d "=" -f2)" >> $env:GITHUB_OUTPUT + #run: echo "version=$(git describe --tags | cut -c2-)" >> $env:GITHUB_OUTPUT + - name: Diplay version + run: + echo ${{ steps.get_version.outputs.version }} - name: Install basic dependencies on Windows if: startsWith(matrix.config.os, 'windows') run: | @@ -107,7 +111,8 @@ jobs: # Need with clause so git describe --tags works - name: Get version id: get_version - run: echo "version=$(git describe --tags | cut -c2-)" >> $GITHUB_OUTPUT + run: echo "version=$(grep CPACK_PACKAGE_FILE_NAME CMakeCache.txt | cut -d "=" -f2)" >> $GITHUB_OUTPUT + # # Requires git fetch --tags upstream to have been run on the branch! # git remote add upstream https://github.com/f4exb/sdrangel.git # git fetch --tags upstream diff --git a/CMakeLists.txt b/CMakeLists.txt index 893ff53e6..e6cf4cea8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,7 +173,7 @@ if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/") endif() endif() -set(sdrangel_VERSION "${sdrangel_VERSION_MAJOR}.${sdrangel_VERSION_MINOR}.${sdrangel_VERSION_PATCH}${sdrangel_VERSION_SUFFIX}") +set(sdrangel_VERSION "${sdrangel_VERSION_MAJOR}.${sdrangel_VERSION_MINOR}.${sdrangel_VERSION_PATCH}${sdrangel_VERSION_SUFFIX}" CACHE INTERNAL "") message(STATUS "${APPLICATION_NAME} Version: ${sdrangel_VERSION}") add_definitions("-DSDRANGEL_LIB_VERSION=\"${sdrangel_VERSION_MAJOR}.${sdrangel_VERSION_MINOR}.${sdrangel_VERSION_PATCH}\"") add_definitions("-DSDRANGEL_VERSION=\"${sdrangel_VERSION}\"") diff --git a/cmake/cpack/CMakeLists.txt b/cmake/cpack/CMakeLists.txt index 318e20552..eceb09313 100644 --- a/cmake/cpack/CMakeLists.txt +++ b/cmake/cpack/CMakeLists.txt @@ -36,7 +36,7 @@ if(APPLE AND BUNDLE AND BUILD_GUI) set(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/cmake/cpack/sdrangel_icon.icns") set(CPACK_BUNDLE_PLIST "${CMAKE_BINARY_DIR}/Info.plist") set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/cmake/cpack/sdrangel_icon.icns") - set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}_${CPACK_MACOS_PACKAGE_ARCHITECTURE}_${CMAKE_SYSTEM_PROCESSOR}") + set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}_${CPACK_MACOS_PACKAGE_ARCHITECTURE}_${CMAKE_SYSTEM_PROCESSOR}" CACHE INTERNAL "") set(CPACK_PRE_BUILD_SCRIPTS "${PROJECT_BINARY_DIR}/deploy_mac.cmake") # copy SoapySDR Modules