From d6670837653393fa13c0468690e89a6aa230a556 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 8 Aug 2024 11:36:50 +0300 Subject: [PATCH 01/13] Do not use legacy build system --- build-native.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-native.sh b/build-native.sh index 1e90ad1..cb8e0d0 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 ;; From f0bd3efbdf2ae6645dc33bd9a75d252654802cf0 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 8 Aug 2024 11:40:04 +0300 Subject: [PATCH 02/13] Add arm64 simulator target to iOS builds --- build-native.sh | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/build-native.sh b/build-native.sh index cb8e0d0..fc4fa8e 100755 --- a/build-native.sh +++ b/build-native.sh @@ -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 From 6a21343087cd25d4b7a2a7f9c9331f277a516057 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 8 Aug 2024 12:09:55 +0300 Subject: [PATCH 03/13] Enforce using python 2 --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 71a5d85..6d5e295 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,6 +50,10 @@ jobs: with: fetch-depth: 0 + - uses: actions/setup-python@v5 + with: + python-version: '2.7.18' + - name: Get Submodules run: git submodule update --init --recursive From 7dd872785e530fc6bc886da289c18e527ddc7ff5 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 8 Aug 2024 12:12:16 +0300 Subject: [PATCH 04/13] Revert "Enforce using python 2" This reverts commit 6a21343087cd25d4b7a2a7f9c9331f277a516057. --- .github/workflows/build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d5e295..71a5d85 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,10 +50,6 @@ jobs: with: fetch-depth: 0 - - uses: actions/setup-python@v5 - with: - python-version: '2.7.18' - - name: Get Submodules run: git submodule update --init --recursive From a599be19918cdea1e6c28954df1dc7876341f2aa Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 8 Aug 2024 12:14:07 +0300 Subject: [PATCH 05/13] Make python script work with python 3 --- ext/update_shaderc_sources.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/update_shaderc_sources.py b/ext/update_shaderc_sources.py index cfe8adf..928d8df 100644 --- a/ext/update_shaderc_sources.py +++ b/ext/update_shaderc_sources.py @@ -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) @@ -100,12 +100,12 @@ def main(): 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)) + 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__': From 83d1f47ec31ed26b396743d87729cf2d9f89436a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 8 Aug 2024 12:26:51 +0300 Subject: [PATCH 06/13] Replace deprecated library No comment. --- ext/update_shaderc_sources.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/update_shaderc_sources.py b/ext/update_shaderc_sources.py index 928d8df..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 @@ -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,7 +99,7 @@ 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) + 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 @@ -109,4 +109,4 @@ def main(): c.Checkout() sys.exit(0) if __name__ == '__main__': - main() \ No newline at end of file + main() From b12e0ab7d011fd0ab9316cb45075e1534fb6b8f6 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 8 Aug 2024 13:16:48 +0300 Subject: [PATCH 07/13] Disable `fail-fast` in CI --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 71a5d85..05b677b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,7 @@ jobs: native_builds: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: include: - os: windows-latest From dc7e863cd974ac7fef6dfd80f6fdbbec8238f100 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 8 Aug 2024 13:26:39 +0300 Subject: [PATCH 08/13] Bump minimum android SDK to 21 Matches osu/osu-framework. --- build-native.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 6fd102ba2ce56fc860f00efa00f639d15a0fddbf Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 8 Aug 2024 13:30:59 +0300 Subject: [PATCH 09/13] Fix CMake error --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) 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) From 606aa0a94e6e8c942946297c4defae509e468608 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 8 Aug 2024 13:46:17 +0300 Subject: [PATCH 10/13] Update `SPIRV-Cross` --- ext/SPIRV-Cross | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/SPIRV-Cross b/ext/SPIRV-Cross index 0e2880a..66363ac 160000 --- a/ext/SPIRV-Cross +++ b/ext/SPIRV-Cross @@ -1 +1 @@ -Subproject commit 0e2880ab990e79ce6cc8c79c219feda42d98b1e8 +Subproject commit 66363ac7e8fe4465169ceb2ad5905b1657244cfe From 111c5b56bf5e1d4f60fdbefa073a0b7cca39f564 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 8 Aug 2024 14:02:19 +0300 Subject: [PATCH 11/13] Include policy set in submodule See https://github.com/KhronosGroup/SPIRV-Cross/pull/2361 --- ext/SPIRV-Cross | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/SPIRV-Cross b/ext/SPIRV-Cross index 66363ac..f51773b 160000 --- a/ext/SPIRV-Cross +++ b/ext/SPIRV-Cross @@ -1 +1 @@ -Subproject commit 66363ac7e8fe4465169ceb2ad5905b1657244cfe +Subproject commit f51773b81cd2c21dd04444839723814235e36b7e From 9f36a28440f9a68a331def6e8c4ee433018683b7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 8 Aug 2024 14:37:30 +0300 Subject: [PATCH 12/13] Fix shaderc not having policy set as well --- .github/workflows/build.yml | 1 + ext/sync-shaderc.cmd | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 05b677b..5f2333b 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 ] 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 + From bfc1ba2db849ecef7da66c6816bdbd92f2cd82d9 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 8 Aug 2024 15:21:45 +0300 Subject: [PATCH 13/13] Use latest macOS runners --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5f2333b..0c29014 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,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