Skip to content

Commit 4ee84e3

Browse files
Js runtime host integration (#1238)
Co-authored-by: Andy Fillebrown <[email protected]>
1 parent 10bf14c commit 4ee84e3

File tree

127 files changed

+37
-27369
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+37
-27369
lines changed

.github/jobs/ios.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- script: |
2828
mkdir buildiOS
2929
cd buildiOS
30-
cmake .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../Dependencies/ios-cmake/ios.toolchain.cmake -DPLATFORM=OS64COMBINED -DENABLE_ARC=0 -DDEPLOYMENT_TARGET=${{ parameters.deploymentTarget }} -DENABLE_GLSLANG_BINARIES=OFF -DSPIRV_CROSS_CLI=OFF -DCMAKE_UNITY_BUILD=${UNITY_BUILD}
30+
cmake .. -G Xcode -D IOS=ON -D DEPLOYMENT_TARGET=${{ parameters.deploymentTarget }} -D CMAKE_UNITY_BUILD=${UNITY_BUILD}
3131
displayName: 'Generate iOS solution'
3232
3333
- task: Xcode@5

.github/jobs/linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- script: |
3333
mkdir build
3434
cd build
35-
cmake .. -GNinja -DJSCORE_LIBRARY=/usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-4.0.so -DNAPI_JAVASCRIPT_ENGINE=${{ parameters.JSEngine }} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBGFX_CONFIG_DEBUG=ON -DCMAKE_UNITY_BUILD=${UNITY_BUILD}
35+
cmake .. -G Ninja -D JAVASCRIPTCORE_LIBRARY=/usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-4.0.so -D NAPI_JAVASCRIPT_ENGINE=${{ parameters.JSEngine }} -D CMAKE_BUILD_TYPE=RelWithDebInfo -D BGFX_CONFIG_DEBUG=ON -D CMAKE_UNITY_BUILD=${UNITY_BUILD}
3636
ninja
3737
displayName: 'Build X11'
3838

.github/jobs/macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- script: |
2727
mkdir buildmacOS
2828
cd buildmacOS
29-
cmake .. -GXcode -DCMAKE_UNITY_BUILD=${UNITY_BUILD}
29+
cmake .. -G Xcode -D CMAKE_UNITY_BUILD=${UNITY_BUILD}
3030
displayName: 'Generate macOS solution'
3131
3232
- task: Xcode@5

.github/jobs/uwp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- script: |
3535
mkdir build${{ variables.solutionName }}
3636
cd build${{ variables.solutionName }}
37-
cmake .. -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 ${{ variables.jsEngineDefine }} -A ${{ parameters.platform }} -DCMAKE_UNITY_BUILD=${UNITY_BUILD}
37+
cmake .. -D CMAKE_SYSTEM_NAME=WindowsStore -D CMAKE_SYSTEM_VERSION=10.0 ${{ variables.jsEngineDefine }} -A ${{ parameters.platform }} -D CMAKE_UNITY_BUILD=${UNITY_BUILD}
3838
displayName: 'Generate ${{ variables.solutionName }} solution'
3939
4040
- task: VSBuild@1

.github/jobs/win32.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- script: |
3838
mkdir build${{ variables.solutionName }}
3939
cd build${{ variables.solutionName }}
40-
cmake -A ${{ parameters.platform }} ${{ variables.jsEngineDefine }} -DBGFX_CONFIG_DEBUG=ON -DGRAPHICS_API=${{ parameters.graphics_api }} -DCMAKE_UNITY_BUILD=${UNITY_BUILD} ..
40+
cmake -A ${{ parameters.platform }} ${{ variables.jsEngineDefine }} -D BGFX_CONFIG_DEBUG=ON -D GRAPHICS_API=${{ parameters.graphics_api }} -D CMAKE_UNITY_BUILD=${UNITY_BUILD} ..
4141
displayName: 'Generate ${{ variables.solutionName }} solution'
4242
4343
- task: MSBuild@1

.gitmodules

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
[submodule "base-n"]
22
path = Dependencies/base-n
33
url = https://github.com/azawadzki/base-n
4-
[submodule "arcana.cpp"]
5-
path = Dependencies/arcana.cpp
6-
url = https://github.com/microsoft/arcana.cpp
74
[submodule "glslang"]
85
path = Dependencies/glslang
96
url = https://github.com/KhronosGroup/glslang
@@ -13,9 +10,6 @@
1310
[submodule "bgfx.cmake"]
1411
path = Dependencies/bgfx.cmake
1512
url = https://github.com/BabylonJS/bgfx.cmake
16-
[submodule "Dependencies/ios-cmake"]
17-
path = Dependencies/ios-cmake
18-
url = https://github.com/leetal/ios-cmake.git
1913
[submodule "Dependencies/xr/Dependencies/OpenXR-SDK"]
2014
path = Dependencies/xr/Dependencies/OpenXR-SDK
2115
url = https://github.com/KhronosGroup/OpenXR-SDK

Apps/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ if((WIN32 AND NOT WINDOWS_STORE) OR (APPLE AND NOT IOS) OR (UNIX AND NOT ANDROID
77
endif()
88

99
# NPM install
10-
npm(install)
10+
npm(install ${CMAKE_CURRENT_SOURCE_DIR} "Apps module")

Apps/Playground/Android/app/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ target_link_libraries(BabylonNativeJNI
5656
AppRuntime
5757
Canvas
5858
Console
59-
ChromeDevTools
6059
GraphicsDevice
6160
NativeCamera
6261
NativeEngine

Apps/Playground/Android/app/src/main/cpp/BabylonNativeJNI.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <Babylon/Plugins/NativeXr.h>
1919
#include <Babylon/Plugins/NativeCamera.h>
2020
#include <Babylon/Plugins/NativeOptimizations.h>
21-
#include <Babylon/Plugins/ChromeDevTools.h>
2221
#include <Babylon/Polyfills/Console.h>
2322
#include <Babylon/Polyfills/Window.h>
2423
#include <Babylon/Polyfills/XMLHttpRequest.h>
@@ -29,7 +28,6 @@ namespace
2928
std::optional<Babylon::Graphics::Device> device{};
3029
std::optional<Babylon::Graphics::DeviceUpdate> deviceUpdate{};
3130
std::optional<Babylon::AppRuntime> runtime{};
32-
std::optional<Babylon::Plugins::ChromeDevTools> chromeDevTools{};
3331
std::optional<Babylon::Plugins::NativeXr> nativeXr{};
3432
Babylon::Plugins::NativeInput* nativeInput{};
3533
std::optional<Babylon::Polyfills::Canvas> nativeCanvas{};
@@ -58,7 +56,6 @@ extern "C"
5856
scriptLoader.reset();
5957

6058
nativeInput = {};
61-
chromeDevTools.reset();
6259
nativeXr.reset();
6360
scriptLoader.reset();
6461
runtime.reset();
@@ -126,12 +123,6 @@ extern "C"
126123

127124
Babylon::Polyfills::XMLHttpRequest::Initialize(env);
128125
nativeCanvas.emplace(Babylon::Polyfills::Canvas::Initialize(env));
129-
130-
chromeDevTools.emplace(Babylon::Plugins::ChromeDevTools::Initialize(env));
131-
if (chromeDevTools->SupportsInspector())
132-
{
133-
chromeDevTools->StartInspector(5643, "BabylonNative Playground");
134-
}
135126
});
136127

137128
scriptLoader.emplace(*runtime);

Apps/Playground/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ set(SCRIPTS
2222
"Scripts/config.json")
2323

2424
if(APPLE)
25-
find_library(JSCORE_LIBRARY JavaScriptCore)
25+
find_library(JAVASCRIPTCORE_LIBRARY JavaScriptCore)
2626
if(IOS)
2727
set(PLIST_FILE
2828
"${CMAKE_CURRENT_LIST_DIR}/iOS/Info.plist")
@@ -54,7 +54,7 @@ if(APPLE)
5454
set_source_files_properties(${REFERENCE_IMAGES} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/ReferenceImages")
5555
endif()
5656
set(ADDITIONAL_LIBRARIES ${ADDITIONAL_LIBRARIES}
57-
PRIVATE ${JSCORE_LIBRARY}
57+
PRIVATE ${JAVASCRIPTCORE_LIBRARY}
5858
PRIVATE NativeCamera)
5959
set(RESOURCE_FILES ${STORYBOARD})
6060
elseif(UNIX)
@@ -115,7 +115,6 @@ target_include_directories(Playground PRIVATE "Source" ".")
115115
target_link_to_dependencies(Playground
116116
PRIVATE AppRuntime
117117
PRIVATE Canvas
118-
PRIVATE ChromeDevTools
119118
PRIVATE Console
120119
PRIVATE GraphicsDevice
121120
PRIVATE NativeCapture
@@ -129,10 +128,10 @@ target_link_to_dependencies(Playground
129128
${ADDITIONAL_LIBRARIES}
130129
${BABYLON_NATIVE_PLAYGROUND_EXTENSION_LIBRARIES})
131130

132-
if(WIN32)
133-
target_link_to_dependencies(Playground
134-
PRIVATE "shlwapi.lib")
135-
endif()
131+
# See https://gitlab.kitware.com/cmake/cmake/-/issues/23543
132+
# If we can set minimum required to 3.26+, then we can use the `copy -t` syntax instead.
133+
add_custom_command(TARGET Playground POST_BUILD
134+
COMMAND ${CMAKE_COMMAND} -E $<IF:$<BOOL:$<TARGET_RUNTIME_DLLS:Playground>>,copy,true> $<TARGET_RUNTIME_DLLS:Playground> $<TARGET_FILE_DIR:Playground>)
136135

137136
if (UNIX AND NOT APPLE AND NOT ANDROID)
138137
# Ubuntu mixes old experimental header and new runtime libraries
@@ -176,6 +175,7 @@ if(APPLE)
176175
RESOURCE "${RESOURCE_FILES}"
177176
FOLDER "Playground")
178177
endif()
178+
set_property(TARGET Playground PROPERTY UNITY_BUILD false)
179179
endif()
180180

181181
if(WINDOWS_STORE)

0 commit comments

Comments
 (0)