forked from BabylonJS/BabylonNative
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
30 lines (25 loc) · 1.05 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
cmake_minimum_required(VERSION 3.12)
project(napi)
# Set per-platform defaults if no JS engine is set.
if (WIN32)
set(NAPI_JAVASCRIPT_ENGINE "Chakra" CACHE STRING "JavaScript engine for N-API.")
elseif (ANDROID)
# engine is selected in native build cmakelists.txt
elseif (APPLE)
set(NAPI_JAVASCRIPT_ENGINE "JavaScriptCore" CACHE STRING "JavaScript engine for N-API.")
elseif (UNIX)
set(NAPI_JAVASCRIPT_ENGINE "V8" CACHE STRING "JavaScript engine for N-API.")
else()
message(FATAL_ERROR "Unable to select N-API JavaScript engine for platform.")
endif()
# Check that the requested JavaScript engine is supported.
set(SUPPORTED_JAVASCRIPT_ENGINES "Chakra" "V8" "JavaScriptCore" "JSI")
if(NOT NAPI_JAVASCRIPT_ENGINE IN_LIST SUPPORTED_JAVASCRIPT_ENGINES)
message(FATAL_ERROR "Unsupported engine: ${NAPI_JAVASCRIPT_ENGINE}")
endif()
if(NAPI_JAVASCRIPT_ENGINE STREQUAL "JSI")
add_subdirectory(napi-jsi)
else()
add_subdirectory(napi-direct)
endif()
add_on_linked_as_dependency_cmake_file(napi "${CMAKE_CURRENT_SOURCE_DIR}/OnLinkedAsDependency.cmake")