diff --git a/.github/workflows/macos.yml b/.github/workflows/build.yml similarity index 62% rename from .github/workflows/macos.yml rename to .github/workflows/build.yml index 94972aaf..16f7f0ce 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: macOS +name: Build env: VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" @@ -10,12 +10,16 @@ on: - '!README.md' - '!LICENSE.txt' - '!docs/**' - - '!.github/workflows/*.yml' - - '.github/workflows/macos.yml' jobs: build: - runs-on: macOS-latest + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [windows-latest, macos-latest, ubuntu-24.04] + steps: - uses: actions/checkout@v4 @@ -26,10 +30,16 @@ jobs: vulkan-components: Vulkan-Headers, Vulkan-Loader, Glslang, SPIRV-Tools vulkan-use-cache: true - - name: Install latest LLVM, Ninja and build dependencies + - name: Install build dependencies (macOS) + if: ${{ matrix.os == 'macos-latest' }} run: brew install llvm ninja autoconf automake libtool nasm - - name: Install vcpkg + - name: Install build dependencies (ubuntu-24.04) + if: ${{ matrix.os == 'ubuntu-24.04' }} + run: sudo apt-get install ninja-build libc++-dev libc++abi-dev xorg-dev libtool libltdl-dev + + - name: Setup vcpkg (macOS) + if: ${{ matrix.os == 'macos-latest' }} run: | git clone https://github.com/microsoft/vcpkg.git --depth 1 cd vcpkg && ./bootstrap-vcpkg.sh @@ -42,13 +52,18 @@ jobs: core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - - name: Workaround for CMake issue that cannot find __CMAKE::CXX23 target + - name: Enable Developer Command Prompt (Windows) + if: ${{ matrix.os == 'windows-latest' }} + uses: ilammy/msvc-dev-cmd@v1 + + - name: Workaround for CMake bug that cannot find __CMAKE::CXX23 target when using homebrew libc++ (macOS) + if: ${{ matrix.os == 'macos-latest' }} run: sed -i '' 's|libc++.modules.json|../../c++/libc++.modules.json|g' /opt/homebrew/opt/cmake/share/cmake/Modules/Compiler/Clang-CXX-CXXImportStd.cmake # https://gitlab.kitware.com/cmake/cmake/-/issues/25965#note_1523575 - name: Configure run: | mv .github/workflows/scripts/* . - cmake --preset=macos-clang + cmake --preset=${{ matrix.os }} - name: Build run: cmake --build build --config release \ No newline at end of file diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml deleted file mode 100644 index 06b68cc2..00000000 --- a/.github/workflows/linux.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Linux - -env: - VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" - -on: - push: - paths: - - '**' - - '!README.md' - - '!LICENSE.txt' - - '!docs/**' - - '!.github/workflows/*.yml' - - '.github/workflows/linux.yml' - -jobs: - build: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v4 - - - name: Install Vulkan SDK - uses: humbletim/setup-vulkan-sdk@v1.2.0 - with: - vulkan-query-version: latest - vulkan-components: Vulkan-Headers, Vulkan-Loader, Glslang, SPIRV-Tools - vulkan-use-cache: true - - - name: Install Ninja and build dependencies - run: sudo apt-get install ninja-build libc++-dev libc++abi-dev xorg-dev libtool libltdl-dev - - - name: Set vcpkg environment variable - run: echo "VCPKG_ROOT=${VCPKG_INSTALLATION_ROOT}" >> $GITHUB_ENV - - - name: Export GitHub Actions cache environment variables - uses: actions/github-script@v7 - with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - - - name: Configure - run: | - mv .github/workflows/scripts/* . - cmake --preset=linux-clang-18 - - - name: Build - run: cmake --build build --config release \ No newline at end of file diff --git a/.github/workflows/scripts/CMakeUserPresets.json b/.github/workflows/scripts/CMakeUserPresets.json index 4f2329a6..3484d8c0 100644 --- a/.github/workflows/scripts/CMakeUserPresets.json +++ b/.github/workflows/scripts/CMakeUserPresets.json @@ -2,19 +2,11 @@ "version": 6, "configurePresets": [ { - "name": "linux-clang-18", - "inherits": "default", - "cacheVariables": { - "CMAKE_C_COMPILER": "/usr/bin/clang-18", - "CMAKE_CXX_COMPILER": "/usr/bin/clang++-18", - "CMAKE_CXX_FLAGS": "-stdlib=libc++", - "CMAKE_EXE_LINKER_FLAGS": "-stdlib=libc++ -lc++abi", - "VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/triplets", - "VCPKG_TARGET_TRIPLET": "x64-linux-clang" - } + "name": "windows-latest", + "inherits": "default" }, { - "name": "macos-clang", + "name": "macos-latest", "inherits": "default", "cacheVariables": { "CMAKE_C_COMPILER": "/opt/homebrew/opt/llvm/bin/clang", @@ -24,6 +16,21 @@ "VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/triplets", "VCPKG_TARGET_TRIPLET": "arm64-macos-clang" } + }, + { + "name": "ubuntu-24.04", + "inherits": "default", + "cacheVariables": { + "CMAKE_C_COMPILER": "/usr/bin/clang-18", + "CMAKE_CXX_COMPILER": "/usr/bin/clang++-18", + "CMAKE_CXX_FLAGS": "-stdlib=libc++", + "CMAKE_EXE_LINKER_FLAGS": "-stdlib=libc++ -lc++abi", + "VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/triplets", + "VCPKG_TARGET_TRIPLET": "x64-linux-clang" + }, + "environment": { + "VCPKG_ROOT": "$env{VCPKG_INSTALLATION_ROOT}" + } } ] } \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index 5d1b493e..00000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Windows - -env: - VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" - -on: - push: - paths: - - '**' - - '!README.md' - - '!LICENSE.txt' - - '!docs/**' - - '!.github/workflows/*.yml' - - '.github/workflows/windows.yml' - -jobs: - build: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - - name: Install Vulkan SDK - uses: humbletim/setup-vulkan-sdk@v1.2.0 - with: - vulkan-query-version: latest - vulkan-components: Vulkan-Headers, Vulkan-Loader, Glslang, SPIRV-Tools - vulkan-use-cache: true - - - name: Export GitHub Actions cache environment variables - uses: actions/github-script@v7 - with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - - - name: Enable Developer Command Prompt - uses: ilammy/msvc-dev-cmd@v1 - with: - toolset: 14.42 - - - name: Configure - run: cmake --preset=default - - - name: Build - run: cmake --build build --config release \ No newline at end of file diff --git a/README.md b/README.md index 32a08217..68db3a71 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # Vulkan glTF Viewer -![Windows](https://github.com/stripe2933/vk-gltf-viewer/actions/workflows/windows.yml/badge.svg) -![macOS](https://github.com/stripe2933/vk-gltf-viewer/actions/workflows/macos.yml/badge.svg) -![Linux](https://github.com/stripe2933/vk-gltf-viewer/actions/workflows/linux.yml/badge.svg) +![Build](https://github.com/stripe2933/vk-gltf-viewer/actions/workflows/build.yml/badge.svg) Blazingly fast[^1] Vulkan glTF viewer.