diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 00420ab..ce8b2e0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: - { name: Windows (mingw64), os: windows-latest, build-spirv-cross: false, vendored: false, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, artifact: 'SDL3_shadercross-mingw64' } - { name: Ubuntu 22.04, os: ubuntu-22.04, build-spirv-cross: true, vendored: false, shell: sh, artifact: 'SDL3_shadercross-linux-x64' } - { name: Steam Linux Runtime (Sniper), os: ubuntu-latest, build-spirv-cross: false, vendored: true, shell: sh, artifact: 'SDL3_shadercross-slrsniper', container: 'registry.gitlab.steamos.cloud/steamrt/sniper/sdk:beta' } - - { name: macOS, os: macos-latest, build-spirv-cross: true, vendored: true, shell: sh, artifact: 'SDL3_shadercross-macos-arm64' } + - { name: macOS, os: macos-latest, build-spirv-cross: true, vendored: true, shell: sh, artifact: 'SDL3_shadercross-macos-arm64', cmake-arguments: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_C_FLAGS="-mmacosx-version-min=11.0" -DCMAKE_CXX_FLAGS="-mmacosx-version-min=11.0"' } steps: - uses: actions/checkout@v4 @@ -47,6 +47,7 @@ jobs: id: sdl uses: libsdl-org/setup-sdl@main with: + cmake-arguments: ${{ matrix.platform.cmake-arguments }} cmake-generator: Ninja version: 3-head sdl-test: true @@ -81,7 +82,8 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DSPIRV_CROSS_SHARED=ON \ -DSPIRV_CROSS_STATIC=ON \ - -DCMAKE_INSTALL_PREFIX=${PWD}/spirv_cross_prefix + -DCMAKE_INSTALL_PREFIX=${PWD}/spirv_cross_prefix \ + ${{ matrix.platform.cmake-arguments }} cmake --build spirv_cross_build cmake --install spirv_cross_build @@ -103,7 +105,8 @@ jobs: -DSDLSHADERCROSS_INSTALL=ON \ -DSDLSHADERCROSS_INSTALL_RUNTIME=ON \ -DSDLSHADERCROSS_INSTALL_CPACK=ON \ - -DCMAKE_INSTALL_PREFIX="${PWD}/prefix" + -DCMAKE_INSTALL_PREFIX="${PWD}/prefix" \ + ${{ matrix.platform.cmake-arguments }} - name: Build (CMake) id: build @@ -125,7 +128,8 @@ jobs: if: ${{ always() && steps.install.outcome == 'success' }} run: | cmake -S cmake/test -B cmake_config_build -GNinja \ - -DCMAKE_BUILD_TYPE=Release + -DCMAKE_BUILD_TYPE=Release \ + ${{ matrix.platform.cmake-arguments }} cmake --build cmake_config_build --verbose - uses: actions/upload-artifact@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d049f4..2df6d04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -437,10 +437,18 @@ if(SDLSHADERCROSS_INSTALL_RUNTIME) include(ExternalProject) if(NOT WIN32) + set(configure_CFLAGS "${CMAKE_C_FLAGS}") + if(APPLE) + foreach(osx_arch IN LISTS CMAKE_OSX_ARCHITECTURES) + string(APPEND configure_CFLAGS " -arch ${osx_arch}") + endforeach() + endif() + string(REPLACE ";" "$" genex_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}") + ExternalProject_Add(spirv_headers GIT_REPOSITORY "https://github.com/KhronosGroup/SPIRV-Headers.git" GIT_TAG "main" - CMAKE_ARGS "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_BINDIR=bin" "-DCMAKE_INSTALL_PREFIX=" "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}" "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" + CMAKE_ARGS "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_BINDIR=bin" "-DCMAKE_INSTALL_PREFIX=" "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}" "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DCMAKE_OSX_ARCHITECTURES=${genex_CMAKE_OSX_ARCHITECTURES}" "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}" BUILD_COMMAND "${CMAKE_COMMAND}" "--build" "" --config "Release" INSTALL_COMMAND "${CMAKE_COMMAND}" "--install" "" --config "Release" ) @@ -450,7 +458,7 @@ if(SDLSHADERCROSS_INSTALL_RUNTIME) ExternalProject_Add(vulkan_headers GIT_REPOSITORY "https://github.com/KhronosGroup/Vulkan-Headers" GIT_TAG "main" - CMAKE_ARGS "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_BINDIR=bin" "-DCMAKE_INSTALL_PREFIX=" "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}" "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" + CMAKE_ARGS "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_BINDIR=bin" "-DCMAKE_INSTALL_PREFIX=" "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}" "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DCMAKE_OSX_ARCHITECTURES=${genex_CMAKE_OSX_ARCHITECTURES}" "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}" BUILD_COMMAND "${CMAKE_COMMAND}" "--build" "" --config "Release" INSTALL_COMMAND "${CMAKE_COMMAND}" "--install" "" --config "Release" ) @@ -461,7 +469,7 @@ if(SDLSHADERCROSS_INSTALL_RUNTIME) DEPENDS spirv_headers vulkan_headers GIT_REPOSITORY "https://github.com/KhronosGroup/Vulkan-Loader.git" GIT_TAG "main" - CMAKE_ARGS "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_BINDIR=bin" "-DCMAKE_INSTALL_PREFIX=" "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}" "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DCMAKE_PREFIX_PATH=${vulkan_headers_install_dir}" + CMAKE_ARGS "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_BINDIR=bin" "-DCMAKE_INSTALL_PREFIX=" "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}" "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DCMAKE_OSX_ARCHITECTURES=${genex_CMAKE_OSX_ARCHITECTURES}" "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}" "-DCMAKE_PREFIX_PATH=${vulkan_headers_install_dir}" BUILD_COMMAND "${CMAKE_COMMAND}" "--build" "" --config "Release" INSTALL_COMMAND "${CMAKE_COMMAND}" "--install" "" --config "Release" ) @@ -474,7 +482,7 @@ if(SDLSHADERCROSS_INSTALL_RUNTIME) URL "https://dl.winehq.org/vkd3d/source/vkd3d-1.14.tar.xz" URL_HASH "SHA256=c94015d59ebe8ae72c4d802af5ca1517d9744548842a4e776534612a8d905485" DOWNLOAD_EXTRACT_TIMESTAMP "1" - CONFIGURE_COMMAND "sh" "/configure" "--prefix=" "--enable-tests=no" "--enable-demos=no" "--disable-doxygen-doc" "CFLAGS=-I${spirv_headers_install_dir}/include -I${vulkan_headers_install_dir}/include -I${vulkan_loader_install_dir}/include" "LDFLAGS=-L${vulkan_loader_install_dir}/lib" "BISON=${BISON_EXECUTABLE}" + CONFIGURE_COMMAND "sh" "/configure" "--prefix=" "--enable-tests=no" "--enable-demos=no" "--disable-doxygen-doc" "CFLAGS=-I${spirv_headers_install_dir}/include -I${vulkan_headers_install_dir}/include -I${vulkan_loader_install_dir}/include ${configure_CFLAGS}" "LDFLAGS=-L${vulkan_loader_install_dir}/lib" "BISON=${BISON_EXECUTABLE}" BUILD_COMMAND "make" INSTALL_COMMAND "make" "install" )