-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
47 lines (37 loc) · 1.46 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
cmake_minimum_required (VERSION 3.11)
set (CMAKE_CXX_STANDARD 20)
# --- Fetch FTXUI --------------------------------------------------------------
include(FetchContent)
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
FetchContent_Declare(ftxui
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
GIT_TAG v4.0.0
)
FetchContent_GetProperties(ftxui)
if(NOT ftxui_POPULATED)
FetchContent_Populate(ftxui)
add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
# ------------------------------------------------------------------------------
project(snake
LANGUAGES CXX
VERSION 1.0.0
)
# Instead of listing each component individually, headers component is catch all. Includes all the header-only components of boost.
find_package(Boost REQUIRED COMPONENTS headers)
add_executable(snake src/main.cpp)
target_include_directories(snake PRIVATE ${Boost_INCLUDE_DIRS} src/snake_game src/external/cereal/include src/external/hana/include src/external/immer src/external/lager src/external/zug)
target_link_libraries(snake
PRIVATE ftxui::screen
PRIVATE ftxui::dom
PRIVATE ftxui::component # Not needed for this example.
${Boost_LIBRARIES}
)
if (EMSCRIPTEN)
string(APPEND CMAKE_CXX_FLAGS " -s USE_PTHREADS")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -s ASYNCIFY")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -s PROXY_TO_PTHREAD")
foreach(file "index.html" "run_webassembly.py")
configure_file("src/${file}" ${file})
endforeach(file)
endif()