2021-11-26 02:34:58 +08:00
|
|
|
cmake_minimum_required(VERSION 3.15)
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
##
|
|
|
|
## PROJECT
|
|
|
|
## name and version
|
|
|
|
##
|
|
|
|
project(cachyos-installer
|
2022-01-05 07:15:39 +08:00
|
|
|
VERSION 0.5.0
|
2021-12-01 12:20:39 +08:00
|
|
|
LANGUAGES CXX)
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
##
|
|
|
|
## INCLUDE
|
|
|
|
##
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
include(StandardProjectSettings)
|
|
|
|
include(CompilerWarnings)
|
|
|
|
include(EnableCcache)
|
2021-12-01 20:37:18 +08:00
|
|
|
include(Linker)
|
|
|
|
include(StaticAnalyzers)
|
|
|
|
include(Sanitizers)
|
2022-02-12 08:38:15 +08:00
|
|
|
include(CPM)
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2022-02-14 07:22:19 +08:00
|
|
|
#find_package(PkgConfig REQUIRED)
|
|
|
|
#pkg_check_modules(
|
|
|
|
# GLIBMM
|
|
|
|
# REQUIRED
|
|
|
|
# IMPORTED_TARGET
|
|
|
|
# glibmm-2.4>=2.56.0)
|
2021-12-06 06:32:14 +08:00
|
|
|
|
2022-02-12 08:38:15 +08:00
|
|
|
CPMAddPackage(
|
|
|
|
NAME ftxui
|
|
|
|
GITHUB_REPOSITORY vnepogodin/ftxui
|
2022-01-11 07:18:19 +08:00
|
|
|
GIT_TAG "c++20"
|
2022-02-12 08:38:15 +08:00
|
|
|
EXCLUDE_FROM_ALL YES
|
2021-12-01 12:20:39 +08:00
|
|
|
)
|
2022-02-12 08:38:15 +08:00
|
|
|
CPMAddPackage(
|
|
|
|
NAME fmt
|
|
|
|
GITHUB_REPOSITORY fmtlib/fmt
|
2022-02-23 21:02:15 +08:00
|
|
|
GIT_TAG 86477f7ecc1606e15abae1ff784e6b0c55d99619
|
2022-02-12 08:38:15 +08:00
|
|
|
EXCLUDE_FROM_ALL YES
|
2021-12-01 12:20:39 +08:00
|
|
|
)
|
2022-02-12 08:38:15 +08:00
|
|
|
CPMAddPackage(
|
|
|
|
NAME spdlog
|
|
|
|
GITHUB_REPOSITORY gabime/spdlog
|
2022-02-21 08:20:48 +08:00
|
|
|
GIT_TAG 2f2d04b3e840428a18942ca2d3d65203ec564647
|
2022-02-12 08:38:15 +08:00
|
|
|
EXCLUDE_FROM_ALL YES
|
2021-12-21 07:13:13 +08:00
|
|
|
)
|
2022-02-12 08:38:15 +08:00
|
|
|
CPMAddPackage(
|
|
|
|
NAME simdjson
|
|
|
|
GITHUB_REPOSITORY simdjson/simdjson
|
|
|
|
GIT_TAG 6698eb96b99576b8d53f8d90c9023717379e1c0f
|
|
|
|
EXCLUDE_FROM_ALL YES
|
2021-12-01 12:20:39 +08:00
|
|
|
)
|
2022-02-12 08:38:15 +08:00
|
|
|
CPMAddPackage(
|
|
|
|
NAME cpr
|
|
|
|
GITHUB_REPOSITORY libcpr/cpr
|
|
|
|
GIT_TAG da381bb2afe4e36b18b1fe206bc06951d8fdc06e
|
|
|
|
EXCLUDE_FROM_ALL YES
|
2021-12-01 12:20:39 +08:00
|
|
|
)
|
2021-12-21 07:13:13 +08:00
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
|
2022-02-12 08:38:15 +08:00
|
|
|
CPMAddPackage(
|
|
|
|
NAME range-v3
|
|
|
|
GITHUB_REPOSITORY ericniebler/range-v3
|
|
|
|
GIT_TAG 9aa032ccd0eb4bd77f58e5b181168f1038c222c6
|
|
|
|
EXCLUDE_FROM_ALL YES
|
2021-12-21 07:13:13 +08:00
|
|
|
)
|
|
|
|
endif()
|
2021-11-30 07:51:27 +08:00
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
##
|
|
|
|
## CONFIGURATION
|
|
|
|
##
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-12-01 12:20:39 +08:00
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
2022-02-14 07:22:19 +08:00
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fwhole-program -fuse-linker-plugin")
|
2021-12-01 12:20:39 +08:00
|
|
|
endif()
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
# Link this 'library' to set the c++ standard / compile-time options requested
|
|
|
|
add_library(project_options INTERFACE)
|
|
|
|
target_compile_features(project_options INTERFACE cxx_std_20)
|
2021-11-25 22:00:14 +08:00
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
##
|
|
|
|
## Target
|
|
|
|
##
|
|
|
|
add_executable(${PROJECT_NAME}
|
2021-12-03 07:10:05 +08:00
|
|
|
src/view.hpp
|
2021-12-01 20:37:18 +08:00
|
|
|
src/definitions.hpp
|
2021-12-03 07:10:05 +08:00
|
|
|
src/screen_service.hpp src/screen_service.cpp
|
2021-12-01 20:37:18 +08:00
|
|
|
src/config.cpp src/config.hpp
|
|
|
|
src/utils.cpp src/utils.hpp
|
2022-02-12 08:38:15 +08:00
|
|
|
src/disk.cpp src/disk.hpp
|
2022-02-19 07:32:24 +08:00
|
|
|
src/drivers.cpp src/drivers.hpp
|
2021-12-13 07:22:03 +08:00
|
|
|
src/widgets.cpp src/widgets.hpp
|
2021-12-27 07:04:03 +08:00
|
|
|
src/follow_process_log.hpp src/follow_process_log.cpp
|
2022-01-09 08:41:43 +08:00
|
|
|
src/crypto.cpp src/crypto.hpp
|
2022-02-19 07:32:24 +08:00
|
|
|
src/misc.cpp src/misc.hpp
|
2021-12-01 20:37:18 +08:00
|
|
|
src/tui.cpp src/tui.hpp
|
|
|
|
src/main.cpp
|
|
|
|
)
|
2021-11-26 02:34:58 +08:00
|
|
|
|
2021-12-05 08:15:34 +08:00
|
|
|
add_executable(test-exec-interactive
|
2021-12-27 07:04:03 +08:00
|
|
|
src/config.cpp src/config.hpp
|
|
|
|
src/utils.cpp src/utils.hpp
|
2022-02-12 08:38:15 +08:00
|
|
|
src/disk.cpp src/disk.hpp
|
2021-12-30 06:21:48 +08:00
|
|
|
src/widgets.cpp src/widgets.hpp
|
|
|
|
src/follow_process_log.hpp src/follow_process_log.cpp
|
2022-02-12 08:38:15 +08:00
|
|
|
src/crypto.cpp src/crypto.hpp
|
2021-12-27 07:04:03 +08:00
|
|
|
src/tui.cpp src/tui.hpp
|
|
|
|
src/main_test.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
add_executable(test-process-tailing
|
2022-01-03 05:45:54 +08:00
|
|
|
src/config.cpp src/config.hpp
|
|
|
|
src/utils.cpp src/utils.hpp
|
2022-02-12 08:38:15 +08:00
|
|
|
src/disk.cpp src/disk.hpp
|
2021-12-13 07:22:03 +08:00
|
|
|
src/widgets.cpp src/widgets.hpp
|
2021-12-27 07:04:03 +08:00
|
|
|
src/follow_process_log.hpp src/follow_process_log.cpp
|
2022-02-12 08:38:15 +08:00
|
|
|
src/crypto.cpp src/crypto.hpp
|
2021-12-10 06:57:42 +08:00
|
|
|
src/tui.cpp src/tui.hpp
|
2021-12-27 07:04:03 +08:00
|
|
|
src/test_proccess_tailing.cpp
|
2021-12-05 08:15:34 +08:00
|
|
|
)
|
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
# Link this 'library' to use the warnings specified in CompilerWarnings.cmake
|
|
|
|
add_library(project_warnings INTERFACE)
|
|
|
|
set_project_warnings(project_warnings)
|
|
|
|
|
2021-12-01 20:37:18 +08:00
|
|
|
# Add linker configuration
|
|
|
|
configure_linker(project_options)
|
|
|
|
|
|
|
|
# sanitizer options if supported by compiler
|
|
|
|
enable_sanitizers(project_options)
|
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/src)
|
|
|
|
|
2022-02-14 07:22:19 +08:00
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE project_warnings project_options spdlog::spdlog fmt::fmt ftxui::screen ftxui::dom ftxui::component simdjson::simdjson cpr::cpr)
|
|
|
|
target_link_libraries(test-exec-interactive PRIVATE project_warnings project_options spdlog::spdlog fmt::fmt ftxui::component simdjson::simdjson cpr::cpr)
|
|
|
|
target_link_libraries(test-process-tailing PRIVATE project_warnings project_options spdlog::spdlog fmt::fmt ftxui::component simdjson::simdjson cpr::cpr)
|
2021-11-26 02:34:58 +08:00
|
|
|
|
2021-12-21 07:13:13 +08:00
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
|
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE range-v3::range-v3)
|
|
|
|
target_link_libraries(test-exec-interactive PRIVATE range-v3::range-v3)
|
|
|
|
endif()
|
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
option(ENABLE_UNITY "Enable Unity builds of projects" OFF)
|
2021-12-01 12:20:39 +08:00
|
|
|
if(ENABLE_UNITY)
|
2021-12-01 20:37:18 +08:00
|
|
|
# Add for any project you want to apply unity builds for
|
|
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES UNITY_BUILD ON)
|
2021-12-01 12:20:39 +08:00
|
|
|
endif()
|
2021-11-26 02:34:58 +08:00
|
|
|
|
|
|
|
install(
|
2021-12-01 20:37:18 +08:00
|
|
|
TARGETS ${PROJECT_NAME}
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
2021-11-26 02:34:58 +08:00
|
|
|
)
|