Skip to content

Commit e15094d

Browse files
authored
Enable NAPI-JSI build on top of V8JSI (#832)
* Working NAPI-JSI * Use original port * Cleanup * Back out CallbackInfo change * Easier promise type fix * Simpler NativeCamera function fix * Clean up all the napi imports * Add link to source * Final PR feedback
1 parent 975bb0b commit e15094d

File tree

22 files changed

+367
-83
lines changed

22 files changed

+367
-83
lines changed

Apps/Playground/UWP/App.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ void App::Uninitialize()
125125
m_graphics->FinishRenderingCurrentFrame();
126126
}
127127

128+
m_chromeDevTools.reset();
128129
m_inputBuffer.reset();
129130
m_runtime.reset();
130131
m_graphics.reset();
@@ -294,6 +295,12 @@ void App::RestartRuntime(Windows::Foundation::Rect bounds)
294295
Babylon::Plugins::NativeXr::Initialize(env);
295296

296297
InputManager<Babylon::AppRuntime>::Initialize(env, *m_inputBuffer);
298+
299+
m_chromeDevTools = std::make_unique<Babylon::Plugins::ChromeDevTools>(Babylon::Plugins::ChromeDevTools::Initialize(env));
300+
if (m_chromeDevTools->SupportsInspector())
301+
{
302+
m_chromeDevTools->StartInspector(5643, "BabylonNative Playground");
303+
}
297304
});
298305

299306
Babylon::ScriptLoader loader{*m_runtime};

Apps/Playground/UWP/App.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <Shared/InputManager.h>
44
#include <Babylon/AppRuntime.h>
55
#include <Babylon/Graphics.h>
6+
#include <Babylon/Plugins/ChromeDevTools.h>
67

78
// Main entry point for our app. Connects the app with the Windows shell and handles application lifecycle events.
89
ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView
@@ -42,6 +43,7 @@ ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView
4243
std::unique_ptr<Babylon::Graphics> m_graphics{};
4344
std::unique_ptr<Babylon::AppRuntime> m_runtime{};
4445
std::unique_ptr<InputManager<Babylon::AppRuntime>::InputBuffer> m_inputBuffer{};
46+
std::unique_ptr<Babylon::Plugins::ChromeDevTools> m_chromeDevTools{};
4547
Windows::Foundation::Collections::IVectorView<Windows::Storage::IStorageItem^>^ m_files;
4648
bool m_windowClosed;
4749
bool m_windowVisible;

Apps/Playground/UWP/Package.appxmanifest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@
3636
<Capability Name="internetClient" />
3737
<rescap:Capability Name="broadFileSystemAccess" />
3838
<uap2:Capability Name="spatialPerception"/>
39+
<Capability Name="internetClientServer"/>
3940
</Capabilities>
4041
</Package>

Core/AppRuntime/CMakeLists.txt

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,34 @@
1-
if(NOT NAPI_JAVASCRIPT_ENGINE STREQUAL "JSI")
2-
3-
set(SOURCES
4-
"Include/Babylon/AppRuntime.h"
5-
"Source/AppRuntime.cpp"
6-
"Source/AppRuntime${NAPI_JAVASCRIPT_ENGINE}.cpp"
7-
"Source/WorkQueue.cpp"
8-
"Source/WorkQueue.h")
9-
10-
if(APPLE)
11-
set(SOURCES ${SOURCES} "Source/AppRuntime${BABYLON_NATIVE_PLATFORM}.mm")
12-
else()
13-
set(SOURCES ${SOURCES} "Source/AppRuntime${BABYLON_NATIVE_PLATFORM}.cpp")
14-
endif()
1+
set(SOURCES
2+
"Include/Babylon/AppRuntime.h"
3+
"Source/AppRuntime.cpp"
4+
"Source/AppRuntime${NAPI_JAVASCRIPT_ENGINE}.cpp"
5+
"Source/WorkQueue.cpp"
6+
"Source/WorkQueue.h")
7+
8+
if(APPLE)
9+
set(SOURCES ${SOURCES} "Source/AppRuntime${BABYLON_NATIVE_PLATFORM}.mm")
10+
else()
11+
set(SOURCES ${SOURCES} "Source/AppRuntime${BABYLON_NATIVE_PLATFORM}.cpp")
12+
endif()
1513

16-
add_library(AppRuntime ${SOURCES})
17-
warnings_as_errors(AppRuntime)
14+
add_library(AppRuntime ${SOURCES})
15+
warnings_as_errors(AppRuntime)
1816

19-
target_include_directories(AppRuntime
20-
PRIVATE "Include/Babylon"
21-
INTERFACE "Include")
17+
target_include_directories(AppRuntime
18+
PRIVATE "Include/Babylon"
19+
INTERFACE "Include")
2220

23-
if(UNIX AND NOT APPLE AND NOT ANDROID)
24-
target_include_directories(AppRuntime INTERFACE "/usr/include/webkitgtk-4.0/")
25-
endif()
21+
if(UNIX AND NOT APPLE AND NOT ANDROID)
22+
target_include_directories(AppRuntime INTERFACE "/usr/include/webkitgtk-4.0/")
23+
endif()
2624

27-
target_link_to_dependencies(AppRuntime
28-
PRIVATE arcana
29-
PUBLIC JsRuntime)
25+
target_link_to_dependencies(AppRuntime
26+
PRIVATE arcana
27+
PUBLIC JsRuntime)
3028

31-
target_compile_definitions(AppRuntime
32-
PRIVATE NOMINMAX)
29+
target_compile_definitions(AppRuntime
30+
PRIVATE NOMINMAX)
3331

34-
set_property(TARGET AppRuntime PROPERTY FOLDER Core)
35-
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
32+
set_property(TARGET AppRuntime PROPERTY FOLDER Core)
33+
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
3634

37-
endif()
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#include "AppRuntime.h"
2+
#include "WorkQueue.h"
3+
4+
#include <napi/env.h>
5+
#include <V8JsiRuntime.h>
6+
#include <ScriptStore.h>
7+
8+
namespace
9+
{
10+
class TaskRunnerAdapter : public v8runtime::JSITaskRunner
11+
{
12+
public:
13+
TaskRunnerAdapter(Babylon::WorkQueue& workQueue)
14+
: m_workQueue(workQueue)
15+
{
16+
}
17+
18+
void postTask(std::unique_ptr<v8runtime::JSITask> task) override
19+
{
20+
std::shared_ptr<v8runtime::JSITask> shared_task(task.release());
21+
m_workQueue.Append([shared_task2 = std::move(shared_task)](Napi::Env) {
22+
shared_task2->run();
23+
});
24+
}
25+
26+
private:
27+
TaskRunnerAdapter(const TaskRunnerAdapter&) = delete;
28+
TaskRunnerAdapter& operator=(const TaskRunnerAdapter&) = delete;
29+
30+
Babylon::WorkQueue& m_workQueue;
31+
};
32+
}
33+
34+
namespace Babylon
35+
{
36+
void AppRuntime::RunEnvironmentTier(const char*)
37+
{
38+
v8runtime::V8RuntimeArgs args{};
39+
args.inspectorPort = 5643;
40+
args.foreground_task_runner = std::make_shared<TaskRunnerAdapter>(*m_workQueue);
41+
42+
const auto runtime{v8runtime::makeV8Runtime(std::move(args))};
43+
const auto env{Napi::Attach<facebook::jsi::Runtime&>(*runtime)};
44+
Dispatch([&runtime](Napi::Env env) {
45+
JsRuntime::NativeObject::GetFromJavaScript(env)
46+
.Set("_JSIRuntime", Napi::External<facebook::jsi::Runtime>::New(env, runtime.get()));
47+
});
48+
Run(env);
49+
Napi::Detach(env);
50+
}
51+
}

Dependencies/CMakeExtensions/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,20 @@ function(set_win32_arch)
123123
else()
124124
message(FATAL_ERROR "Unrecognized compiler: ${CMAKE_CXX_COMPILER}")
125125
endif()
126+
endfunction()
127+
128+
# Uses the nuget.config and packages.config files in the current directory to download packages from NuGet.
129+
# NUGET_PATH will be set to the directory where the packages are installed.
130+
function (download_nuget)
131+
set(NUGET_PATH "${CMAKE_BINARY_DIR}/NuGet")
132+
set(NUGET_PATH "${NUGET_PATH}" PARENT_SCOPE)
133+
set(NUGET_EXE "${NUGET_PATH}/nuget.exe")
134+
if(NOT EXISTS ${NUGET_EXE})
135+
file(DOWNLOAD "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" ${NUGET_EXE})
136+
endif()
137+
file(COPY "nuget.config" DESTINATION ${NUGET_PATH})
138+
file(COPY "packages.config" DESTINATION ${NUGET_PATH})
139+
140+
execute_process(COMMAND ${NUGET_EXE} restore WORKING_DIRECTORY ${NUGET_PATH})
141+
execute_process(COMMAND ${NUGET_EXE} install WORKING_DIRECTORY ${NUGET_PATH})
126142
endfunction()

Dependencies/napi/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ if(NAPI_JAVASCRIPT_ENGINE STREQUAL "JSI")
2626
else()
2727
add_subdirectory(napi-direct)
2828
endif()
29+
30+
add_on_linked_as_dependency_cmake_file(napi "${CMAKE_CURRENT_SOURCE_DIR}/OnLinkedAsDependency.cmake")
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
# Callback to perform custom behavior -- in this case, copying runtime output artifacts like DLLs -- when
22
# linked from an executable target as a library.
33
function(on_linked_as_dependency target)
4-
# We only have to do anything if the JavaScript engine is V8.
5-
if (NAPI_JAVASCRIPT_ENGINE STREQUAL "V8")
6-
7-
# Propagate this file to the target so that it will be transitively available to targets that
8-
# link to that one, too.
9-
propagate_on_linked_as_dependency_cmake_file(napi ${target})
10-
4+
# Propagate this file to the target so that it will be transitively available to targets that
5+
# link to that one, too.
6+
propagate_on_linked_as_dependency_cmake_file(napi ${target})
7+
if (DEFINED NAPI_JAVASCRIPT_RUNTIME_OUTPUT_ARTIFACTS)
118
# We only need to actually copy files if we're being linked from an executable.
129
get_target_property(type ${target} TYPE)
1310
if(${type} STREQUAL "EXECUTABLE")
1411
if (WINDOWS_STORE)
1512
# WINDOWS_STORE allows us to use the VS_DEPLOYMENT_CONTENT property.
1613
target_sources(${target} PRIVATE ${NAPI_JAVASCRIPT_RUNTIME_OUTPUT_ARTIFACTS})
17-
set_property(SOURCE ${NAPI_JAVASCRIPT_RUNTIME_OUTPUT_ARTIFACTS} PROPERTY VS_DEPLOYMENT_CONTENT 1)
14+
15+
if ((DEFINED NAPI_JAVASCRIPT_RUNTIME_OUTPUT_ARTIFACTS_DEBUG) AND (DEFINED NAPI_JAVASCRIPT_RUNTIME_OUTPUT_ARTIFACTS_RELEASE))
16+
set_property(SOURCE ${NAPI_JAVASCRIPT_RUNTIME_OUTPUT_ARTIFACTS_DEBUG} PROPERTY VS_DEPLOYMENT_CONTENT $<CONFIG:Debug>)
17+
set_property(SOURCE ${NAPI_JAVASCRIPT_RUNTIME_OUTPUT_ARTIFACTS_RELEASE} PROPERTY VS_DEPLOYMENT_CONTENT $<NOT:$<CONFIG:Debug>>)
18+
else()
19+
set_property(SOURCE ${NAPI_JAVASCRIPT_RUNTIME_OUTPUT_ARTIFACTS} PROPERTY VS_DEPLOYMENT_CONTENT 1)
20+
endif()
21+
1822
set_property(SOURCE ${NAPI_JAVASCRIPT_RUNTIME_OUTPUT_ARTIFACTS} PROPERTY VS_DEPLOYMENT_LOCATION ".")
1923
else()
2024
# Without the VS_DEPLOYMENT_CONTENT property, create custom rules to copy the artifacts.
2125
foreach(artifact ${NAPI_JAVASCRIPT_RUNTIME_OUTPUT_ARTIFACTS})
2226
add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${artifact} $<TARGET_FILE_DIR:${target}>)
23-
endforeach(artifact)
27+
endforeach()
2428
endif()
2529
endif()
2630
endif()
27-
endfunction()
31+
endfunction()

Dependencies/napi/napi-direct/CMakeLists.txt

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,32 @@ target_include_directories(napi PUBLIC "include")
2828

2929
# Install v8 SDK from NuGet
3030
function (install_v8_nuget V8_VERSION ARCH VS_PLAT_TOOLSET)
31-
set(NUGET_PATH "${CMAKE_BINARY_DIR}/NuGet")
32-
set(NUGET_EXE "${NUGET_PATH}/nuget.exe")
33-
if(NOT EXISTS ${NUGET_EXE})
34-
file(DOWNLOAD "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" ${NUGET_EXE})
35-
endif()
36-
file(COPY "packages.config" DESTINATION ${NUGET_PATH})
37-
execute_process(COMMAND ${NUGET_EXE} install WORKING_DIRECTORY ${NUGET_PATH})
31+
download_nuget()
32+
set(V8_PACKAGE_PATH "${NUGET_PATH}/packages/v8-${VS_PLAT_TOOLSET}-${ARCH}.${V8_VERSION}")
33+
set(V8_REDIST_PACKAGE_PATH "${NUGET_PATH}/packages/v8.redist-${VS_PLAT_TOOLSET}-${ARCH}.${V8_VERSION}")
34+
3835
add_library(v8_libbase SHARED IMPORTED)
39-
set_target_properties(v8_libbase PROPERTIES IMPORTED_IMPLIB "${NUGET_PATH}/v8-${VS_PLAT_TOOLSET}-${ARCH}.${V8_VERSION}/lib/Release/v8_libbase.dll.lib")
36+
set_target_properties(v8_libbase PROPERTIES IMPORTED_IMPLIB "${V8_PACKAGE_PATH}/lib/Release/v8_libbase.dll.lib")
4037
add_library(v8_libplatform SHARED IMPORTED)
41-
set_target_properties(v8_libplatform PROPERTIES IMPORTED_IMPLIB "${NUGET_PATH}/v8-${VS_PLAT_TOOLSET}-${ARCH}.${V8_VERSION}/lib/Release/v8_libplatform.dll.lib")
38+
set_target_properties(v8_libplatform PROPERTIES IMPORTED_IMPLIB "${V8_PACKAGE_PATH}/lib/Release/v8_libplatform.dll.lib")
4239
add_library(v8 SHARED IMPORTED)
43-
set_target_properties(v8 PROPERTIES IMPORTED_IMPLIB "${NUGET_PATH}/v8-${VS_PLAT_TOOLSET}-${ARCH}.${V8_VERSION}/lib/Release/v8.dll.lib")
40+
set_target_properties(v8 PROPERTIES IMPORTED_IMPLIB "${V8_PACKAGE_PATH}/lib/Release/v8.dll.lib")
4441
target_link_libraries(v8 INTERFACE v8_libbase INTERFACE v8_libplatform)
45-
target_include_directories(v8 INTERFACE "${NUGET_PATH}/v8-${VS_PLAT_TOOLSET}-${ARCH}.${V8_VERSION}/include")
42+
target_include_directories(v8 INTERFACE "${V8_PACKAGE_PATH}/include")
4643

4744
set(NAPI_JAVASCRIPT_RUNTIME_OUTPUT_ARTIFACTS
48-
"${NUGET_PATH}/v8.redist-${VS_PLAT_TOOLSET}-${ARCH}.${V8_VERSION}/lib/Release/icudtl.dat"
49-
"${NUGET_PATH}/v8.redist-${VS_PLAT_TOOLSET}-${ARCH}.${V8_VERSION}/lib/Release/icui18n.dll"
50-
"${NUGET_PATH}/v8.redist-${VS_PLAT_TOOLSET}-${ARCH}.${V8_VERSION}/lib/Release/icuuc.dll"
51-
"${NUGET_PATH}/v8.redist-${VS_PLAT_TOOLSET}-${ARCH}.${V8_VERSION}/lib/Release/v8.dll"
52-
"${NUGET_PATH}/v8.redist-${VS_PLAT_TOOLSET}-${ARCH}.${V8_VERSION}/lib/Release/v8_libbase.dll"
53-
"${NUGET_PATH}/v8.redist-${VS_PLAT_TOOLSET}-${ARCH}.${V8_VERSION}/lib/Release/v8_libplatform.dll"
54-
"${NUGET_PATH}/v8.redist-${VS_PLAT_TOOLSET}-${ARCH}.${V8_VERSION}/lib/Release/zlib.dll"
45+
"${V8_REDIST_PACKAGE_PATH}/lib/Release/icudtl.dat"
46+
"${V8_REDIST_PACKAGE_PATH}/lib/Release/icui18n.dll"
47+
"${V8_REDIST_PACKAGE_PATH}/lib/Release/icuuc.dll"
48+
"${V8_REDIST_PACKAGE_PATH}/lib/Release/v8.dll"
49+
"${V8_REDIST_PACKAGE_PATH}/lib/Release/v8_libbase.dll"
50+
"${V8_REDIST_PACKAGE_PATH}/lib/Release/v8_libplatform.dll"
51+
"${V8_REDIST_PACKAGE_PATH}/lib/Release/zlib.dll"
5552
CACHE STRING "N-API runtime output artifacts")
5653
endfunction()
5754

5855
if(NOT TARGET javascript_engine)
5956
add_library(javascript_engine INTERFACE)
60-
add_on_linked_as_dependency_cmake_file(napi "${CMAKE_CURRENT_SOURCE_DIR}/OnLinkedAsDependency.cmake")
6157
if(NAPI_JAVASCRIPT_ENGINE STREQUAL "V8")
6258
if(WIN32)
6359
set_win32_arch()

Dependencies/napi/napi-direct/include/napi/napi-inl.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,6 +1781,27 @@ inline Value Function::Call(napi_value recv, const std::vector<napi_value>& args
17811781
return Call(recv, args.size(), args.data());
17821782
}
17831783

1784+
inline Value Function::Call(napi_value recv,
1785+
size_t argc,
1786+
const Value* args) const {
1787+
const size_t stackArgsCount = 6;
1788+
napi_value stackArgs[stackArgsCount];
1789+
std::vector<napi_value> heapArgs;
1790+
napi_value* argv;
1791+
if (argc <= stackArgsCount) {
1792+
argv = stackArgs;
1793+
} else {
1794+
heapArgs.resize(argc);
1795+
argv = heapArgs.data();
1796+
}
1797+
1798+
for (size_t index = 0; index < argc; index++) {
1799+
argv[index] = static_cast<napi_value>(args[index]);
1800+
}
1801+
1802+
return Call(recv, argc, argv);
1803+
}
1804+
17841805
inline Value Function::Call(napi_value recv, size_t argc, const napi_value* args) const {
17851806
napi_value result;
17861807
napi_status status = napi_call_function(

Dependencies/napi/napi-direct/include/napi/napi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,7 @@ namespace Napi {
10131013
Value Call(size_t argc, const napi_value* args) const;
10141014
Value Call(napi_value recv, const std::initializer_list<napi_value>& args) const;
10151015
Value Call(napi_value recv, const std::vector<napi_value>& args) const;
1016+
Value Call(napi_value recv, size_t argc, const Napi::Value* args) const;
10161017
Value Call(napi_value recv, size_t argc, const napi_value* args) const;
10171018

10181019
#ifndef NODE_ADDON_API_DISABLE_NODE_SPECIFIC
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<config>
4+
<add key="repositoryPath" value="packages" />
5+
</config>
6+
<packageSources>
7+
<clear />
8+
<add key="Nuget.org" value="https://api.nuget.org/v3/index.json" />
9+
</packageSources>
10+
<disabledPackageSources>
11+
<clear />
12+
</disabledPackageSources>
13+
</configuration>

Dependencies/napi/napi-jsi/CMakeLists.txt

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
if(NOT TARGET jsi)
2-
message(FATAL_ERROR "jsi target is required")
3-
endif()
4-
51
set(SOURCES
62
"include/napi/env.h"
73
"include/napi/napi.h"
@@ -10,7 +6,52 @@ set(SOURCES
106

117
add_library(napi ${SOURCES})
128

13-
target_include_directories(napi
9+
if(NOT TARGET jsi)
10+
if(WIN32)
11+
download_nuget()
12+
set_win32_arch()
13+
set(V8JSI_VERSION "0.64.16")
14+
if (WINDOWS_STORE)
15+
set(V8JSI_PACKAGE_PATH "${NUGET_PATH}/packages/ReactNative.V8Jsi.Windows.UWP.${V8JSI_VERSION}")
16+
set(PLATFORM_FOLDER "uwp")
17+
else()
18+
set(V8JSI_PACKAGE_PATH "${NUGET_PATH}/packages/ReactNative.V8Jsi.Windows.${V8JSI_VERSION}")
19+
set(PLATFORM_FOLDER "win32")
20+
endif()
21+
22+
# TODO: Pull in v8jsi symbols once they're packaged with the debug build.
23+
set(V8JSI_LIB_PATH_DEBUG "${V8JSI_PACKAGE_PATH}/lib/${PLATFORM_FOLDER}/Debug/${WIN32_ARCH}/v8jsi.dll.lib")
24+
set(V8JSI_LIB_PATH_RELEASE "${V8JSI_PACKAGE_PATH}/lib/${PLATFORM_FOLDER}/Release/${WIN32_ARCH}/v8jsi.dll.lib")
25+
set(V8JSI_DLL_PATH "${V8JSI_PACKAGE_PATH}/lib/${PLATFORM_FOLDER}/$<IF:$<CONFIG:Debug>,Debug,Release>/${WIN32_ARCH}/v8jsi.dll")
26+
set(V8JSI_DLL_PATH_DEBUG "${V8JSI_PACKAGE_PATH}/lib/${PLATFORM_FOLDER}/Debug/${WIN32_ARCH}/v8jsi.dll")
27+
set(V8JSI_DLL_PATH_RELEASE "${V8JSI_PACKAGE_PATH}/lib/${PLATFORM_FOLDER}/Release/${WIN32_ARCH}/v8jsi.dll")
28+
29+
add_library(v8jsi SHARED IMPORTED)
30+
set_target_properties(v8jsi PROPERTIES
31+
IMPORTED_IMPLIB_DEBUG ${V8JSI_LIB_PATH_DEBUG}
32+
IMPORTED_IMPLIB_RELEASE ${V8JSI_LIB_PATH_RELEASE}
33+
IMPORTED_IMPLIB_MINSIZEREL ${V8JSI_LIB_PATH_RELEASE}
34+
IMPORTED_IMPLIB_RELWITHDEBINFO ${V8JSI_LIB_PATH_RELEASE})
35+
36+
target_include_directories(v8jsi INTERFACE "${V8JSI_PACKAGE_PATH}/build/native/include")
37+
target_include_directories(v8jsi INTERFACE "${V8JSI_PACKAGE_PATH}/build/native/jsi")
38+
set(NAPI_JAVASCRIPT_RUNTIME_OUTPUT_ARTIFACTS_DEBUG ${V8JSI_DLL_PATH_DEBUG} CACHE STRING "N-API runtime output artifacts (debug)")
39+
set(NAPI_JAVASCRIPT_RUNTIME_OUTPUT_ARTIFACTS_RELEASE ${V8JSI_DLL_PATH_RELEASE} CACHE STRING "N-API runtime output artifacts (release)")
40+
set(NAPI_JAVASCRIPT_RUNTIME_OUTPUT_ARTIFACTS ${V8JSI_DLL_PATH} CACHE STRING "N-API runtime output artifacts")
41+
target_compile_definitions(v8jsi INTERFACE V8JSI_ENABLE_INSPECTOR)
42+
43+
add_library(jsi "${V8JSI_PACKAGE_PATH}/build/native/jsi/jsi/jsi.cpp")
44+
target_include_directories(jsi
45+
PUBLIC "${V8JSI_PACKAGE_PATH}/build/native/include"
46+
PUBLIC "${V8JSI_PACKAGE_PATH}/build/native/jsi")
47+
target_link_libraries(jsi PUBLIC v8jsi)
48+
set_property(TARGET jsi PROPERTY FOLDER Dependencies)
49+
else()
50+
message(FATAL_ERROR "jsi target is required")
51+
endif()
52+
endif()
53+
54+
target_include_directories(napi
1455
PUBLIC "include")
1556

1657
target_link_to_dependencies(napi

0 commit comments

Comments
 (0)