Skip to content

Fix BRN build sourcetree #1532

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

Merged
merged 14 commits into from
Jul 17, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
23 changes: 16 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include(FetchContent)
# --------------------------------------------------
FetchContent_Declare(AndroidExtensions
GIT_REPOSITORY https://github.com/BabylonJS/AndroidExtensions.git
GIT_TAG 7d88a601fda9892791e7b4e994e375e049615688)
GIT_TAG 66520bff9b57030b67894a4934d18ad7e161ba6f)
FetchContent_Declare(arcana.cpp
GIT_REPOSITORY https://github.com/microsoft/arcana.cpp.git
GIT_TAG 1a8a5d6e95413ed14b38a6ac9419048f9a9c8009)
Expand Down Expand Up @@ -48,18 +48,27 @@ FetchContent_Declare(libwebp

FetchContent_MakeAvailable(CMakeExtensions)

if(VISIONOS)
# BABYLON_NATIVE_BUILD_SOURCETREE flag is used by BabylonReactNative NPM build process.
# CMake script is run twice. At package creation, BABYLON_NATIVE_BUILD_SOURCETREE is ON
# which makes all dependencies to be fetched and packaged.
# At build time, cmake is run again on BabylonNative root but FETCHCONTENT_FULLY_DISCONNECTED is ON
# and FetchContent_MakeAvailable_With_Message will use provided local folder provided to cmake command line
# like '-DFETCHCONTENT_SOURCE_DIR_BGFX.CMAKE=../shared/Babylon/....'

if(VISIONOS OR IOS OR BABYLON_NATIVE_BUILD_SOURCETREE)
FetchContent_MakeAvailable_With_Message(ios-cmake)
set(CMAKE_TOOLCHAIN_FILE "${ios-cmake_SOURCE_DIR}/ios.toolchain.cmake" CACHE PATH "")
if(NOT BABYLON_NATIVE_BUILD_SOURCETREE)
set(CMAKE_TOOLCHAIN_FILE "${ios-cmake_SOURCE_DIR}/ios.toolchain.cmake" CACHE PATH "")
endif()
set(ENABLE_ARC OFF CACHE STRING "Enables or disables ARC support.")
endif()

if(VISIONOS)
set(PLATFORM "VISIONOSCOMBINED" CACHE STRING "")
set(DEPLOYMENT_TARGET "1.0" CACHE STRING "")
set(ENABLE_ARC OFF CACHE STRING "Enables or disables ARC support.")
elseif(IOS)
FetchContent_MakeAvailable_With_Message(ios-cmake)
set(CMAKE_TOOLCHAIN_FILE "${ios-cmake_SOURCE_DIR}/ios.toolchain.cmake" CACHE PATH "")
set(PLATFORM "OS64COMBINED" CACHE STRING "")
set(DEPLOYMENT_TARGET "13" CACHE STRING "")
set(ENABLE_ARC OFF CACHE STRING "Enables or disables ARC support.")
endif()

project(BabylonNative)
Expand Down
6 changes: 3 additions & 3 deletions Dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
# --------------------------------------------------
# AndroidExtensions
# --------------------------------------------------
if(ANDROID)
if(ANDROID OR BABYLON_NATIVE_BUILD_SOURCETREE)
FetchContent_MakeAvailable_With_Message(AndroidExtensions)
endif()

Expand All @@ -15,7 +15,7 @@ FetchContent_MakeAvailable_With_Message(arcana.cpp)
# --------------------------------------------------
# arcore-android-sdk
# --------------------------------------------------
if(ANDROID)
if(ANDROID OR BABYLON_NATIVE_BUILD_SOURCETREE)
FetchContent_MakeAvailable_With_Message(arcore-android-sdk)
endif()

Expand Down Expand Up @@ -192,7 +192,7 @@ endif()
# xr
# --------------------------------------------------
# Currently supported on Android via ARCore, and iOS via ARKit.
if(BABYLON_NATIVE_PLUGIN_NATIVEXR AND (ANDROID OR IOS))
if((BABYLON_NATIVE_PLUGIN_NATIVEXR AND (ANDROID OR IOS)) OR BABYLON_NATIVE_BUILD_SOURCETREE)
add_subdirectory(xr)
set_property(TARGET xr PROPERTY FOLDER Dependencies/xr)
warnings_as_errors(xr)
Expand Down
2 changes: 1 addition & 1 deletion Dependencies/xr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (ANDROID)
set(SOURCES ${SOURCES}
"Source/ARCore/Include/IXrContextARCore.h"
"Source/ARCore/XR.cpp")
elseif (IOS)
elseif(IOS OR BABYLON_NATIVE_BUILD_SOURCETREE)
set(SOURCES ${SOURCES}
"Source/ARKit/Include/IXrContextARKit.h"
"Source/ARKit/XR.mm")
Expand Down
Loading