WIP merge latest changes #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CMake Multi-Platform Build and Release | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: [ "master" ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [windows-latest, macos-latest] | |
| build_type: [Release] | |
| steps: | |
| # ---------- CHECKOUT ---------- | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # ---------- CACHE ---------- | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/vcpkg | |
| ~/Library/Caches/Homebrew | |
| build/ | |
| key: ${{ runner.os }}-deps-${{ hashFiles('CMakeLists.txt', '.github/workflows/**') }} | |
| restore-keys: | | |
| ${{ runner.os }}-deps- | |
| # ---------- QT ---------- | |
| - name: Install Qt | |
| uses: jurplel/install-qt-action@v3 | |
| with: | |
| version: "6.7.2" | |
| host: ${{ matrix.os == 'windows-latest' && 'windows' || 'mac' }} | |
| # ---------- VCPKG ---------- | |
| - name: Install spdlog via vcpkg | |
| uses: lukka/run-vcpkg@v11 | |
| with: | |
| vcpkgArguments: spdlog | |
| # ---------- MACOS DEPENDENCIES ---------- | |
| - name: Install macFUSE (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: brew install --cask macfuse | |
| - name: Install FUSE-T headers (macOS) | |
| if: matrix.os == 'macos-latest' | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| FUSE_T_VERSION=1.0.49 | |
| PKG_URL="https://github.com/macos-fuse-t/fuse-t/releases/download/${FUSE_T_VERSION}/fuse-t-macos-installer-${FUSE_T_VERSION}.pkg" | |
| echo "📦 Downloading FUSE-T from $PKG_URL" | |
| curl -L -o /tmp/fuse-t.pkg "$PKG_URL" | |
| # Clean temp dirs | |
| sudo rm -rf /tmp/fuse-t-* /opt/homebrew/include/fuse_t | |
| mkdir -p /tmp/fuse-t-expanded /tmp/fuse-t-payload | |
| echo "📦 Extracting top-level pkg..." | |
| if ! pkgutil --expand /tmp/fuse-t.pkg /tmp/fuse-t-expanded 2>/dev/null || [ ! "$(ls -A /tmp/fuse-t-expanded)" ]; then | |
| echo "⚠️ pkgutil expand failed or empty — falling back to xar" | |
| xar -xf /tmp/fuse-t.pkg -C /tmp/fuse-t-expanded || true | |
| fi | |
| echo "🔍 Searching recursively for Payload files..." | |
| find /tmp/fuse-t-expanded -type f -name Payload | while read -r payload; do | |
| echo "📂 Extracting payload: $payload" | |
| mkdir -p /tmp/fuse-t-payload/tmp | |
| cat "$payload" | gunzip -dc | (cd /tmp/fuse-t-payload && cpio -idm) || true | |
| done | |
| echo "📁 Listing extracted payload contents:" | |
| find /tmp/fuse-t-payload | head -n 200 || true | |
| # Look for Headers folders | |
| HEADER_CANDIDATES=$(find /tmp/fuse-t-payload -type d \( -path "*/fuse_t.framework/Versions/A/Headers" -o -path "*/fuse_t.framework/Headers" \)) | |
| if [ -z "$HEADER_CANDIDATES" ]; then | |
| echo "❌ Could not locate fuse_t.framework headers after extraction" | |
| echo "Dumping directory tree for debugging:" | |
| find /tmp/fuse-t-expanded /tmp/fuse-t-payload | head -n 300 | |
| exit 1 | |
| fi | |
| echo "✅ Found fuse_t headers:" | |
| echo "$HEADER_CANDIDATES" | |
| sudo mkdir -p /opt/homebrew/include/fuse_t | |
| for h in $HEADER_CANDIDATES; do | |
| echo "📦 Copying headers from $h" | |
| sudo cp -R "$h"/* /opt/homebrew/include/fuse_t/ || true | |
| done | |
| echo "✅ Final installed headers:" | |
| ls -la /opt/homebrew/include/fuse_t | |
| echo "📦 Installing fuse_t.framework to /Library/Frameworks..." | |
| sudo mkdir -p /Library/Frameworks | |
| sudo cp -R "/tmp/fuse-t-payload/Library/Frameworks/fuse_t.framework" "/Library/Frameworks/" | |
| sudo chmod -R 755 "/Library/Frameworks/fuse_t.framework" | |
| echo "✅ Installed framework at /Library/Frameworks/fuse_t.framework" | |
| - name: Debug FUSE-T header location | |
| if: matrix.os == 'macos-latest' | |
| continue-on-error: true | |
| shell: bash | |
| run: | | |
| echo "🔍 Searching for fuse_t.h..." | |
| find /opt/homebrew /usr/local /Library /Applications /private/tmp -type f -name fuse_t.h || true | |
| # ---------- CONFIGURE ---------- | |
| - name: Configure CMake (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| cmake -S . -B build ` | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ` | |
| -DCMAKE_VERBOSE_MAKEFILE=ON ` | |
| -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" ` | |
| -DCMAKE_PREFIX_PATH="${{ github.workspace }}/Qt/6.7.2/msvc2019_64" ` | |
| -Dprojected-fs="C:/Program Files (x86)/Windows Kits/10/Lib/10.0.26100.0/um/x64/ProjectedFSLib.lib" | |
| - name: Configure CMake (macOS) | |
| if: matrix.os == 'macos-latest' | |
| shell: bash | |
| run: | | |
| BREW_PREFIX="$(brew --prefix)" | |
| cmake -S . -B build \ | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
| -DCMAKE_VERBOSE_MAKEFILE=ON \ | |
| -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" \ | |
| -DCMAKE_PREFIX_PATH="${{ github.workspace }}/Qt/6.7.2/macos;$BREW_PREFIX" \ | |
| -DCMAKE_CXX_FLAGS="-I/opt/homebrew/include -I/opt/homebrew/include/fuse_t" \ | |
| -DCMAKE_LIBRARY_PATH="$BREW_PREFIX/lib;/Library/Frameworks" \ | |
| -DFUSE_T_FRAMEWORK="/Library/Frameworks/fuse_t.framework" | |
| # ---------- BUILD ---------- | |
| - name: Build | |
| run: cmake --build build --config ${{ matrix.build_type }} --parallel | |
| - name: Bundle fuse_t.framework into app (macOS) | |
| if: matrix.os == 'macos-latest' | |
| shell: bash | |
| run: | | |
| set -eux | |
| APP_PATH=$(find build -name "*.app" | head -n 1) | |
| if [ -z "$APP_PATH" ]; then | |
| echo "❌ No .app found!" | |
| exit 1 | |
| fi | |
| echo "📦 Bundling fuse_t.framework into $APP_PATH" | |
| mkdir -p "$APP_PATH/Contents/Frameworks" | |
| # Locate the framework (from extracted FUSE-T) | |
| FRAMEWORK_SRC="/tmp/fuse-t-payload/Library/Frameworks/fuse_t.framework" | |
| if [ ! -d "$FRAMEWORK_SRC" ]; then | |
| echo "❌ fuse_t.framework not found at $FRAMEWORK_SRC" | |
| exit 1 | |
| fi | |
| # Copy into the app | |
| cp -R "$FRAMEWORK_SRC" "$APP_PATH/Contents/Frameworks/" | |
| # Fix rpath so the app looks inside its own bundle | |
| install_name_tool -change \ | |
| "/Library/Frameworks/fuse_t.framework/Versions/A/fuse_t" \ | |
| "@rpath/fuse_t.framework/Versions/A/fuse_t" \ | |
| "$APP_PATH/Contents/MacOS/MotionCamFuse" | |
| # Ensure the app searches its own Frameworks dir | |
| install_name_tool -add_rpath "@executable_path/../Frameworks" \ | |
| "$APP_PATH/Contents/MacOS/MotionCamFuse" | |
| echo "✅ fuse_t.framework successfully bundled." | |
| ls -R "$APP_PATH/Contents/Frameworks" | |
| # ---------- PACKAGE ---------- | |
| - name: Package binaries | |
| shell: bash | |
| run: | | |
| mkdir -p artifacts | |
| if [[ "${{ runner.os }}" == "Windows" ]]; then | |
| cd build/${{ matrix.build_type }} | |
| exe=$(ls *.exe 2>/dev/null | head -n 1) | |
| if [ -n "$exe" ]; then | |
| echo "Running windeployqt on $exe" | |
| "${{ github.workspace }}/Qt/6.7.2/msvc2019_64/bin/windeployqt.exe" "$exe" || echo "windeployqt failed" | |
| 7z a ../../artifacts/motioncam-${{ github.ref_name }}-windows.zip ./* | |
| fi | |
| elif [[ "${{ runner.os }}" == "macOS" ]]; then | |
| cd build | |
| app=$(find . -name "*.app" | head -n 1) | |
| if [ -n "$app" ]; then | |
| echo "Running macdeployqt on $app" | |
| macdeployqt "$app" -verbose=2 || echo "macdeployqt failed" | |
| zip -r ../artifacts/motioncam-${{ github.ref_name }}-macos.zip "$app" | |
| fi | |
| fi | |
| # ---------- UPLOAD ---------- | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: motioncam-${{ runner.os }} | |
| path: artifacts/* | |
| # ---------- RELEASE ---------- | |
| release: | |
| name: Create GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: release-files/ | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: release-files/**/* | |
| tag_name: ${{ github.ref_name }} | |
| name: "MotionCam-FS ${{ github.ref_name }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |