Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to use latest xlink repo and added Clang support #1094

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 44 additions & 19 deletions .github/workflows/main.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,39 @@ on:

jobs:

install_clang:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]

steps:
- name: Install Clang on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y clang ninja-build
echo "/usr/bin/clang" >> $GITHUB_ENV
echo "/usr/bin/clang++" >> $GITHUB_ENV

- name: Install Clang on macOS
if: matrix.os == 'macos-latest'
run: |
brew install ninja
curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang+llvm-17.0.6-arm64-apple-darwin22.0.tar.xz
tar -xf clang+llvm-17.0.6-arm64-apple-darwin22.0.tar.xz
mv clang+llvm-17.0.6-arm64-apple-darwin22.0 clang-llvm
echo "$(pwd)/clang-llvm/bin/clang" >> $GITHUB_ENV
echo "$(pwd)/clang-llvm/bin/clang++" >> $GITHUB_ENV

- name: Install Clang on Windows
if: matrix.os == 'windows-latest'
run: |
choco install llvm ninja
echo "C:\\Program Files\\LLVM\\bin\\clang.exe" >> $GITHUB_ENV
echo "C:\\Program Files\\LLVM\\bin\\clang++.exe" >> $GITHUB_ENV
echo "C:\\Program Files\\Ninja\\ninja.exe" >> $GITHUB_ENV

style:
runs-on: ubuntu-20.04

Expand Down Expand Up @@ -59,15 +92,16 @@ jobs:


build:
needs: install_clang
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
cmake: ['3.10.x', ''] # Older version (Ubuntu 18.04) and newest
cmake: ['3.10.x', '3.29.x']
exclude:
- os: windows-latest
cmake: '3.10.x'
- os: macos-latest # Skip the old cmake on latest macos - doesn't handle ARM64 aarch correctly
- os: macos-latest
cmake: '3.10.x'

steps:
Expand Down Expand Up @@ -110,26 +144,14 @@ jobs:
choco install opencv
echo "OpenCV_DIR=C:\tools\opencv\build" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Build (old CMake, gcc/Clang)
if: matrix.cmake == '3.10.x' && matrix.os != 'windows-latest'
- name: Build with Ninja and Clang
run: |
cmake -H. -Bbuild -D'CMAKE_BUILD_TYPE=Release' -D'HUNTER_CONFIGURATION_TYPES=Release' -D'DEPTHAI_BUILD_EXAMPLES=ON' -D'DEPTHAI_BUILD_TESTS=ON' ${{ env.CMAKE_ARGS }}
cmake --build build --config Release -- -j4
cmake -S . -B build -G Ninja -D CMAKE_C_COMPILER=$(clang) -D CMAKE_CXX_COMPILER=$(clang++) -D CMAKE_BUILD_TYPE=Release -D HUNTER_CONFIGURATION_TYPES=Release -D DEPTHAI_BUILD_EXAMPLES=ON -D DEPTHAI_BUILD_TESTS=ON ${{ env.CMAKE_ARGS }}
ninja -C build

# CMake binaries unavailable
# - name: Build (old CMake, MSVC)
# if: matrix.cmake == '3.10.x' && matrix.os == 'windows-latest'
# run: |
# cmake -H. -Bbuild -D'DEPTHAI_BUILD_EXAMPLES=ON' -D'DEPTHAI_BUILD_TESTS=ON'
# cmake --build build

- name: Build (newest CMake)
if: matrix.cmake != '3.10.x'
run: |
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D HUNTER_CONFIGURATION_TYPES=Release -D DEPTHAI_BUILD_EXAMPLES=ON -D DEPTHAI_BUILD_TESTS=ON ${{ env.CMAKE_ARGS }}
cmake --build build --parallel 4 --config Release

integration:
needs: install_clang
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -146,6 +168,7 @@ jobs:
os: windows-latest
shared: true
build-type: Release

steps:
- name: Cache .hunter folder
if: matrix.os != 'windows-latest'
Expand Down Expand Up @@ -185,9 +208,11 @@ jobs:

- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.13
with:
cmake-version: '3.29.x'

- name: Configure ${{ matrix.build-type }}, shared ${{ matrix.shared }}, ${{ matrix.platform }}
run: cmake -S . -B build -D BUILD_SHARED_LIBS=${{ matrix.shared}} -D CMAKE_BUILD_TYPE=${{ matrix.build-type }} -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/depthai_install ${{ env.CMAKE_ARGS }}
run: cmake -S . -B build -D BUILD_SHARED_LIBS=${{ matrix.shared }} -D CMAKE_BUILD_TYPE=${{ matrix.build-type }} -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/depthai_install ${{ env.CMAKE_ARGS }}

- name: Set path to shared library dll (Windows)
if: matrix.os == 'windows-latest'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stability.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
# Release build
- name: Configure, Build and Test
run: |
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D HUNTER_ROOT=$HOME/.hun_vanilla -D DEPTHAI_BUILD_TESTS=ON
cmake -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -S . -B build -D CMAKE_BUILD_TYPE=Release -D HUNTER_ROOT=$HOME/.hun_vanilla -D DEPTHAI_BUILD_TESTS=ON
cmake --build build --parallel 8 --config Release --target stability_stress_test
cd build
../ci/stability_stress_test_combined.sh 86400
4 changes: 2 additions & 2 deletions .github/workflows/test.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Configure, Build and Test
if: matrix.os != 'linux'
run: |
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D HUNTER_ROOT=$HOME/.hun2_${{ matrix.flavor }} -D DEPTHAI_BUILD_EXAMPLES=ON -D DEPTHAI_BUILD_TESTS=ON -D DEPTHAI_TEST_EXAMPLES=ON
cmake -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -S . -B build -D CMAKE_BUILD_TYPE=Release -D HUNTER_ROOT=$HOME/.hun2_${{ matrix.flavor }} -D DEPTHAI_BUILD_EXAMPLES=ON -D DEPTHAI_BUILD_TESTS=ON -D DEPTHAI_TEST_EXAMPLES=ON
cmake --build build --parallel 4 --config Release
cd build
ctest -C Release --output-on-failure -L usb --no-tests=error --repeat until-pass:3
Expand All @@ -64,7 +64,7 @@ jobs:
run: |
export DISPLAY=:99
xdpyinfo -display $DISPLAY >/dev/null 2>&1 || (Xvfb $DISPLAY &)
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D HUNTER_ROOT=$HOME/.hun2_${{ matrix.flavor }} -D DEPTHAI_BUILD_EXAMPLES=ON -D DEPTHAI_BUILD_TESTS=ON -D DEPTHAI_TEST_EXAMPLES=ON
cmake -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -S . -B build -D CMAKE_BUILD_TYPE=Release -D HUNTER_ROOT=$HOME/.hun2_${{ matrix.flavor }} -D DEPTHAI_BUILD_EXAMPLES=ON -D DEPTHAI_BUILD_TESTS=ON -D DEPTHAI_TEST_EXAMPLES=ON
cmake --build build --parallel 4 --config Release
cd build
ctest -C Release --output-on-failure -L usb --no-tests=error --repeat until-pass:3
6 changes: 3 additions & 3 deletions cmake/Hunter/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ hunter_config(

hunter_config(
XLink
VERSION "luxonis-2021.4.2-xlink-linkid-race-fix"
URL "https://github.com/luxonis/XLink/archive/e0eddd9f98c5eacecd4134cbdb713b3d7be039b8.tar.gz"
SHA1 "c97a20d98ce3a5e35cf922c5aaad7e861569869d"
VERSION "luxonis-2024.8.10-xlink-clang-support"
URL "https://github.com/luxonis/XLink/archive/2b517e1cb1ca77bea17679f9fdeb739812431174.tar.gz"
SHA1 "fa7eeb46abeb97626dad923b7733899198284587"
CMAKE_ARGS
XLINK_ENABLE_LIBUSB=${DEPTHAI_ENABLE_LIBUSB}
)
Expand Down