diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 71a5d85..0c29014 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,6 @@ name: CI on: + workflow_dispatch: create: # when tags are created push: branches: [ master ] @@ -9,6 +10,7 @@ jobs: native_builds: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: include: - os: windows-latest @@ -35,7 +37,7 @@ jobs: build_args: release linux-x64 build_target: linux-x64 artifact_name: build/Release/linux-x64/libveldrid-spirv.so - - os: macos-11 + - os: macos-latest build_args: release osx 'arm64;x86_64' build_target: osx artifact_name: build/Release/osx/libveldrid-spirv.dylib diff --git a/CMakeLists.txt b/CMakeLists.txt index 82ba559..c2f96a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required (VERSION 3.0) +cmake_policy(SET CMP0057 NEW) if(IOS) include(ios/ios.toolchain.cmake) diff --git a/build-native.cmd b/build-native.cmd index 3028145..4c4c39c 100644 --- a/build-native.cmd +++ b/build-native.cmd @@ -7,7 +7,7 @@ set _CMAKE_GENERATOR_PLATFORM=x64 set _NDK_DIR= set _ANDROID_ABI=arm64-v8a set _OS_DIR= -set _ANDROID_PLATFORM=android-16 +set _ANDROID_PLATFORM=android-21 :ArgLoop if [%1] == [] goto LocateVS diff --git a/build-native.sh b/build-native.sh index 1e90ad1..fc4fa8e 100755 --- a/build-native.sh +++ b/build-native.sh @@ -34,7 +34,7 @@ while :; do ios) _CMakeEnableBitcode=-DENABLE_BITCODE=0 _CMakeBuildTarget=veldrid-spirv - _CMakeGenerator="-G Xcode -T buildsystem=1" + _CMakeGenerator="-G Xcode" _CMakeExtraBuildArgs="--config Release" _OSDir=ios ;; @@ -64,15 +64,35 @@ if [[ $_OSDir == "ios" ]]; then popd - mkdir -p simulator-build - pushd simulator-build + mkdir -p simulator-build-arm64 + pushd simulator-build-arm64 + + cmake ../../../.. -DIOS=ON -DCMAKE_BUILD_TYPE=$_CMakeBuildType $_CMakeGenerator -DPLATFORM=SIMULATORARM64 -DDEPLOYMENT_TARGET=13.4 $_CMakeEnableBitcode -DPYTHON_EXECUTABLE=$_PythonExePath -DCMAKE_OSX_ARCHITECTURES="$_CMakeOsxArchitectures" + cmake --build . --target $_CMakeBuildTarget $_CMakeExtraBuildArgs + + popd + + mkdir -p simulator-build-x64 + pushd simulator-build-x64 cmake ../../../.. -DIOS=ON -DCMAKE_BUILD_TYPE=$_CMakeBuildType $_CMakeGenerator -DPLATFORM=SIMULATOR64 -DDEPLOYMENT_TARGET=13.4 $_CMakeEnableBitcode -DPYTHON_EXECUTABLE=$_PythonExePath -DCMAKE_OSX_ARCHITECTURES="$_CMakeOsxArchitectures" cmake --build . --target $_CMakeBuildTarget $_CMakeExtraBuildArgs popd - xcodebuild -create-xcframework -framework ./device-build/Release-iphoneos/veldrid-spirv.framework -framework ./simulator-build/Release-iphonesimulator/veldrid-spirv.framework -output ./veldrid-spirv.xcframework + mkdir -p simulator-build-combined/veldrid-spirv.framework + + cp ./simulator-build-arm64/Release-iphonesimulator/veldrid-spirv.framework/Info.plist ./simulator-build-combined/veldrid-spirv.framework/Info.plist + + lipo -create \ + ./simulator-build-arm64/Release-iphonesimulator/veldrid-spirv.framework/veldrid-spirv \ + ./simulator-build-x64/Release-iphonesimulator/veldrid-spirv.framework/veldrid-spirv \ + -output ./simulator-build-combined/veldrid-spirv.framework/veldrid-spirv + + xcodebuild -create-xcframework \ + -framework ./device-build/Release-iphoneos/veldrid-spirv.framework \ + -framework ./simulator-build-combined/veldrid-spirv.framework \ + -output ./veldrid-spirv.xcframework else cmake ../../.. -DCMAKE_BUILD_TYPE=$_CMakeBuildType $_CMakeGenerator $_CMakeEnableBitcode -DPYTHON_EXECUTABLE=$_PythonExePath -DCMAKE_OSX_ARCHITECTURES="$_CMakeOsxArchitectures" cmake --build . --target $_CMakeBuildTarget $_CMakeExtraBuildArgs diff --git a/ext/SPIRV-Cross b/ext/SPIRV-Cross index 0e2880a..f51773b 160000 --- a/ext/SPIRV-Cross +++ b/ext/SPIRV-Cross @@ -1 +1 @@ -Subproject commit 0e2880ab990e79ce6cc8c79c219feda42d98b1e8 +Subproject commit f51773b81cd2c21dd04444839723814235e36b7e diff --git a/ext/sync-shaderc.cmd b/ext/sync-shaderc.cmd index 805d64e..f644161 100644 --- a/ext/sync-shaderc.cmd +++ b/ext/sync-shaderc.cmd @@ -2,3 +2,16 @@ @echo off python %~dp0update_shaderc_sources.py --dir %~dp0shaderc --file %~dp0known_good.json + +:: Android NDK 27+ need this policy set on shaderc (as well as other tools) +move /y %~dp0shaderc\CMakeLists.txt %~dp0shaderc\CMakeLists.tmp + +setlocal enableDelayedExpansion +set p= +for /f "tokens=* delims=" %%a in (%~dp0shaderc\CMakeLists.tmp) do ( + if "!p!"=="cmake_minimum_required(VERSION 2.8.12)" echo cmake_policy(SET CMP0057 NEW^)>>%~dp0shaderc\CMakeLists.txt + (echo %%a) >>%~dp0shaderc\CMakeLists.txt + set p=%%a +) +del %~dp0shaderc\CMakeLists.tmp + diff --git a/ext/update_shaderc_sources.py b/ext/update_shaderc_sources.py index cfe8adf..0ce6432 100644 --- a/ext/update_shaderc_sources.py +++ b/ext/update_shaderc_sources.py @@ -17,7 +17,7 @@ from operator import attrgetter import argparse import json -import distutils.dir_util +import pathlib import os.path import subprocess import sys @@ -32,7 +32,7 @@ def command_output(cmd, directory, fail_ok=False): Raises a RuntimeError if the command fails to launch or otherwise fails. """ if VERBOSE: - print('In {d}: {cmd}'.format(d=directory, cmd=cmd)) + print(('In {d}: {cmd}'.format(d=directory, cmd=cmd))) p = subprocess.Popen(cmd, cwd=directory, stdout=subprocess.PIPE) @@ -75,7 +75,7 @@ def HasCommit(self): self.commit + '^{commit}'], cwd=self.subdir) def Clone(self): - distutils.dir_util.mkpath(self.subdir) + pathlib.Path(self.subdir).mkdir(parents=True, exist_ok=True) command_output(['git', 'clone', self.GetUrl(), '.'], self.subdir) def Fetch(self): command_output(['git', 'fetch', 'known-good'], self.subdir) @@ -99,14 +99,14 @@ def main(): help="The file containing known-good commits. Default is \'' + KNOWN_GOOD_FILE + '\'.") args = parser.parse_args() commits = GetGoodCommits(args.known_good_file) - distutils.dir_util.mkpath(args.dir) - print('Change directory to {d}'.format(d=args.dir)) + pathlib.Path(args.dir).mkdir(parents=True, exist_ok=True) + print(('Change directory to {d}'.format(d=args.dir))) os.chdir(args.dir) # Create the subdirectories in sorted order so that parent git repositories # are created first. for c in sorted(commits, key=attrgetter('subdir')): - print('Get {n}\n'.format(n=c.name)) + print(('Get {n}\n'.format(n=c.name))) c.Checkout() sys.exit(0) if __name__ == '__main__': - main() \ No newline at end of file + main()