2023-01-15 03:37:42 +08:00
|
|
|
if(NOT FTXUI_BUILD_EXAMPLES)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2021-08-01 00:32:48 +08:00
|
|
|
set(EXAMPLES_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
function(example name)
|
2021-12-23 21:17:33 +08:00
|
|
|
add_executable(ftxui_example_${name} ${name}.cpp)
|
|
|
|
target_link_libraries(ftxui_example_${name} PUBLIC ${DIRECTORY_LIB})
|
2021-08-01 00:32:48 +08:00
|
|
|
file(RELATIVE_PATH dir ${EXAMPLES_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
set_property(GLOBAL APPEND PROPERTY FTXUI::EXAMPLES ${dir}/${name})
|
2023-07-26 07:02:37 +08:00
|
|
|
target_compile_features(ftxui_example_${name} PRIVATE cxx_std_20)
|
2021-08-01 00:32:48 +08:00
|
|
|
endfunction(example)
|
|
|
|
|
2019-01-03 05:33:59 +08:00
|
|
|
add_subdirectory(component)
|
|
|
|
add_subdirectory(dom)
|
2021-03-22 07:26:52 +08:00
|
|
|
|
2024-06-26 00:36:25 +08:00
|
|
|
# Add the pixelate example
|
|
|
|
add_executable(pixelate ${CMAKE_CURRENT_SOURCE_DIR}/dom/pixelate.cpp)
|
|
|
|
target_link_libraries(pixelate PRIVATE dom)
|
|
|
|
|
2021-03-22 07:26:52 +08:00
|
|
|
if (EMSCRIPTEN)
|
2023-03-13 00:38:09 +08:00
|
|
|
string(APPEND CMAKE_EXE_LINKER_FLAGS " -s ALLOW_MEMORY_GROWTH=1")
|
|
|
|
target_link_options(component PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1")
|
2022-03-14 01:51:46 +08:00
|
|
|
|
2021-08-01 00:32:48 +08:00
|
|
|
get_property(EXAMPLES GLOBAL PROPERTY FTXUI::EXAMPLES)
|
2021-03-22 07:26:52 +08:00
|
|
|
foreach(file
|
|
|
|
"index.html"
|
2023-11-19 19:09:52 +08:00
|
|
|
"index.mjs"
|
|
|
|
"index.css"
|
2022-07-10 00:39:01 +08:00
|
|
|
"sw.js"
|
2021-08-01 00:32:48 +08:00
|
|
|
"run_webassembly.py")
|
|
|
|
configure_file(${file} ${file})
|
2021-03-22 07:26:52 +08:00
|
|
|
endforeach(file)
|
|
|
|
endif()
|