Skip to content
Open
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ packages/*/types
SwiftBindgen

# Generated Objective-C/C dispatch wrappers
NativeScript/ffi/napi/GeneratedSignatureDispatch.inc
NativeScript/ffi/napi/GeneratedSignatureDispatch.inc.stamp
NativeScript/ffi/*/GeneratedSignatureDispatch.inc
NativeScript/ffi/*/GeneratedSignatureDispatch.inc.stamp

# React Native TurboModule package staging
packages/react-native/dist/
Expand Down
41 changes: 29 additions & 12 deletions NativeScript/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,6 @@ endif()

message(STATUS "NS_FFI_BACKEND = ${NS_FFI_BACKEND} (${NS_EFFECTIVE_FFI_BACKEND})")

if(NS_EFFECTIVE_FFI_BACKEND STREQUAL "direct" AND
NOT (NS_GSD_BACKEND STREQUAL "auto" OR NS_GSD_BACKEND STREQUAL "none"))
message(FATAL_ERROR
"NS_GSD_BACKEND is only used by the Node-API FFI backend. "
"Use NS_GSD_BACKEND=auto or none with NS_FFI_BACKEND=direct.")
endif()

if(NS_GSD_BACKEND STREQUAL "auto")
if(NS_EFFECTIVE_FFI_BACKEND STREQUAL "direct")
set(NS_EFFECTIVE_GSD_BACKEND "none")
Expand Down Expand Up @@ -200,6 +193,12 @@ if(NS_EFFECTIVE_FFI_BACKEND STREQUAL "napi" AND
"NS_FFI_BACKEND=napi is the pure Node-API FFI backend and only supports "
"NS_GSD_BACKEND=napi or none.")
endif()
if(NS_EFFECTIVE_FFI_BACKEND STREQUAL "direct" AND
NS_EFFECTIVE_GSD_BACKEND STREQUAL "napi")
message(FATAL_ERROR
"NS_FFI_BACKEND=direct cannot use NS_GSD_BACKEND=napi. "
"Use the matching engine backend or none.")
endif()

message(STATUS "NS_GSD_BACKEND = ${NS_GSD_BACKEND} (${NS_EFFECTIVE_GSD_BACKEND})")

Expand Down Expand Up @@ -240,12 +239,12 @@ set(FFI_NAPI_SOURCE_FILES
)

set(FFI_DIRECT_SHARED_SOURCE_FILES
ffi/shared/direct/EmbeddedMetadata.mm
ffi/direct/EmbeddedMetadata.mm
)

set(FFI_HERMES_DIRECT_SOURCE_FILES
${FFI_DIRECT_SHARED_SOURCE_FILES}
ffi/hermes/jsi/NativeApiJsi.mm
ffi/hermes/NativeApiJsi.mm
)

set(FFI_V8_DIRECT_SOURCE_FILES
Expand Down Expand Up @@ -516,15 +515,31 @@ set(NS_GSD_BACKEND_JSC_VALUE 0)
set(NS_GSD_BACKEND_QUICKJS_VALUE 0)
set(NS_GSD_BACKEND_HERMES_VALUE 0)
set(NS_GSD_BACKEND_NAPI_VALUE 0)
set(NS_GSD_BACKEND_ENGINE_DIRECT_VALUE 0)
set(NS_GSD_BACKEND_DIRECT_PREPARED_VALUE 0)
set(NS_FFI_BACKEND_DIRECT_VALUE 0)
set(NS_FFI_BACKEND_NAPI_VALUE 0)

if(NS_EFFECTIVE_GSD_BACKEND STREQUAL "v8")
set(NS_GSD_BACKEND_V8_VALUE 1)
if(NS_EFFECTIVE_FFI_BACKEND STREQUAL "direct")
set(NS_GSD_BACKEND_DIRECT_PREPARED_VALUE 1)
else()
set(NS_GSD_BACKEND_V8_VALUE 1)
endif()
elseif(NS_EFFECTIVE_GSD_BACKEND STREQUAL "jsc")
set(NS_GSD_BACKEND_JSC_VALUE 1)
if(NS_EFFECTIVE_FFI_BACKEND STREQUAL "direct")
set(NS_GSD_BACKEND_DIRECT_PREPARED_VALUE 1)
else()
set(NS_GSD_BACKEND_JSC_VALUE 1)
set(NS_GSD_BACKEND_ENGINE_DIRECT_VALUE 1)
endif()
elseif(NS_EFFECTIVE_GSD_BACKEND STREQUAL "quickjs")
set(NS_GSD_BACKEND_QUICKJS_VALUE 1)
if(NS_EFFECTIVE_FFI_BACKEND STREQUAL "direct")
set(NS_GSD_BACKEND_DIRECT_PREPARED_VALUE 1)
else()
set(NS_GSD_BACKEND_QUICKJS_VALUE 1)
set(NS_GSD_BACKEND_ENGINE_DIRECT_VALUE 1)
endif()
elseif(NS_EFFECTIVE_GSD_BACKEND STREQUAL "hermes")
set(NS_GSD_BACKEND_HERMES_VALUE 1)
elseif(NS_EFFECTIVE_GSD_BACKEND STREQUAL "napi")
Expand All @@ -543,6 +558,8 @@ target_compile_definitions(${NAME} PRIVATE
NS_GSD_BACKEND_QUICKJS=${NS_GSD_BACKEND_QUICKJS_VALUE}
NS_GSD_BACKEND_HERMES=${NS_GSD_BACKEND_HERMES_VALUE}
NS_GSD_BACKEND_NAPI=${NS_GSD_BACKEND_NAPI_VALUE}
NS_GSD_BACKEND_ENGINE_DIRECT=${NS_GSD_BACKEND_ENGINE_DIRECT_VALUE}
NS_GSD_BACKEND_DIRECT_PREPARED=${NS_GSD_BACKEND_DIRECT_PREPARED_VALUE}
NS_FFI_BACKEND_DIRECT=${NS_FFI_BACKEND_DIRECT_VALUE}
NS_FFI_BACKEND_NAPI=${NS_FFI_BACKEND_NAPI_VALUE}
)
Expand Down
Loading
Loading