@@ -157,13 +157,6 @@ endif()
157157
158158message (STATUS "NS_FFI_BACKEND = ${NS_FFI_BACKEND} (${NS_EFFECTIVE_FFI_BACKEND} )" )
159159
160- if (NS_EFFECTIVE_FFI_BACKEND STREQUAL "direct" AND
161- NOT (NS_GSD_BACKEND STREQUAL "auto" OR NS_GSD_BACKEND STREQUAL "none" ))
162- message (FATAL_ERROR
163- "NS_GSD_BACKEND is only used by the Node-API FFI backend. "
164- "Use NS_GSD_BACKEND=auto or none with NS_FFI_BACKEND=direct." )
165- endif ()
166-
167160if (NS_GSD_BACKEND STREQUAL "auto" )
168161 if (NS_EFFECTIVE_FFI_BACKEND STREQUAL "direct" )
169162 set (NS_EFFECTIVE_GSD_BACKEND "none" )
@@ -200,6 +193,12 @@ if(NS_EFFECTIVE_FFI_BACKEND STREQUAL "napi" AND
200193 "NS_FFI_BACKEND=napi is the pure Node-API FFI backend and only supports "
201194 "NS_GSD_BACKEND=napi or none." )
202195endif ()
196+ if (NS_EFFECTIVE_FFI_BACKEND STREQUAL "direct" AND
197+ NS_EFFECTIVE_GSD_BACKEND STREQUAL "napi" )
198+ message (FATAL_ERROR
199+ "NS_FFI_BACKEND=direct cannot use NS_GSD_BACKEND=napi. "
200+ "Use the matching engine backend or none." )
201+ endif ()
203202
204203message (STATUS "NS_GSD_BACKEND = ${NS_GSD_BACKEND} (${NS_EFFECTIVE_GSD_BACKEND} )" )
205204
@@ -240,12 +239,12 @@ set(FFI_NAPI_SOURCE_FILES
240239)
241240
242241set (FFI_DIRECT_SHARED_SOURCE_FILES
243- ffi/shared/ direct/EmbeddedMetadata.mm
242+ ffi/direct/EmbeddedMetadata.mm
244243)
245244
246245set (FFI_HERMES_DIRECT_SOURCE_FILES
247246 ${FFI_DIRECT_SHARED_SOURCE_FILES}
248- ffi/hermes/jsi/ NativeApiJsi.mm
247+ ffi/hermes/NativeApiJsi.mm
249248)
250249
251250set (FFI_V8_DIRECT_SOURCE_FILES
@@ -516,15 +515,31 @@ set(NS_GSD_BACKEND_JSC_VALUE 0)
516515set (NS_GSD_BACKEND_QUICKJS_VALUE 0)
517516set (NS_GSD_BACKEND_HERMES_VALUE 0)
518517set (NS_GSD_BACKEND_NAPI_VALUE 0)
518+ set (NS_GSD_BACKEND_ENGINE_DIRECT_VALUE 0)
519+ set (NS_GSD_BACKEND_DIRECT_PREPARED_VALUE 0)
519520set (NS_FFI_BACKEND_DIRECT_VALUE 0)
520521set (NS_FFI_BACKEND_NAPI_VALUE 0)
521522
522523if (NS_EFFECTIVE_GSD_BACKEND STREQUAL "v8" )
523- set (NS_GSD_BACKEND_V8_VALUE 1)
524+ if (NS_EFFECTIVE_FFI_BACKEND STREQUAL "direct" )
525+ set (NS_GSD_BACKEND_DIRECT_PREPARED_VALUE 1)
526+ else ()
527+ set (NS_GSD_BACKEND_V8_VALUE 1)
528+ endif ()
524529elseif (NS_EFFECTIVE_GSD_BACKEND STREQUAL "jsc" )
525- set (NS_GSD_BACKEND_JSC_VALUE 1)
530+ if (NS_EFFECTIVE_FFI_BACKEND STREQUAL "direct" )
531+ set (NS_GSD_BACKEND_DIRECT_PREPARED_VALUE 1)
532+ else ()
533+ set (NS_GSD_BACKEND_JSC_VALUE 1)
534+ set (NS_GSD_BACKEND_ENGINE_DIRECT_VALUE 1)
535+ endif ()
526536elseif (NS_EFFECTIVE_GSD_BACKEND STREQUAL "quickjs" )
527- set (NS_GSD_BACKEND_QUICKJS_VALUE 1)
537+ if (NS_EFFECTIVE_FFI_BACKEND STREQUAL "direct" )
538+ set (NS_GSD_BACKEND_DIRECT_PREPARED_VALUE 1)
539+ else ()
540+ set (NS_GSD_BACKEND_QUICKJS_VALUE 1)
541+ set (NS_GSD_BACKEND_ENGINE_DIRECT_VALUE 1)
542+ endif ()
528543elseif (NS_EFFECTIVE_GSD_BACKEND STREQUAL "hermes" )
529544 set (NS_GSD_BACKEND_HERMES_VALUE 1)
530545elseif (NS_EFFECTIVE_GSD_BACKEND STREQUAL "napi" )
@@ -543,6 +558,8 @@ target_compile_definitions(${NAME} PRIVATE
543558 NS_GSD_BACKEND_QUICKJS=${NS_GSD_BACKEND_QUICKJS_VALUE}
544559 NS_GSD_BACKEND_HERMES=${NS_GSD_BACKEND_HERMES_VALUE}
545560 NS_GSD_BACKEND_NAPI=${NS_GSD_BACKEND_NAPI_VALUE}
561+ NS_GSD_BACKEND_ENGINE_DIRECT=${NS_GSD_BACKEND_ENGINE_DIRECT_VALUE}
562+ NS_GSD_BACKEND_DIRECT_PREPARED=${NS_GSD_BACKEND_DIRECT_PREPARED_VALUE}
546563 NS_FFI_BACKEND_DIRECT=${NS_FFI_BACKEND_DIRECT_VALUE}
547564 NS_FFI_BACKEND_NAPI=${NS_FFI_BACKEND_NAPI_VALUE}
548565)
0 commit comments