generated from NuiCpp/nui-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
57 lines (47 loc) · 1.49 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
cmake_minimum_required(VERSION 3.21)
project(nui-homepage VERSION 0.1.0)
# Nui Dependency
add_subdirectory(dependencies/Nui)
include (${CMAKE_CURRENT_LIST_DIR}/_cmake/common_options.cmake)
# add_subdirectory(examples/simple-reactive)
# Add executable (sources are added later, depending on frontend/backend)
set(PREJS_FILE ${CMAKE_SOURCE_DIR}/frontend/source/frontend/js/module.js)
if (EMSCRIPTEN)
add_executable(nui-homepage)
set_common_options(nui-homepage)
# Link frontend of nui inside of emscripten
target_link_libraries(nui-homepage PRIVATE nui-frontend fmt)
nui_prepare_emscripten_target(
TARGET
nui-homepage
PARCEL_ARGS
# --no-optimize
--dist-dir=${CMAKE_BINARY_DIR}/../bin
PREJS
${PREJS_FILE}
UNPACKED_MODE
on
EMSCRIPTEN_LINK_OPTIONS
-sEXPORTED_FUNCTIONS=_frontendMain
-O2
-sALLOW_MEMORY_GROWTH=1
# -g -sNO_DISABLE_EXCEPTION_CATCHING
# or other options, see emscripten docs.
EMSCRIPTEN_COMPILE_OPTIONS
-O3
# -g
)
add_subdirectory(${CMAKE_SOURCE_DIR}/frontend/source/frontend)
else()
add_library(nui-homepage INTERFACE)
# Creates a target that is compiled through emscripten. This target becomes the frontend part.
nui_add_emscripten_target(nui-homepage
TARGET
nui-homepage
PREJS
${PREJS_FILE}
SOURCE_DIR
${CMAKE_SOURCE_DIR}
CMAKE_OPTIONS
)
endif()