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
|
2023-08-13 04:57:13 +08:00
|
|
|
VERSION 0.6.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
|
2023-06-04 06:59:23 +08:00
|
|
|
GIT_TAG 10.0.0
|
2022-02-12 08:38:15 +08:00
|
|
|
EXCLUDE_FROM_ALL YES
|
2021-12-01 12:20:39 +08:00
|
|
|
)
|
2023-07-01 03:45:33 +08:00
|
|
|
CPMAddPackage(
|
|
|
|
NAME tomlplusplus
|
|
|
|
GITHUB_REPOSITORY marzer/tomlplusplus
|
|
|
|
GIT_TAG ad55bae8a11a6eee39e2292b01e95b529b105767
|
|
|
|
EXCLUDE_FROM_ALL YES
|
|
|
|
)
|
2022-02-12 08:38:15 +08:00
|
|
|
CPMAddPackage(
|
|
|
|
NAME spdlog
|
|
|
|
GITHUB_REPOSITORY gabime/spdlog
|
2023-06-04 06:59:23 +08:00
|
|
|
GIT_TAG 31cf79a70dfa61a4b2b7509eecca6a3b269bfc4a
|
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(
|
2022-06-11 08:18:31 +08:00
|
|
|
NAME rapidjson
|
|
|
|
GITHUB_REPOSITORY Tencent/rapidjson
|
2023-06-04 06:59:23 +08:00
|
|
|
GIT_TAG 973dc9c06dcd3d035ebd039cfb9ea457721ec213
|
2022-02-12 08:38:15 +08:00
|
|
|
EXCLUDE_FROM_ALL YES
|
2021-12-01 12:20:39 +08:00
|
|
|
)
|
2022-11-19 08:19:55 +08:00
|
|
|
if(NOT ENABLE_DEVENV)
|
2022-02-12 08:38:15 +08:00
|
|
|
CPMAddPackage(
|
|
|
|
NAME cpr
|
|
|
|
GITHUB_REPOSITORY libcpr/cpr
|
2023-06-04 06:59:23 +08:00
|
|
|
GIT_TAG 1.10.4
|
2022-02-12 08:38:15 +08:00
|
|
|
EXCLUDE_FROM_ALL YES
|
2021-12-01 12:20:39 +08:00
|
|
|
)
|
2022-11-19 08:19:55 +08:00
|
|
|
endif()
|
2022-06-06 04:36:15 +08:00
|
|
|
CPMAddPackage(
|
|
|
|
NAME range-v3
|
|
|
|
GITHUB_REPOSITORY ericniebler/range-v3
|
2022-12-27 22:22:39 +08:00
|
|
|
GIT_TAG 4624c63972c6f2c2871c7b87813c42048ddb80ad
|
2022-06-06 04:36:15 +08:00
|
|
|
EXCLUDE_FROM_ALL YES
|
|
|
|
)
|
2022-08-09 08:13:25 +08:00
|
|
|
CPMAddPackage(
|
|
|
|
NAME ctre
|
|
|
|
GITHUB_REPOSITORY hanickadot/compile-time-regular-expressions
|
2023-06-04 06:59:23 +08:00
|
|
|
GIT_TAG v3.7.2
|
2022-08-09 08:13:25 +08:00
|
|
|
EXCLUDE_FROM_ALL YES
|
|
|
|
)
|
2021-11-30 07:51:27 +08:00
|
|
|
|
2021-11-26 02:34:58 +08:00
|
|
|
##
|
|
|
|
## CONFIGURATION
|
|
|
|
##
|
2023-04-03 07:22:07 +08:00
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto=thin -fwhole-program-vtables")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -flto=thin -fwhole-program-vtables")
|
|
|
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto -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
|
|
|
|
src/config.cpp src/config.hpp
|
|
|
|
src/utils.cpp src/utils.hpp
|
2022-12-31 05:03:34 +08:00
|
|
|
src/cpu.cpp src/cpu.hpp
|
2023-01-18 07:07:00 +08:00
|
|
|
src/pacmanconf_repo.cpp src/pacmanconf_repo.hpp
|
2022-08-11 08:07:16 +08:00
|
|
|
src/initcpio.cpp src/initcpio.hpp
|
2023-07-01 03:45:33 +08:00
|
|
|
src/chwd_profiles.cpp src/chwd_profiles.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
|
2022-06-11 08:18:31 +08:00
|
|
|
src/simple_tui.cpp src/simple_tui.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
|
|
|
|
|
|
|
# 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)
|
|
|
|
|
2022-08-10 01:06:36 +08:00
|
|
|
# Prepare RapidJSON (RapidJSON is a header-only library)
|
|
|
|
set(RAPIDJSON_INCLUDE_DIR "${rapidjson_SOURCE_DIR}/include")
|
|
|
|
|
2022-08-10 01:50:57 +08:00
|
|
|
# Prepare FTXUI depends
|
|
|
|
target_link_libraries(screen PRIVATE range-v3::range-v3)
|
|
|
|
target_link_libraries(dom PRIVATE range-v3::range-v3)
|
|
|
|
target_link_libraries(component PRIVATE range-v3::range-v3)
|
|
|
|
|
2022-08-09 08:46:45 +08:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/src ${RAPIDJSON_INCLUDE_DIR})
|
2021-11-26 02:34:58 +08:00
|
|
|
|
2022-08-08 04:55:17 +08:00
|
|
|
if(COS_INSTALLER_BUILD_TESTS)
|
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|
|
|
|
|
2023-07-01 03:45:33 +08:00
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE project_warnings project_options spdlog::spdlog fmt::fmt ftxui::screen ftxui::dom ftxui::component range-v3::range-v3 ctre::ctre tomlplusplus::tomlplusplus)
|
2022-11-19 08:19:55 +08:00
|
|
|
if(NOT ENABLE_DEVENV)
|
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE cpr::cpr)
|
|
|
|
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
|
|
|
)
|