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 Aug 1, 2023
1 parent 5130a09 commit 04c30c8
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 30 deletions.
31 changes: 16 additions & 15 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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;`
Expand All @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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" ]];
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
25 changes: 11 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 "OpenCL (Open Computing Language) C header files")

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

Expand All @@ -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:
# <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 04c30c8

Please sign in to comment.