Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow building for vision pro, vision pro simulator, and ios simulator #30

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ports/ceres/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 6 additions & 2 deletions ports/filament/cmake-build.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@ 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)

+set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
+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
Expand Down
3 changes: 2 additions & 1 deletion ports/filament/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down
13 changes: 13 additions & 0 deletions ports/filament/spirv-tools.patch
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 6 additions & 0 deletions ports/opencv4/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ports/openssl/unix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions scripts/cmake/vcpkg_common_definitions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
10 changes: 10 additions & 0 deletions triplets/community/arm64-ios-simulator.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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)
11 changes: 11 additions & 0 deletions triplets/community/arm64-ios-xros.cmake
Original file line number Diff line number Diff line change
@@ -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)
11 changes: 11 additions & 0 deletions triplets/community/arm64-ios-xrsimulator.cmake
Original file line number Diff line number Diff line change
@@ -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)