Skip to content

Commit 24c8ecc

Browse files
chore: added comments to cross-compilation.yml
1 parent 02e4db1 commit 24c8ecc

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/cross-compilation.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11+
# Use mingw to cross compile apriltag and its tests on linux
1112
build:
1213
runs-on: ubuntu-latest
1314

@@ -16,19 +17,24 @@ jobs:
1617
shared_libs: ['ON','OFF']
1718

1819
steps:
20+
# Install required packages to build for windows
1921
- name: install dependencies
2022
run: |
2123
sudo apt update
2224
sudo apt install -y --no-install-recommends cmake ninja-build gcc-mingw-w64-x86-64
2325
26+
# Get the sources
2427
- uses: actions/checkout@v4
2528

29+
# Save the "build/" folder path
2630
- name: Set reusable strings
2731
id: strings
2832
shell: bash
2933
run: |
3034
echo "build-output-dir=$GITHUB_WORKSPACE/build" >> "$GITHUB_OUTPUT"
3135
36+
# Configure cmake
37+
# CMAKE_SYSTEM_NAME=Windows is needed else it will produce libapriltag.so instead of .dll
3238
- name: Configure CMake
3339
run: >
3440
cmake -B ${{ steps.strings.outputs.build-output-dir }}
@@ -40,21 +46,25 @@ jobs:
4046
-D BUILD_TESTING=ON
4147
-S $GITHUB_WORKSPACE
4248
43-
- name: Build & Install
49+
# Build apriltag
50+
- name: Build
4451
run: cmake --build ${{ steps.strings.outputs.build-output-dir }}
4552

53+
# In case of shared lib, copy the .dll file in the test directory
4654
- name: add DLL to test folder
4755
if: matrix.shared_libs == 'ON'
4856
working-directory: ${{ steps.strings.outputs.build-output-dir }}
4957
run: |
5058
cp *apriltag.dll test/
5159
60+
# Upload the "build/" directory as artifact
5261
- name: Upload build artifact
5362
uses: actions/upload-artifact@v4
5463
with:
5564
name: cross-compilation-build-sharedlib-${{ matrix.shared_libs }}
5665
path: ${{ steps.strings.outputs.build-output-dir }}
5766

67+
# On windows, retrieve the cross compiled build and run the tests
5868
test:
5969
needs: build
6070
runs-on: windows-latest
@@ -65,22 +75,27 @@ jobs:
6575

6676
steps:
6777
- uses: actions/checkout@v4
78+
79+
# Save the "build/" folder path
6880
- name: Set reusable strings
6981
id: strings
7082
shell: bash
7183
run: |
7284
echo "build-output-dir=$GITHUB_WORKSPACE/build" >> "$GITHUB_OUTPUT"
7385
86+
# Download the "build/" directory
7487
- name: Download build artifact
7588
uses: actions/download-artifact@v4
7689
with:
7790
name: cross-compilation-build-sharedlib-${{ matrix.shared_libs }}
7891
path: ${{ steps.strings.outputs.build-output-dir }}
7992

93+
# Change the tests pathes so they match the windows ones instead of the linux ones
8094
- name: Change test pathes
8195
run: |
8296
(Get-Content ${{ steps.strings.outputs.build-output-dir }}/test/CTestTestfile.cmake) -replace '/home/runner/work/apriltag/apriltag', $PWD.Path.Replace('\', '/') | Set-Content ${{ steps.strings.outputs.build-output-dir }}/test/CTestTestfile.cmake
8397
98+
# Run the tests
8499
- name: Test
85100
working-directory: ${{ steps.strings.outputs.build-output-dir }}
86101
run: |

0 commit comments

Comments
 (0)