From ae55a20d6243f3cd80e4fbb991d70d4e868bad7b Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Fri, 20 Oct 2023 02:40:52 +0200 Subject: [PATCH] feat: Apple tvOS and Apple visionOS support --- .github/workflows/unity.yml | 25 +++++++++++++++++++++++++ CMakeLists.txt | 6 +++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unity.yml b/.github/workflows/unity.yml index f37966b9..3ad7a40d 100644 --- a/.github/workflows/unity.yml +++ b/.github/workflows/unity.yml @@ -80,6 +80,28 @@ jobs: EXECUTABLE_SUFFIX=-simulator.a ONLY_ACTIVE_ARCH=NO + - name: configure tvOS + run: > + cmake . -G Xcode -B build_tvos + -DCMAKE_BUILD_TYPE=MinSizeRel + -DCMAKE_SYSTEM_NAME=tvOS + -DCMAKE_OSX_DEPLOYMENT_TARGET=10.0 + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + - name: build tvOS + run: cmake --build build_tvos --config MinSizeRel --target draco_unity + - name: build tvOS Simulator + run: > + cmake + --build build_tvos + --config MinSizeRel + --target draco_unity + -- + -sdk appletvsimulator + EXECUTABLE_SUFFIX=-simulator.a + ONLY_ACTIVE_ARCH=NO + - name: package Apple run: | mkdir draco_apple @@ -88,6 +110,9 @@ jobs: mkdir -p draco_apple/iOS mv build_ios/MinSizeRel-iphoneos/libdraco_unity.a draco_apple/iOS mv build_ios/MinSizeRel-iphonesimulator/libdraco_unity-simulator.a draco_apple/iOS + mkdir -p draco_apple/tvOS + mv build_tvos/MinSizeRel-appletvos/libdraco_unity.a draco_apple/tvOS + mv build_tvos/MinSizeRel-appletvsimulator/libdraco_unity-simulator.a draco_apple/tvOS - name: upload artifact uses: actions/upload-artifact@v3 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index a44ca8c0..eaafe04a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1053,7 +1053,7 @@ else() endif() if(DRACO_UNITY_PLUGIN) - if(IOS OR EMSCRIPTEN) + if(IOS OR EMSCRIPTEN OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS") set(unity_decoder_lib_type STATIC) else() set(unity_decoder_lib_type MODULE) @@ -1110,8 +1110,8 @@ else() OBJLIB_DEPS ${unity_objlib_dependency} draco_unity_enc_plugin ) - # For Mac, we need to build a .bundle for the unity plugin. - if(APPLE) + # For macOS, we need to build a .bundle for the unity plugin. + if(APPLE AND CMAKE_SYSTEM_NAME STREQUAL "Darwin") set_target_properties(draco_unity PROPERTIES BUNDLE true) endif() endif()