From 04c30c8ee71435a09330322c74e037a0d95de8c6 Mon Sep 17 00:00:00 2001 From: Beatriz Navidad Vilches Date: Thu, 15 Jun 2023 14:41:17 +0000 Subject: [PATCH] Fixes from review: now packaging the install tree; Debian package name and installation prefix fixed --- .github/workflows/linux.yml | 31 ++++++++++++++++--------------- .gitignore | 3 +++ CMakeLists.txt | 2 +- cmake/Package.cmake | 25 +++++++++++-------------- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c8dcf8c3..c7172dcc 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -167,7 +167,8 @@ jobs: - name: Configure shell: bash - run: $CMAKE_EXE + run: mkdir $GITHUB_WORKSPACE/build && cd $GITHUB_WORKSPACE/build && + $CMAKE_EXE -G "${{matrix.GEN}}" -D BUILD_TESTING=ON `if [[ "${{matrix.GEN}}" == "Unix Makefiles" ]]; then echo -D CMAKE_BUILD_TYPE=${{matrix.CONFIG}}; fi;` @@ -178,8 +179,8 @@ jobs: -D CMAKE_CXX_COMPILER=${{matrix.CXX_COMPILER}} -D CMAKE_CXX_EXTENSIONS=OFF -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install - -B$GITHUB_WORKSPACE/build - -H$GITHUB_WORKSPACE + -D CPACK_PACKAGING_INSTALL_PREFIX=/usr + $GITHUB_WORKSPACE - name: Build shell: bash @@ -191,10 +192,21 @@ jobs: $CMAKE_EXE --build $GITHUB_WORKSPACE/build --config Release -- -j`nproc`; fi; + - name: Test + shell: bash + working-directory: ${{runner.workspace}}/OpenCL-Headers/build + run: if [[ "${{matrix.GEN}}" == "Unix Makefiles" ]]; + then + $CTEST_EXE --output-on-failure --parallel `nproc`; + else + $CTEST_EXE --output-on-failure -C Debug --parallel `nproc`; + $CTEST_EXE --output-on-failure -C Release --parallel `nproc`; + fi; + - name: Package DEB shell: bash run: $CPACK_EXE - --config "$GITHUB_WORKSPACE/build/CPackSourceConfig.cmake" + --config "$GITHUB_WORKSPACE/build/CPackConfig.cmake" -G DEB -C Release -B "$GITHUB_WORKSPACE/package-deb" @@ -223,17 +235,6 @@ jobs: $CMAKE_EXE --build $GITHUB_WORKSPACE/build --config Release -- -j`nproc` fi - - name: Test - shell: bash - working-directory: ${{runner.workspace}}/OpenCL-Headers/build - run: if [[ "${{matrix.GEN}}" == "Unix Makefiles" ]]; - then - $CTEST_EXE --output-on-failure --parallel `nproc`; - else - $CTEST_EXE --output-on-failure -C Debug --parallel `nproc`; - $CTEST_EXE --output-on-failure -C Release --parallel `nproc`; - fi; - - name: Test install shell: bash run: if [[ "${{matrix.GEN}}" == "Unix Makefiles" ]]; diff --git a/.gitignore b/.gitignore index 708e035e..78760ca1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ # Build dir [Bb]uild/ +# Install dir +[Ii]nstall/ + # Package dir [Pp]ackage[-_\s\d]*/ diff --git a/CMakeLists.txt b/CMakeLists.txt index b1eba897..9339a8c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ if(TARGET Headers) endif() project(OpenCLHeaders - VERSION 2.2 + VERSION 3.0 LANGUAGES C # Ideally should be NONE, but GNUInstallDirs detects platform arch using try_compile # https://stackoverflow.com/questions/43379311/why-does-project-affect-cmakes-opinion-on-cmake-sizeof-void-p ) diff --git a/cmake/Package.cmake b/cmake/Package.cmake index 6e97e130..8ba7d479 100644 --- a/cmake/Package.cmake +++ b/cmake/Package.cmake @@ -1,6 +1,6 @@ set(CPACK_PACKAGE_VENDOR "khronos") -set(CPACK_PACKAGE_DESCRIPTION "OpenCL API C headers") +set(CPACK_PACKAGE_DESCRIPTION "OpenCL (Open Computing Language) C header files") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") @@ -10,34 +10,31 @@ if(NOT CPACK_PACKAGING_INSTALL_PREFIX) set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") endif() -if(NOT CPACK_SOURCE_IGNORE_FILES) - set(CPACK_SOURCE_IGNORE_FILES="/.github/;/build/") -endif() - # DEB packaging configuration set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_VENDOR}) set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/KhronosGroup/OpenCL-Headers") -# Get Debian package name from project name -string(TOLOWER ${PROJECT_NAME} DEBIAN_PACKAGE_NAME) -string(REPLACE "opencl" "opencl-" DEBIAN_PACKAGE_NAME ${DEBIAN_PACKAGE_NAME}) - # Version number [epoch:]upstream_version[-debian_revision] -set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) # upstream_version -set(CPACK_DEBIAN_PACKAGE_RELEASE "1") # devian_revision (because this is a +set(LATEST_RELEASE_VERSION "2023.04.17") +set(CPACK_DEBIAN_PACKAGE_VERSION "${PROJECT_VERSION}~${LATEST_RELEASE_VERSION}") # upstream_version +set(CPACK_DEBIAN_PACKAGE_RELEASE "1") # debian_revision (because this is a # non-native pkg) +set(PACKAGE_VERSION_REVISION "${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}") +set(DEBIAN_PACKAGE_NAME "opencl-c-headers") set(CPACK_DEBIAN_PACKAGE_NAME - "${CPACK_PACKAGE_VENDOR}-${DEBIAN_PACKAGE_NAME}" + "${DEBIAN_PACKAGE_NAME}" CACHE STRING "Package name" FORCE) -set(CPACK_DEBIAN_PACKAGE_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}-${CPACK_DEBIAN_PACKAGE_VERSION}") +# Get architecture +execute_process(COMMAND dpkg "--print-architecture" OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE) +string(STRIP "${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}" CPACK_DEBIAN_PACKAGE_ARCHITECTURE) # Package file name in deb format: # _-_.deb -set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) +set(CPACK_DEBIAN_FILE_NAME "${CPACK_PACKAGE_VENDOR}-${DEBIAN_PACKAGE_NAME}_${PACKAGE_VERSION_REVISION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb") set(CPACK_DEBIAN_PACKAGE_DEBUG ON)