Skip to content

Commit 9c19508

Browse files
committed
Fixes for consistency with ICD-Loader CI
1 parent f057ed9 commit 9c19508

File tree

2 files changed

+44
-23
lines changed

2 files changed

+44
-23
lines changed

.github/workflows/presubmit.yml

+38-18
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,34 @@ name: Presubmit
33
on: [push, pull_request]
44

55
jobs:
6+
get-branch:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Get working branch
10+
id: get-branch
11+
run: |
12+
if [[ ${{ github.event_name }} == "push" ]]; then
13+
echo "branch=main" >> $GITHUB_OUTPUT
14+
else
15+
echo "branch=${{ github.base_ref }}" >> $GITHUB_OUTPUT
16+
fi ;
17+
echo $GITHUB_OUTPUT
18+
outputs:
19+
branch: ${{ steps.get-branch.outputs.branch }}
20+
621
format:
722
name: Code formatting
823
runs-on: ubuntu-latest
24+
needs: get-branch
925
steps:
1026
- uses: actions/checkout@v3
1127
with:
28+
# repository: ${{ github.repository }} (default)
1229
fetch-depth: 0
1330
- name: Install clang-format
1431
run: sudo apt-get install clang-format
1532
- name: Check format
16-
run: ./scripts/check-format.sh origin/main --binary clang-format
33+
run: $GITHUB_WORKSPACE/scripts/check-format.sh origin/${{ needs.get-branch.outputs.branch }} --binary clang-format
1734

1835
linux:
1936
runs-on: ubuntu-latest
@@ -163,7 +180,10 @@ jobs:
163180
shell: bash
164181
# /usr/include is already on the include search path,
165182
# we don't expect any output
166-
run: pkg-config OpenCL-Headers --cflags
183+
run: if [[ $(pkg-config OpenCL --cflags) ]];
184+
then
185+
exit 1;
186+
fi;
167187

168188
- name: Uninstall (DEB)
169189
shell: bash
@@ -204,11 +224,11 @@ jobs:
204224
pkg-config OpenCL-Headers --cflags | grep -q "\-I$GITHUB_WORKSPACE/install/include"
205225

206226
windows:
207-
runs-on: windows-2022
227+
runs-on: windows-latest
208228
needs: format
209229
strategy:
210230
matrix:
211-
VER: [v142, v143, clangcl]
231+
VER: [v141, v142, v143, clangcl]
212232
GEN: [Visual Studio 17 2022, Ninja Multi-Config]
213233
BIN: [x64]
214234
STD: [99, 11, 17]
@@ -257,7 +277,7 @@ jobs:
257277
$C_FLAGS = '/W4 /WX'
258278
& cmake `
259279
-G '${{matrix.GEN}}' `
260-
-A $BIN `
280+
-A ${BIN} `
261281
-T ${{matrix.VER}} `
262282
-D BUILD_TESTING=ON `
263283
-D CMAKE_C_STANDARD=${{matrix.STD}} `
@@ -341,15 +361,15 @@ jobs:
341361
--prefix "${env:GITHUB_WORKSPACE}\install" `
342362
--config Release
343363
344-
- name: Consume (PkgConfig - bare MSBuild)
364+
- name: "Consume (MSBuild standalone): Configure/Build/Test"
345365
if: matrix.GEN == 'Visual Studio 17 2022'
346366
shell: pwsh
347367
run: |
348368
$BIN = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'}
349369
$C_FLAGS = '/W4 /WX'
350370
& cmake `
351371
-G '${{matrix.GEN}}' `
352-
-A $BIN `
372+
-A ${BIN} `
353373
-T ${{matrix.VER}} `
354374
-D CMAKE_C_STANDARD=${{matrix.STD}} `
355375
-D CMAKE_C_FLAGS="${C_FLAGS}" `
@@ -368,7 +388,7 @@ jobs:
368388
/noLogo `
369389
}
370390
371-
- name: Consume (PkgConfig - bare Ninja Multi-Config)
391+
- name: "Consume (Ninja Multi-Config standalone): Configure/Build/Test"
372392
if: matrix.GEN == 'Ninja Multi-Config'
373393
shell: pwsh
374394
run: |
@@ -405,15 +425,15 @@ jobs:
405425
New-Item -Type Directory -Path ${env:GITHUB_WORKSPACE}\install\share\cmake\OpenCL
406426
New-Item -Type File -Path ${env:GITHUB_WORKSPACE}\install\share\cmake\OpenCL\OpenCLConfig.cmake -Value 'include("${CMAKE_CURRENT_LIST_DIR}/../OpenCLHeaders/OpenCLHeadersTargets.cmake")'
407427
408-
- name: Consume (PkgConfig - SDK MSBuild)
428+
- name: "Consume (MSBuild SDK): Configure/Build/Test"
409429
if: matrix.GEN == 'Visual Studio 17 2022'
410430
shell: pwsh
411431
run: |
412432
$BIN = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'}
413433
$C_FLAGS = '/W4 /WX'
414434
& cmake `
415435
-G '${{matrix.GEN}}' `
416-
-A $BIN `
436+
-A ${BIN} `
417437
-T ${{matrix.VER}} `
418438
-D CMAKE_C_STANDARD=${{matrix.STD}} `
419439
-D CMAKE_C_FLAGS="${C_FLAGS}" `
@@ -432,7 +452,7 @@ jobs:
432452
/noLogo `
433453
}
434454
435-
- name: Consume (PkgConfig - SDK Ninja Multi-Config)
455+
- name: "Consume (Ninja-Multi-Config SDK): Configure/Build/Test"
436456
if: matrix.GEN == 'Ninja Multi-Config'
437457
shell: pwsh
438458
run: |
@@ -464,15 +484,15 @@ jobs:
464484
}
465485
466486
macos:
467-
runs-on: macos-13
487+
runs-on: macos-latest
468488
needs: format
469489
strategy:
470490
matrix:
471491
C_COMPILER:
472492
- /usr/bin/gcc # Actually Clang 14
473493
- /usr/local/bin/gcc-11
474494
- /usr/local/bin/gcc-13
475-
GEN:
495+
GEN:
476496
- Xcode
477497
- Ninja Multi-Config
478498
STD: [99, 11, 17]
@@ -537,7 +557,7 @@ jobs:
537557
-D CMAKE_C_STANDARD=${{matrix.STD}}
538558
-D CMAKE_C_EXTENSIONS=OFF
539559
-D CMAKE_C_STANDARD_REQUIRED=ON
540-
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install
560+
-D CMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/install"
541561
-S $GITHUB_WORKSPACE/tests/pkgconfig/bare
542562
-B $GITHUB_WORKSPACE/build_install &&
543563
cmake --build $GITHUB_WORKSPACE/build_install --config Release --parallel `sysctl -n hw.logicalcpu` `if [[ "${{matrix.GEN}}" == "Xcode" ]]; then echo "-- -quiet"; fi;` &&
@@ -546,11 +566,12 @@ jobs:
546566
- name: Test pkg-config
547567
shell: bash
548568
run: |
549-
if [[ ! `which pkg-config` ]]; then brew install pkg-config; fi;
550-
PKG_CONFIG_PATH="$GITHUB_WORKSPACE/install/share/pkgconfig" pkg-config OpenCL-Headers --cflags | grep -q "\-I$GITHUB_WORKSPACE/install/include"
569+
if [[ ! `which pkg-config` ]]; then brew install pkg-config; fi &&
570+
export PKG_CONFIG_PATH="$GITHUB_WORKSPACE/install/share/pkgconfig" &&
571+
pkg-config OpenCL-Headers --cflags | grep -q "\-I$GITHUB_WORKSPACE/install/include"
551572
552573
android:
553-
runs-on: ubuntu-22.04
574+
runs-on: ubuntu-latest
554575
needs: format
555576
strategy:
556577
matrix:
@@ -574,7 +595,6 @@ jobs:
574595
-D BUILD_TESTING=ON
575596
-D CMAKE_BUILD_TYPE=${{matrix.CONFIG}}
576597
-D CMAKE_C_FLAGS="-Wall -Wextra -pedantic -Werror"
577-
-D CMAKE_C_STANDARD_REQUIRED=ON
578598
-D CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake
579599
-D ANDROID_ABI=${{matrix.ABI}}
580600
-D ANDROID_PLATFORM=${{matrix.API_LEVEL}}

cmake/Package.cmake

+6-5
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,17 @@ if(NOT (CMAKE_VERSION VERSION_LESS "3.5") OR (CMAKE_INSTALL_PREFIX STREQUAL CPAC
4949
DESTINATION ${pkg_config_location}
5050
COMPONENT pkgconfig_package
5151
${EXTRA_ARGS})
52+
53+
# By using component based packaging, component pkgconfig_install
54+
# can be excluded from the package, and component pkgconfig_package
55+
# can be included.
56+
set(CPACK_DEB_COMPONENT_INSTALL ON)
57+
set(CPACK_COMPONENTS_ALL deb_package)
5258
else()
5359
message(FATAL_ERROR "When using CMake version < 3.5, CPACK_PACKAGING_INSTALL_PREFIX should not be set,"
5460
" or should be the same as CMAKE_INSTALL_PREFIX")
5561
endif()
5662

57-
# By using component based packaging, component pkgconfig_install
58-
# can be excluded from the package, and component pkgconfig_package
59-
# can be included.
60-
set(CPACK_DEB_COMPONENT_INSTALL ON)
61-
set(CPACK_COMPONENTS_ALL deb_package)
6263

6364
# DEB packaging configuration
6465
set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_VENDOR})

0 commit comments

Comments
 (0)