-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
79 lines (66 loc) · 1.26 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
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
cmake_minimum_required(VERSION 3.25)
project(
hello_bare
LANGUAGES C CXX
)
include(bare)
bare_target(target)
add_subdirectory(vendor/bare EXCLUDE_FROM_ALL)
add_bare_bundle(
ENTRY bare/main.js
OUT bare/bundle.js.h
CONFIG bare/bundle.config.js
)
add_library(
hello_bare
STATIC
bare/hello-bare.cc
bare/bundle.js.h
)
set_target_properties(
hello_bare
PROPERTIES
C_STANDARD 11
CXX_STANDARD 20
POSITION_INDEPENDENT_CODE ON
)
target_include_directories(
hello_bare
PRIVATE
$<TARGET_PROPERTY:bare,INTERFACE_INCLUDE_DIRECTORIES>
vendor/concurrentqueue
)
target_link_libraries(
hello_bare
PRIVATE
$<LINK_LIBRARY:WHOLE_ARCHIVE,bare_static>
)
# add native addons objects to the library
if(target MATCHES "ios" OR target MATCHES "android")
link_bare_modules(hello_bare AMALGAMATE)
endif()
if(target MATCHES "android")
set(artefacts android/${CMAKE_ANDROID_ARCH_ABI})
endif()
if(target MATCHES "ios")
if(target MATCHES "simulator")
set(artefacts ios/iphonesimulator)
else()
set(artefacts ios/iphoneos)
endif()
endif()
if(DEFINED artefacts)
install(
FILES
$<TARGET_FILE:hello_bare>
$<TARGET_FILE:bare_static>
${v8}
${js}
DESTINATION ${artefacts}
)
install(
FILES
${c++}
DESTINATION ${artefacts}/misc
)
endif()