Skip to content

Commit 23e13c0

Browse files
committed
refactor CI workflow to install Boost separately for Linux and Windows; update CMakeLists for proper installation paths
1 parent c5fcc35 commit 23e13c0

3 files changed

Lines changed: 26 additions & 9 deletions

File tree

.github/workflows/cmake-multi-platform.yml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,24 @@ jobs:
2626
with:
2727
version: '6.5.2'
2828

29-
- name: Install boost
30-
uses: MarkusJx/install-boost@v2.4.4
31-
id: install-boost
32-
with:
33-
boost_version: 1.82.0
29+
- name: Install Boost (Linux)
30+
if: runner.os == 'Linux'
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install -y libboost-all-dev
34+
35+
- name: Install Boost (Windows)
36+
if: runner.os == 'Windows'
37+
shell: pwsh
38+
run: |
39+
choco install boost-msvc-14.3 --yes --no-progress
40+
$boostRoot = Get-ChildItem 'C:\local' -Directory -Filter 'boost_*' |
41+
Sort-Object Name -Descending |
42+
Select-Object -First 1
43+
if (-not $boostRoot) {
44+
throw 'Boost installation directory not found under C:\local'
45+
}
46+
"BOOST_ROOT=$($boostRoot.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
3447
3548
- name: Set reusable strings
3649
id: strings
@@ -43,8 +56,6 @@ jobs:
4356
cmake -B ${{ steps.strings.outputs.build-output-dir }}
4457
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
4558
-S ${{ github.workspace }}
46-
env:
47-
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
4859
4960
- name: Build
5061
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
@@ -59,8 +70,11 @@ jobs:
5970
VERSION="0.1.${GITHUB_RUN_NUMBER}"
6071
fi
6172
62-
mkdir -p package-root/usr/bin package-root/DEBIAN dist
63-
cp "${{ steps.strings.outputs.build-output-dir }}/src/SudokuCube" package-root/usr/bin/
73+
mkdir -p package-root/DEBIAN dist
74+
75+
DESTDIR="$PWD/package-root" cmake --install "${{ steps.strings.outputs.build-output-dir }}" --prefix /usr --strip --config "${{ matrix.build_type }}"
76+
77+
test -x package-root/usr/bin/SudokuCube
6478
6579
cat > package-root/DEBIAN/control <<EOF
6680
Package: sudokucube

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ set(CMAKE_AUTORCC ON)
1212
set(CMAKE_CXX_STANDARD 17)
1313
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1414

15+
include(GNUInstallDirs)
16+
1517
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick)
1618
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick)
1719

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ set_target_properties(SudokuCube PROPERTIES
5656

5757
install(TARGETS SudokuCube
5858
BUNDLE DESTINATION .
59+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
5960
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
6061

6162
if(QT_VERSION_MAJOR EQUAL 6)

0 commit comments

Comments
 (0)