Skip to content

Commit

Permalink
Fixes from review: now packaging the install tree; Debian package nam…
Browse files Browse the repository at this point in the history
…e and installation prefix fixed
  • Loading branch information
Beanavil committed Jul 25, 2023
1 parent 5130a09 commit 70b3140
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ jobs:
-D CMAKE_CXX_COMPILER=${{matrix.CXX_COMPILER}}
-D CMAKE_CXX_EXTENSIONS=OFF
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install
-D CPACK_PACKAGING_INSTALL_PREFIX=/usr
-B$GITHUB_WORKSPACE/build
-H$GITHUB_WORKSPACE

Expand All @@ -194,7 +195,7 @@ jobs:
- 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"
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Build dir
[Bb]uild/

# Install dir
[Ii]nstall/

# Package dir
[Pp]ackage[-_\s\d]*/

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
24 changes: 10 additions & 14 deletions cmake/Package.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(CPACK_PACKAGE_VENDOR "khronos")

set(CPACK_PACKAGE_DESCRIPTION "OpenCL API C headers")
set(CPACK_PACKAGE_DESCRIPTION "Khronos OpenCL Headers")

set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")

Expand All @@ -10,34 +10,30 @@ 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)

# Package file name in deb format:
# <PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.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)

Expand Down

0 comments on commit 70b3140

Please sign in to comment.