-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
31 lines (27 loc) · 1.11 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
31
project(bun-ui)
if(CMAKE_JS_VERSION)
set(CMAKE_CXX_STANDARD 17)
add_library(bun-ui SHARED src/la.c src/bun-ui.c src/glad.c src/node_api.cc ${CMAKE_JS_SRC})
else()
set(CMAKE_C_STANDARD 11)
add_library(bun-ui SHARED src/la.c src/bun-ui.c src/glad.c)
endif()
add_subdirectory(third-party/glfw)
target_include_directories(bun-ui PRIVATE third-party/glfw/include)
target_link_libraries(bun-ui PUBLIC glfw)
if(CMAKE_JS_VERSION)
include_directories(${CMAKE_JS_INC})
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB})
# Include Node-API wrappers
execute_process(COMMAND node -p "require('node-addon-api').include"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE NODE_ADDON_API_DIR
)
message("${NODE_ADDON_API_DIR}")
string(REGEX REPLACE "[\r\n\"]" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${NODE_ADDON_API_DIR})
# define NAPI_VERSION
add_definitions(-DNAPI_VERSION=3)
add_definitions(-DBUN_UI_NODE_INTEGRATION)
endif()