-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
28 lines (22 loc) · 1.06 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
cmake_minimum_required(VERSION 3.21)
project(nui-template VERSION 0.1.0)
# Nui Dependency
include (${CMAKE_CURRENT_LIST_DIR}/_cmake/dependencies/nui.cmake)
include (${CMAKE_CURRENT_LIST_DIR}/_cmake/common_options.cmake)
# Add executable (sources are added later, depending on frontend/backend)
add_executable(${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME} PUBLIC core-target)
set(PREJS_FILE ${CMAKE_SOURCE_DIR}/frontend/source/frontend/js/module.js)
if (EMSCRIPTEN)
add_subdirectory(${CMAKE_SOURCE_DIR}/frontend/source/frontend)
else()
add_subdirectory(${CMAKE_SOURCE_DIR}/backend/source/backend)
# If msys2, copy dynamic libraries to executable directory, visual studio does this automatically.
# And there is no need on linux.
if (DEFINED ENV{MSYSTEM})
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND bash -c "ldd $<TARGET_FILE:${PROJECT_NAME}>" | "grep" "clang" | awk "NF == 4 { system(\"${CMAKE_COMMAND} -E copy \" \$3 \" $<TARGET_FILE_DIR:${PROJECT_NAME}>\") }"
VERBATIM
)
endif()
endif()