Мини релиз

This commit is contained in:
2025-10-06 08:22:54 +06:00
parent 0a6cd1c4c2
commit d6ee2185a7
4 changed files with 1044 additions and 0 deletions

55
CMakeLists.txt Normal file
View File

@@ -0,0 +1,55 @@
cmake_minimum_required(VERSION 3.13)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -ffunction-sections")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") # -rdynamic
# gprof
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
project(btrfs-sync-backend VERSION 0.0 LANGUAGES CXX)
add_executable(${PROJECT_NAME})
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_23)
# sanitizer
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(${PROJECT_NAME} PUBLIC -fsanitize=address,undefined -fno-omit-frame-pointer -fno-sanitize-recover=all)
target_link_options(${PROJECT_NAME} PUBLIC -fsanitize=address,undefined)
set(ENV{ASAN_OPTIONS} detect_leaks=0)
endif()
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
target_compile_options(${PROJECT_NAME} PUBLIC -fcoroutines)
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
target_compile_options(${PROJECT_NAME} PUBLIC -fcoroutine)
endif()
file(GLOB_RECURSE SOURCES RELATIVE ${PROJECT_SOURCE_DIR} "Src/*.cpp")
target_sources(${PROJECT_NAME} PRIVATE ${SOURCES})
target_include_directories(${PROJECT_NAME} PUBLIC "${PROJECT_SOURCE_DIR}/Src")
include(FetchContent)
# Boost
set(Boost_USE_STATIC_LIBS ON)
set(Boost_ENABLE_CMAKE ON)
set(Boost_INCLUDE_LIBRARIES ${Boost_INCLUDE_LIBRARIES} system asio json thread stacktrace timer serialization uuid process filesystem)
FetchContent_Declare(
Boost
GIT_REPOSITORY https://github.com/boostorg/boost.git
GIT_TAG boost-1.89.0
GIT_SHALLOW true
GIT_PROGRESS true
USES_TERMINAL_DOWNLOAD true
)
FetchContent_MakeAvailable(Boost)
target_link_libraries(${PROJECT_NAME} PUBLIC Boost::asio Boost::process Boost::json)
# ICU
find_package(ICU REQUIRED COMPONENTS uc i18n)
target_link_libraries(${PROJECT_NAME} PUBLIC ICU::uc ICU::i18n)