From 69a9de106330ce7cf4fa92f76eedd4b913df8591 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Tue, 11 Jul 2023 13:17:51 -0400 Subject: [PATCH 1/5] Add arm64-ios-simulator triplet --- triplets/community/arm64-ios-simulator.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 triplets/community/arm64-ios-simulator.cmake diff --git a/triplets/community/arm64-ios-simulator.cmake b/triplets/community/arm64-ios-simulator.cmake new file mode 100644 index 00000000000000..1d2e2b9cba4363 --- /dev/null +++ b/triplets/community/arm64-ios-simulator.cmake @@ -0,0 +1,11 @@ +set(VCPKG_TARGET_ARCHITECTURE arm64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) +set(VCPKG_CMAKE_SYSTEM_NAME iOS) +set(VCPKG_OSX_DEPLOYMENT_TARGET 15.0) +set(VCPKG_BUILD_TYPE release) +execute_process(COMMAND xcodebuild -version -sdk iphonesimulator Path + OUTPUT_VARIABLE VCPKG_OSX_SYSROOT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +# set(VCPKG_OSX_SYSROOT iphonesimulator) From 3212d8be84fceeb0b30244035c865eaebf4642b6 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Tue, 11 Jul 2023 16:55:16 -0400 Subject: [PATCH 2/5] ceres IOS_DEPLOYMENT_TARGET --- ports/ceres/portfile.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/ceres/portfile.cmake b/ports/ceres/portfile.cmake index 8cb18127366958..c3daa6c109eb03 100644 --- a/ports/ceres/portfile.cmake +++ b/ports/ceres/portfile.cmake @@ -55,6 +55,7 @@ vcpkg_cmake_configure( -DPROVIDE_UNINSTALL_TARGET=OFF -DMSVC_USE_STATIC_CRT=${MSVC_USE_STATIC_CRT_VALUE} -DLIB_SUFFIX=${LIB_SUFFIX} + -DIOS_DEPLOYMENT_TARGET=15 ) vcpkg_cmake_install() From 8748aed65de04d65b8e0366435348aa642f996b7 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Thu, 13 Jul 2023 00:19:55 -0400 Subject: [PATCH 3/5] visionOS --- ports/filament/cmake-build.patch | 8 ++++++-- ports/filament/portfile.cmake | 3 ++- ports/filament/spirv-tools.patch | 13 +++++++++++++ ports/opencv4/portfile.cmake | 6 ++++++ ports/openssl/unix/CMakeLists.txt | 4 ++-- scripts/cmake/vcpkg_common_definitions.cmake | 2 ++ triplets/community/arm64-ios-xrsimulator.cmake | 11 +++++++++++ 7 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 ports/filament/spirv-tools.patch create mode 100644 triplets/community/arm64-ios-xrsimulator.cmake diff --git a/ports/filament/cmake-build.patch b/ports/filament/cmake-build.patch index 0b506a29ddf59e..39aed2905eacc7 100644 --- a/ports/filament/cmake-build.patch +++ b/ports/filament/cmake-build.patch @@ -2,7 +2,7 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index a979145c0..59a38aa8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -3,6 +3,14 @@ +@@ -3,6 +3,18 @@ # ================================================================================================== cmake_minimum_required(VERSION 3.19) @@ -10,9 +10,13 @@ index a979145c0..59a38aa8e 100644 +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED yes) + -+if (IOS) ++if (IOS AND NOT CMAKE_SYSTEM_NAME STREQUAL "visionOS") + include(third_party/clang/iOS.cmake) +endif() ++ ++if (CMAKE_SYSTEM_NAME STREQUAL "visionOS") ++ add_definitions(-DIOS) ++endif() + # ================================================================================================== # Project declaration diff --git a/ports/filament/portfile.cmake b/ports/filament/portfile.cmake index 98ee88b45f1a16..9ff9156ccdfebd 100644 --- a/ports/filament/portfile.cmake +++ b/ports/filament/portfile.cmake @@ -10,6 +10,7 @@ vcpkg_from_github( cmake-build.patch spirv-std-move.patch cmgen.patch + spirv-tools.patch ) file(REMOVE_RECURSE "${SOURCE_PATH}/third-party/draco") @@ -28,7 +29,7 @@ if (${VCPKG_CMAKE_SYSTEM_NAME} MATCHES "Android") set(PLATFORM_OPTION "-DANDROID=1") set(OPENGL_OPTION "-DFILAMENT_SUPPORTS_OPENGL=ON") set(EGL_OPTION "-DEGL=TRUE") -elseif (${VCPKG_CMAKE_SYSTEM_NAME} MATCHES "iOS") +elseif (${VCPKG_CMAKE_SYSTEM_NAME} MATCHES "iOS" OR ${VCPKG_CMAKE_SYSTEM_NAME} MATCHES "visionOS") set(PLATFORM_OPTION "-DIOS=1") set(METAL_OPTION "-DFILAMENT_SUPPORTS_METAL=ON") elseif (${VCPKG_CMAKE_SYSTEM_NAME} MATCHES "Emscripten") diff --git a/ports/filament/spirv-tools.patch b/ports/filament/spirv-tools.patch new file mode 100644 index 00000000000000..34f6d156d47f7d --- /dev/null +++ b/ports/filament/spirv-tools.patch @@ -0,0 +1,13 @@ +diff --git a/third_party/spirv-tools/CMakeLists.txt b/third_party/spirv-tools/CMakeLists.txt +index 53b3404d1..9be8e584e 100755 +--- a/third_party/spirv-tools/CMakeLists.txt ++++ b/third_party/spirv-tools/CMakeLists.txt +@@ -53,7 +53,7 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN") + add_definitions(-DSPIRV_WINDOWS) + elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") + add_definitions(-DSPIRV_MAC) +-elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS") ++elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "visionOS") + add_definitions(-DSPIRV_IOS) + elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "tvOS") + add_definitions(-DSPIRV_TVOS) diff --git a/ports/opencv4/portfile.cmake b/ports/opencv4/portfile.cmake index 5694c5c53e55c4..c4402da44685a4 100644 --- a/ports/opencv4/portfile.cmake +++ b/ports/opencv4/portfile.cmake @@ -359,6 +359,12 @@ if("contrib" IN_LIST FEATURES) endif() endif() +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "visionOS") + list(APPEND ADDITIONAL_BUILD_FLAGS "-DIOS=1") + list(APPEND ADDITIONAL_BUILD_FLAGS "-DWITH_AVFOUNDATION=OFF") + list(APPEND ADDITIONAL_BUILD_FLAGS "-DBUILD_opencv_videoio=OFF") +endif() + vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS diff --git a/ports/openssl/unix/CMakeLists.txt b/ports/openssl/unix/CMakeLists.txt index 75c21805ace93e..e2934e6e63761e 100644 --- a/ports/openssl/unix/CMakeLists.txt +++ b/ports/openssl/unix/CMakeLists.txt @@ -11,7 +11,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android" OR CMAKE_SYSTEM_NAME STREQUAL "Linux") else() set(PLATFORM linux-generic32) endif() -elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") +elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS") if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64") set(PLATFORM ios64-xcrun) elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm") @@ -108,7 +108,7 @@ if(BUILD_SHARED_LIBS) string(REGEX REPLACE "^(SHLIB_VERSION=)(.*)$" "\\2" SHLIB_VERSION "${SHLIB_VERSION}") - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS") + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS") set(LIB_EXT dylib) set(LIB_EXTS ${SHLIB_VERSION}.${LIB_EXT}) elseif(MINGW) diff --git a/scripts/cmake/vcpkg_common_definitions.cmake b/scripts/cmake/vcpkg_common_definitions.cmake index 58730a89780d14..53be0f11f0ec20 100644 --- a/scripts/cmake/vcpkg_common_definitions.cmake +++ b/scripts/cmake/vcpkg_common_definitions.cmake @@ -9,6 +9,8 @@ elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(VCPKG_TARGET_IS_OSX ON) elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "iOS") set(VCPKG_TARGET_IS_IOS ON) +elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(VCPKG_TARGET_IS_IOS ON) elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") set(VCPKG_TARGET_IS_LINUX ON) elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android") diff --git a/triplets/community/arm64-ios-xrsimulator.cmake b/triplets/community/arm64-ios-xrsimulator.cmake new file mode 100644 index 00000000000000..5b4604f0c74683 --- /dev/null +++ b/triplets/community/arm64-ios-xrsimulator.cmake @@ -0,0 +1,11 @@ +set(VCPKG_TARGET_ARCHITECTURE arm64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) +set(VCPKG_CMAKE_SYSTEM_NAME visionOS) +# set(VCPKG_OSX_DEPLOYMENT_TARGET 1.0) # Setting this breaks simulator builds due to a bug in CMake +set(VCPKG_BUILD_TYPE release) +execute_process(COMMAND xcodebuild -version -sdk xrsimulator Path + OUTPUT_VARIABLE VCPKG_OSX_SYSROOT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/scripts/toolchains/ios.cmake) From 832c3fb08e878001a114ee36d5e0243356ffe3c6 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Mon, 17 Jul 2023 13:08:43 -0400 Subject: [PATCH 4/5] ios-xros --- triplets/community/arm64-ios-simulator.cmake | 1 - triplets/community/arm64-ios-xros.cmake | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 triplets/community/arm64-ios-xros.cmake diff --git a/triplets/community/arm64-ios-simulator.cmake b/triplets/community/arm64-ios-simulator.cmake index 1d2e2b9cba4363..b8538be1a33b69 100644 --- a/triplets/community/arm64-ios-simulator.cmake +++ b/triplets/community/arm64-ios-simulator.cmake @@ -8,4 +8,3 @@ execute_process(COMMAND xcodebuild -version -sdk iphonesimulator Path OUTPUT_VARIABLE VCPKG_OSX_SYSROOT ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) -# set(VCPKG_OSX_SYSROOT iphonesimulator) diff --git a/triplets/community/arm64-ios-xros.cmake b/triplets/community/arm64-ios-xros.cmake new file mode 100644 index 00000000000000..08a625ccf95513 --- /dev/null +++ b/triplets/community/arm64-ios-xros.cmake @@ -0,0 +1,11 @@ +set(VCPKG_TARGET_ARCHITECTURE arm64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) +set(VCPKG_CMAKE_SYSTEM_NAME visionOS) +set(VCPKG_OSX_DEPLOYMENT_TARGET 1.0) +set(VCPKG_BUILD_TYPE release) +execute_process(COMMAND xcodebuild -version -sdk xros Path + OUTPUT_VARIABLE VCPKG_OSX_SYSROOT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/scripts/toolchains/ios.cmake) From 5ec42d7e1762dea5ef7a35cc4bcc2848f7b8020c Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Thu, 20 Jul 2023 21:07:02 -0400 Subject: [PATCH 5/5] Rename --- ...{arm64-ios-simulator.cmake => arm64-ios-iphonesimulator.cmake} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename triplets/community/{arm64-ios-simulator.cmake => arm64-ios-iphonesimulator.cmake} (100%) diff --git a/triplets/community/arm64-ios-simulator.cmake b/triplets/community/arm64-ios-iphonesimulator.cmake similarity index 100% rename from triplets/community/arm64-ios-simulator.cmake rename to triplets/community/arm64-ios-iphonesimulator.cmake