forked from holepunchto/udx-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
81 lines (65 loc) · 1.35 KB
/
CMakeLists.txt
File metadata and controls
81 lines (65 loc) · 1.35 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
cmake_minimum_required(VERSION 3.25)
find_package(cmake-bare REQUIRED PATHS node_modules/cmake-bare)
find_package(cmake-fetch REQUIRED PATHS node_modules/cmake-fetch)
find_package(cmake-napi REQUIRED PATHS node_modules/cmake-napi)
find_package(cmake-npm REQUIRED PATHS node_modules/cmake-npm)
project(udx_native C CXX)
bare_target(target)
if(target MATCHES "win32")
add_compile_options(/MT$<$<CONFIG:Debug>:d>)
endif()
fetch_package("github:holepunchto/libudx#9536e83")
fetch_package("github:holepunchto/libjstl#098664c")
add_bare_module(udx_native_bare)
target_sources(
${udx_native_bare}
PRIVATE
binding.cc
)
target_link_libraries(
${udx_native_bare}
PRIVATE
$<TARGET_OBJECTS:udx>
jstl
PUBLIC
udx
)
if(target MATCHES "win32")
target_link_libraries(
${udx_native_bare}
PUBLIC
ws2_32
)
endif()
add_napi_module(udx_native_napi)
target_sources(
${udx_native_napi}
PRIVATE
binding.cc
)
target_compile_definitions(
${udx_native_napi}
PRIVATE
NAPI_VERSION=9
)
target_link_libraries(
${udx_native_napi}
PRIVATE
$<TARGET_OBJECTS:udx>
jstl
PUBLIC
udx
)
if(target MATCHES "win32")
target_link_libraries(
${udx_native_napi}
PUBLIC
ws2_32
)
endif()
resolve_node_module(bare-compat-napi compat)
target_include_directories(
${udx_native_napi}
PRIVATE
"${compat}/include"
)