File: CMakeLists.txt

package info (click to toggle)
ftxui 5.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,084 kB
  • sloc: cpp: 23,669; xml: 211; sh: 25; javascript: 20; python: 16; makefile: 15
file content (32 lines) | stat: -rw-r--r-- 1,019 bytes parent folder | download
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
if(NOT FTXUI_BUILD_EXAMPLES)
  return()
endif()

set(EXAMPLES_DIR ${CMAKE_CURRENT_SOURCE_DIR})
function(example name)
  add_executable(ftxui_example_${name} ${name}.cpp)
  target_link_libraries(ftxui_example_${name} PRIVATE ftxui::component ftxui::dom)
  file(RELATIVE_PATH dir ${EXAMPLES_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
  set_property(GLOBAL APPEND PROPERTY FTXUI::EXAMPLES ${dir}/${name})
  target_compile_features(ftxui_example_${name} PRIVATE cxx_std_20)
  if(FTXUI_ENABLE_INSTALL)
    install(TARGETS ftxui_example_${name}
      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
  endif()
endfunction(example)

add_subdirectory(component)
add_subdirectory(dom)

if (EMSCRIPTEN)
  string(APPEND CMAKE_EXE_LINKER_FLAGS " -s ALLOW_MEMORY_GROWTH=1")
  target_link_options(component PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1")

  get_property(EXAMPLES GLOBAL PROPERTY FTXUI::EXAMPLES)
  foreach(file
      "index.html"
      "sw.js"
      "run_webassembly.py")
    configure_file(${file} ${file})
  endforeach(file)
endif()