mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-16 16:08:08 +08:00
Cleanup. (#132)
- Split the large CMakeList. - Remove travis - Remove gitlab-ci.yml
This commit is contained in:
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()
|
Reference in New Issue
Block a user