mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-22 18:59:59 +08:00
Cleanup. (#132)
- Split the large CMakeList. - Remove travis - Remove gitlab-ci.yml
This commit is contained in:
parent
2ea480f4f6
commit
a2e7ff852e
@ -1,11 +0,0 @@
|
|||||||
image: registry.gitlab.com/nxxm/nxxm/ci/ubuntu-cpp:latest
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- build
|
|
||||||
|
|
||||||
build-wasm:
|
|
||||||
stage: build
|
|
||||||
image: registry.gitlab.com/nxxm/nxxm/ci/ubuntu-cpp:latest
|
|
||||||
script:
|
|
||||||
- nxxm . --verbose
|
|
||||||
|
|
40
.travis.yml
40
.travis.yml
@ -1,40 +0,0 @@
|
|||||||
sudo: false
|
|
||||||
|
|
||||||
language:
|
|
||||||
- cpp
|
|
||||||
|
|
||||||
script:
|
|
||||||
- mkdir build
|
|
||||||
- cd build
|
|
||||||
- cmake .. -DFTXUI_BUILD_TESTS=ON
|
|
||||||
- cmake --build .
|
|
||||||
- "${FTXUI_TEST_EXE}"
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
email: false
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
include:
|
|
||||||
# Ubuntu
|
|
||||||
- os: linux
|
|
||||||
dist: bionic
|
|
||||||
compiler: gcc
|
|
||||||
env:
|
|
||||||
- FTXUI_TEST_EXE="./tests --gtest_color=yes"
|
|
||||||
|
|
||||||
# Ubuntu
|
|
||||||
- os: linux
|
|
||||||
dist: bionic
|
|
||||||
compiler: clang
|
|
||||||
env:
|
|
||||||
- FTXUI_TEST_EXE="./tests --gtest_color=yes"
|
|
||||||
|
|
||||||
# OS X
|
|
||||||
- os: osx
|
|
||||||
env:
|
|
||||||
- FTXUI_TEST_EXE="./tests --gtest_color=yes"
|
|
||||||
|
|
||||||
# Windows
|
|
||||||
- os: windows
|
|
||||||
env:
|
|
||||||
- FTXUI_TEST_EXE="./Debug/tests.exe --gtest_color=yes"
|
|
207
CMakeLists.txt
207
CMakeLists.txt
@ -1,17 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.11)
|
cmake_minimum_required(VERSION 3.11)
|
||||||
|
|
||||||
find_package(Git QUIET)
|
include(cmake/ftxui_git_version.cmake)
|
||||||
if (Git_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
|
|
||||||
message("git found")
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
OUTPUT_VARIABLE git_version
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
set(git_version 0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
project(ftxui
|
project(ftxui
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
@ -24,8 +13,6 @@ option(FTXUI_BUILD_TESTS "Set to ON to build tests" OFF)
|
|||||||
option(FTXUI_BUILD_TESTS_FUZZER "Set to ON to enable fuzzing" OFF)
|
option(FTXUI_BUILD_TESTS_FUZZER "Set to ON to enable fuzzing" OFF)
|
||||||
option(FTXUI_ENABLE_INSTALL "Generate the install target" ON)
|
option(FTXUI_ENABLE_INSTALL "Generate the install target" ON)
|
||||||
|
|
||||||
find_package(Threads)
|
|
||||||
|
|
||||||
add_library(screen STATIC
|
add_library(screen STATIC
|
||||||
src/ftxui/screen/box.cpp
|
src/ftxui/screen/box.cpp
|
||||||
src/ftxui/screen/color.cpp
|
src/ftxui/screen/color.cpp
|
||||||
@ -108,186 +95,27 @@ add_library(component STATIC
|
|||||||
src/ftxui/component/toggle.cpp
|
src/ftxui/component/toggle.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(ftxui::screen ALIAS screen)
|
target_link_libraries(dom
|
||||||
add_library(ftxui::dom ALIAS dom)
|
PUBLIC screen
|
||||||
add_library(ftxui::component ALIAS component)
|
)
|
||||||
|
|
||||||
target_link_libraries(dom PUBLIC screen)
|
find_package(Threads)
|
||||||
target_link_libraries(component PUBLIC dom Threads::Threads)
|
target_link_libraries(component
|
||||||
find_program(iwyu_path NAMES include-what-you-use iwyu)
|
PUBLIC dom
|
||||||
if(iwyu_path)
|
PRIVATE Threads::Threads
|
||||||
set_property(TARGET ${lib}
|
)
|
||||||
PROPERTY ${iwyu_path} -Xiwyu
|
|
||||||
--mapping_file ${CMAKE_CURRENT_SOURCE_DIR}/iwyu.impl
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
include(cmake/ftxui_set_options.cmake)
|
||||||
|
ftxui_set_options(screen)
|
||||||
|
ftxui_set_options(dom)
|
||||||
|
ftxui_set_options(component)
|
||||||
|
|
||||||
foreach(lib screen dom component)
|
if (FTXUI_BUILD_TESTS AND ${CMAKE_VERSION} VERSION_GREATER "3.11.4")
|
||||||
target_include_directories(${lib}
|
include(cmake/ftxui_test.cmake)
|
||||||
PUBLIC
|
|
||||||
$<INSTALL_INTERFACE:include>
|
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
||||||
PRIVATE
|
|
||||||
src
|
|
||||||
)
|
|
||||||
|
|
||||||
# C++17 is used. We requires fold expression at least.
|
|
||||||
set_property(TARGET ${lib} PROPERTY CXX_STANDARD 17)
|
|
||||||
|
|
||||||
# Force Microsoft Visual Studio to decode sources files in UTF-8. This applies
|
|
||||||
# to the library and the library users.
|
|
||||||
if (MSVC)
|
|
||||||
target_compile_options(${lib} PUBLIC "/utf-8")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add as many warning as possible:
|
|
||||||
if (WIN32)
|
|
||||||
if (MSVC)
|
|
||||||
target_compile_options(${lib} PRIVATE "/W3")
|
|
||||||
target_compile_options(${lib} PRIVATE "/WX")
|
|
||||||
target_compile_options(${lib} PRIVATE "/wd4244")
|
|
||||||
target_compile_options(${lib} PRIVATE "/wd4267")
|
|
||||||
target_compile_options(${lib} PRIVATE "/D_CRT_SECURE_NO_WARNINGS")
|
|
||||||
endif()
|
|
||||||
# Force Win32 to UNICODE
|
|
||||||
target_compile_definitions(${lib} PRIVATE UNICODE _UNICODE)
|
|
||||||
else()
|
|
||||||
target_compile_options(${lib} PRIVATE "-Wall")
|
|
||||||
target_compile_options(${lib} PRIVATE "-Wextra")
|
|
||||||
target_compile_options(${lib} PRIVATE "-pedantic")
|
|
||||||
target_compile_options(${lib} PRIVATE "-Werror")
|
|
||||||
target_compile_options(${lib} PRIVATE "-Wmissing-declarations")
|
|
||||||
target_compile_options(${lib} PRIVATE "-Wdeprecated")
|
|
||||||
target_compile_options(${lib} PRIVATE "-Wshadow")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
if (EMSCRIPTEN)
|
|
||||||
#string(APPEND CMAKE_CXX_FLAGS " -s ASSERTIONS=1")
|
|
||||||
string(APPEND CMAKE_CXX_FLAGS " -s ASYNCIFY")
|
|
||||||
string(APPEND CMAKE_CXX_FLAGS " -s USE_PTHREADS")
|
|
||||||
string(APPEND CMAKE_CXX_FLAGS " -s PROXY_TO_PTHREAD")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FTXUI_ENABLE_INSTALL)
|
if(FTXUI_ENABLE_INSTALL)
|
||||||
include(GNUInstallDirs)
|
include(cmake/ftxui_install.cmake)
|
||||||
install(TARGETS screen dom component
|
|
||||||
EXPORT ftxui-export
|
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/ftxui/
|
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/ftxui/
|
|
||||||
)
|
|
||||||
|
|
||||||
install(DIRECTORY include/ftxui DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
||||||
|
|
||||||
include(CMakePackageConfigHelpers)
|
|
||||||
configure_package_config_file(ftxui-config.cmake.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/ftxui-config.cmake
|
|
||||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/ftxui/cmake
|
|
||||||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
|
|
||||||
)
|
|
||||||
write_basic_package_version_file(
|
|
||||||
ftxui-config-version.cmake
|
|
||||||
VERSION ${PACKAGE_VERSION}
|
|
||||||
COMPATIBILITY AnyNewerVersion
|
|
||||||
)
|
|
||||||
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ftxui-config.cmake
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
|
|
||||||
)
|
|
||||||
install(EXPORT ftxui-export
|
|
||||||
FILE ftxui-config-version.cmake
|
|
||||||
NAMESPACE ftxui::
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
export(TARGETS screen dom component NAMESPACE ftxui::
|
|
||||||
FILE ${PROJECT_BINARY_DIR}/ftxui-targets.cmake)
|
|
||||||
|
|
||||||
|
|
||||||
if (FTXUI_BUILD_TESTS AND ${CMAKE_VERSION} VERSION_GREATER "3.11.4")
|
|
||||||
enable_testing()
|
|
||||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
|
||||||
|
|
||||||
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
|
|
||||||
include(FetchContent)
|
|
||||||
|
|
||||||
FetchContent_Declare( googletest
|
|
||||||
GIT_REPOSITORY "https://github.com/google/googletest"
|
|
||||||
GIT_TAG 23ef29555ef4789f555f1ba8c51b4c52975f0907
|
|
||||||
)
|
|
||||||
FetchContent_MakeAvailable(googletest)
|
|
||||||
|
|
||||||
add_executable(tests
|
|
||||||
src/ftxui/component/component_test.cpp
|
|
||||||
src/ftxui/component/container_test.cpp
|
|
||||||
src/ftxui/component/input_test.cpp
|
|
||||||
src/ftxui/component/radiobox_test.cpp
|
|
||||||
src/ftxui/component/receiver_test.cpp
|
|
||||||
src/ftxui/component/screen_interactive_test.cpp
|
|
||||||
src/ftxui/component/terminal_input_parser_test.cpp
|
|
||||||
src/ftxui/component/toggle_test.cpp
|
|
||||||
src/ftxui/dom/gauge_test.cpp
|
|
||||||
src/ftxui/dom/hbox_test.cpp
|
|
||||||
src/ftxui/dom/text_test.cpp
|
|
||||||
src/ftxui/dom/vbox_test.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(tests
|
|
||||||
PRIVATE component
|
|
||||||
PRIVATE gtest
|
|
||||||
PRIVATE gmock
|
|
||||||
PRIVATE gtest_main
|
|
||||||
)
|
|
||||||
target_include_directories(tests
|
|
||||||
PRIVATE src
|
|
||||||
)
|
|
||||||
target_compile_options(tests PRIVATE -fsanitize=address)
|
|
||||||
target_link_libraries(tests PRIVATE -fsanitize=address)
|
|
||||||
set_property(TARGET tests PROPERTY CXX_STANDARD 17)
|
|
||||||
|
|
||||||
if (NOT MSVC)
|
|
||||||
FetchContent_Declare(googlebenchmark
|
|
||||||
GIT_REPOSITORY "https://github.com/google/benchmark"
|
|
||||||
GIT_TAG 62937f91b5c763a8e119d0c20c67b87bde8eff1c
|
|
||||||
)
|
|
||||||
FetchContent_MakeAvailable(googlebenchmark)
|
|
||||||
|
|
||||||
add_executable(ftxui_benchmark
|
|
||||||
src/ftxui/dom/benchmark_test.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(ftxui_benchmark
|
|
||||||
PRIVATE dom
|
|
||||||
PRIVATE benchmark::benchmark
|
|
||||||
PRIVATE benchmark::benchmark_main
|
|
||||||
)
|
|
||||||
target_include_directories(ftxui_benchmark
|
|
||||||
PRIVATE src
|
|
||||||
)
|
|
||||||
set_property(TARGET ftxui_benchmark PROPERTY CXX_STANDARD 17)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (FTXUI_BUILD_TESTS_FUZZER)
|
|
||||||
set(CMAKE_C_COMPILER clang)
|
|
||||||
set(CMAKE_CXX_COMPILER clang++)
|
|
||||||
add_executable(terminal_input_parser_test_fuzz
|
|
||||||
src/ftxui/component/terminal_input_parser_test_fuzz.cpp
|
|
||||||
)
|
|
||||||
target_include_directories(terminal_input_parser_test_fuzz
|
|
||||||
PRIVATE src
|
|
||||||
)
|
|
||||||
target_link_libraries(terminal_input_parser_test_fuzz
|
|
||||||
PRIVATE component
|
|
||||||
)
|
|
||||||
target_compile_options(terminal_input_parser_test_fuzz
|
|
||||||
PRIVATE -fsanitize=fuzzer,address
|
|
||||||
)
|
|
||||||
target_link_libraries(terminal_input_parser_test_fuzz
|
|
||||||
PRIVATE -fsanitize=fuzzer,address
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FTXUI_BUILD_EXAMPLES)
|
if(FTXUI_BUILD_EXAMPLES)
|
||||||
@ -297,3 +125,6 @@ endif()
|
|||||||
if(FTXUI_BUILD_DOCS)
|
if(FTXUI_BUILD_DOCS)
|
||||||
add_subdirectory(doc)
|
add_subdirectory(doc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include(cmake/iwyu.cmake)
|
||||||
|
include(cmake/ftxui_export.cmake)
|
||||||
|
20
cmake/ftxui_benchmark.cmake
Normal file
20
cmake/ftxui_benchmark.cmake
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
if (NOT WIN32)
|
||||||
|
FetchContent_Declare(googlebenchmark
|
||||||
|
GIT_REPOSITORY "https://github.com/google/benchmark"
|
||||||
|
GIT_TAG 62937f91b5c763a8e119d0c20c67b87bde8eff1c
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(googlebenchmark)
|
||||||
|
|
||||||
|
add_executable(ftxui_benchmark
|
||||||
|
src/ftxui/dom/benchmark_test.cpp
|
||||||
|
)
|
||||||
|
target_link_libraries(ftxui_benchmark
|
||||||
|
PRIVATE dom
|
||||||
|
PRIVATE benchmark::benchmark
|
||||||
|
PRIVATE benchmark::benchmark_main
|
||||||
|
)
|
||||||
|
target_include_directories(ftxui_benchmark
|
||||||
|
PRIVATE src
|
||||||
|
)
|
||||||
|
set_property(TARGET ftxui_benchmark PROPERTY CXX_STANDARD 17)
|
||||||
|
endif()
|
8
cmake/ftxui_export.cmake
Normal file
8
cmake/ftxui_export.cmake
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
add_library(ftxui::screen ALIAS screen)
|
||||||
|
add_library(ftxui::dom ALIAS dom)
|
||||||
|
add_library(ftxui::component ALIAS component)
|
||||||
|
export(
|
||||||
|
TARGETS screen dom component
|
||||||
|
NAMESPACE ftxui::
|
||||||
|
FILE ${PROJECT_BINARY_DIR}/ftxui-targets.cmake
|
||||||
|
)
|
17
cmake/ftxui_fuzzer.cmake
Normal file
17
cmake/ftxui_fuzzer.cmake
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
set(CMAKE_C_COMPILER clang)
|
||||||
|
set(CMAKE_CXX_COMPILER clang++)
|
||||||
|
add_executable(terminal_input_parser_test_fuzz
|
||||||
|
src/ftxui/component/terminal_input_parser_test_fuzz.cpp
|
||||||
|
)
|
||||||
|
target_include_directories(terminal_input_parser_test_fuzz
|
||||||
|
PRIVATE src
|
||||||
|
)
|
||||||
|
target_link_libraries(terminal_input_parser_test_fuzz
|
||||||
|
PRIVATE component
|
||||||
|
)
|
||||||
|
target_compile_options(terminal_input_parser_test_fuzz
|
||||||
|
PRIVATE -fsanitize=fuzzer,address
|
||||||
|
)
|
||||||
|
target_link_libraries(terminal_input_parser_test_fuzz
|
||||||
|
PRIVATE -fsanitize=fuzzer,address
|
||||||
|
)
|
13
cmake/ftxui_git_version.cmake
Normal file
13
cmake/ftxui_git_version.cmake
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
find_package(Git QUIET)
|
||||||
|
if (Git_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
|
||||||
|
message("git found")
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE git_version
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(git_version 0)
|
||||||
|
endif()
|
||||||
|
|
29
cmake/ftxui_install.cmake
Normal file
29
cmake/ftxui_install.cmake
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
include(GNUInstallDirs)
|
||||||
|
install(TARGETS screen dom component
|
||||||
|
EXPORT ftxui-export
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/ftxui/
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/ftxui/
|
||||||
|
)
|
||||||
|
|
||||||
|
install(DIRECTORY include/ftxui DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
configure_package_config_file(ftxui-config.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/ftxui-config.cmake
|
||||||
|
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/ftxui/cmake
|
||||||
|
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
|
||||||
|
)
|
||||||
|
write_basic_package_version_file(
|
||||||
|
ftxui-config-version.cmake
|
||||||
|
VERSION ${PACKAGE_VERSION}
|
||||||
|
COMPATIBILITY AnyNewerVersion
|
||||||
|
)
|
||||||
|
|
||||||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ftxui-config.cmake
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
|
||||||
|
)
|
||||||
|
install(EXPORT ftxui-export
|
||||||
|
FILE ftxui-config-version.cmake
|
||||||
|
NAMESPACE ftxui::
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
|
||||||
|
)
|
46
cmake/ftxui_set_options.cmake
Normal file
46
cmake/ftxui_set_options.cmake
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
function(ftxui_set_options library)
|
||||||
|
target_include_directories(${library}
|
||||||
|
PUBLIC
|
||||||
|
$<INSTALL_INTERFACE:include>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
|
PRIVATE
|
||||||
|
src
|
||||||
|
)
|
||||||
|
|
||||||
|
# C++17 is used. We requires fold expression at least.
|
||||||
|
set_property(TARGET ${library} PROPERTY CXX_STANDARD 17)
|
||||||
|
|
||||||
|
# Force Microsoft Visual Studio to decode sources files in UTF-8. This applies
|
||||||
|
# to the library and the library users.
|
||||||
|
if (MSVC)
|
||||||
|
target_compile_options(${library} PUBLIC "/utf-8")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Add as many warning as possible:
|
||||||
|
if (WIN32)
|
||||||
|
if (MSVC)
|
||||||
|
target_compile_options(${library} PRIVATE "/W3")
|
||||||
|
target_compile_options(${library} PRIVATE "/WX")
|
||||||
|
target_compile_options(${library} PRIVATE "/wd4244")
|
||||||
|
target_compile_options(${library} PRIVATE "/wd4267")
|
||||||
|
target_compile_options(${library} PRIVATE "/D_CRT_SECURE_NO_WARNINGS")
|
||||||
|
endif()
|
||||||
|
# Force Win32 to UNICODE
|
||||||
|
target_compile_definitions(${library} PRIVATE UNICODE _UNICODE)
|
||||||
|
else()
|
||||||
|
target_compile_options(${library} PRIVATE "-Wall")
|
||||||
|
target_compile_options(${library} PRIVATE "-Wextra")
|
||||||
|
target_compile_options(${library} PRIVATE "-pedantic")
|
||||||
|
target_compile_options(${library} PRIVATE "-Werror")
|
||||||
|
target_compile_options(${library} PRIVATE "-Wmissing-declarations")
|
||||||
|
target_compile_options(${library} PRIVATE "-Wdeprecated")
|
||||||
|
target_compile_options(${library} PRIVATE "-Wshadow")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
if (EMSCRIPTEN)
|
||||||
|
#string(APPEND CMAKE_CXX_FLAGS " -s ASSERTIONS=1")
|
||||||
|
string(APPEND CMAKE_CXX_FLAGS " -s ASYNCIFY")
|
||||||
|
string(APPEND CMAKE_CXX_FLAGS " -s USE_PTHREADS")
|
||||||
|
string(APPEND CMAKE_CXX_FLAGS " -s PROXY_TO_PTHREAD")
|
||||||
|
endif()
|
47
cmake/ftxui_test.cmake
Normal file
47
cmake/ftxui_test.cmake
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
enable_testing()
|
||||||
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||||
|
|
||||||
|
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
FetchContent_Declare( googletest
|
||||||
|
GIT_REPOSITORY "https://github.com/google/googletest"
|
||||||
|
GIT_TAG 23ef29555ef4789f555f1ba8c51b4c52975f0907
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(googletest)
|
||||||
|
|
||||||
|
add_executable(tests
|
||||||
|
src/ftxui/component/component_test.cpp
|
||||||
|
src/ftxui/component/container_test.cpp
|
||||||
|
src/ftxui/component/input_test.cpp
|
||||||
|
src/ftxui/component/radiobox_test.cpp
|
||||||
|
src/ftxui/component/receiver_test.cpp
|
||||||
|
src/ftxui/component/screen_interactive_test.cpp
|
||||||
|
src/ftxui/component/terminal_input_parser_test.cpp
|
||||||
|
src/ftxui/component/toggle_test.cpp
|
||||||
|
src/ftxui/dom/gauge_test.cpp
|
||||||
|
src/ftxui/dom/hbox_test.cpp
|
||||||
|
src/ftxui/dom/text_test.cpp
|
||||||
|
src/ftxui/dom/vbox_test.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(tests
|
||||||
|
PRIVATE component
|
||||||
|
PRIVATE gtest
|
||||||
|
PRIVATE gmock
|
||||||
|
PRIVATE gtest_main
|
||||||
|
)
|
||||||
|
target_include_directories(tests
|
||||||
|
PRIVATE src
|
||||||
|
)
|
||||||
|
target_compile_options(tests PRIVATE -fsanitize=address)
|
||||||
|
target_link_libraries(tests PRIVATE -fsanitize=address)
|
||||||
|
set_property(TARGET tests PROPERTY CXX_STANDARD 17)
|
||||||
|
|
||||||
|
if (NOT MSVC)
|
||||||
|
include(cmake/ftxui_benchmark.cmake)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FTXUI_BUILD_TESTS_FUZZER)
|
||||||
|
include(cmake/ftxui_fuzzer.cmake)
|
||||||
|
endif()
|
7
cmake/iwyu.cmake
Normal file
7
cmake/iwyu.cmake
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
find_program(iwyu_path NAMES include-what-you-use iwyu)
|
||||||
|
if(iwyu_path)
|
||||||
|
set_property(TARGET ${lib}
|
||||||
|
PROPERTY ${iwyu_path} -Xiwyu
|
||||||
|
--mapping_file ${CMAKE_CURRENT_SOURCE_DIR}/iwyu.impl
|
||||||
|
)
|
||||||
|
endif()
|
Loading…
Reference in New Issue
Block a user