95 lines
2.5 KiB
CMake
95 lines
2.5 KiB
CMake
cmake_minimum_required(VERSION 4.2)
|
|
project(seadisk C CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
find_package(tl-expected CONFIG REQUIRED)
|
|
find_package(nlohmann_json CONFIG REQUIRED)
|
|
find_package(date CONFIG REQUIRED)
|
|
find_package(cpr CONFIG REQUIRED)
|
|
find_package(argparse CONFIG REQUIRED)
|
|
find_package(ada CONFIG REQUIRED)
|
|
find_package(spdlog CONFIG REQUIRED)
|
|
find_package(ICU REQUIRED COMPONENTS uc i18n)
|
|
|
|
cmake_host_system_information(
|
|
RESULT WINFSP_DIR
|
|
QUERY WINDOWS_REGISTRY
|
|
"HKLM\\SOFTWARE\\WinFsp"
|
|
VALUE "InstallDir"
|
|
)
|
|
|
|
message(STATUS "WinFsp=${WINFSP_DIR}")
|
|
|
|
set(WINFSP_INCLUDE_DIR "${WINFSP_DIR}/inc")
|
|
|
|
message(STATUS "${CMAKE_SYSTEM_PROCESSOR}")
|
|
if (CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64|x86_64")
|
|
set(WINFSP_PLATFORM x64)
|
|
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64|aarch64")
|
|
set(WINFSP_PLATFORM a64)
|
|
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "X86|i386|i686")
|
|
set(WINFSP_PLATFORM x86)
|
|
endif ()
|
|
|
|
set(WINFSP_LIB "winfsp-${WINFSP_PLATFORM}.lib")
|
|
|
|
message(STATUS "WinFSP lib: ${WINFSP_LIB}")
|
|
|
|
add_executable(seadisk src/main.cpp
|
|
include/seafile/api/seafile_api.hpp
|
|
include/seafile/api/exception.hpp
|
|
include/seafile/api/server_info.hpp
|
|
include/seafile/api/auth_token.hpp
|
|
include/seafile/api/default_repo.hpp
|
|
include/seafile/api/token_type.hpp
|
|
include/seafile/api/repo_info.hpp
|
|
include/seafile/api/repo_entry.hpp
|
|
include/seafile/api/account_info.hpp
|
|
include/seafile/api/file_info.hpp
|
|
include/seafile/api/dir_info.hpp
|
|
include/seafile/fs/file_context.hpp
|
|
include/seafile/fs/seafile_file_system.hpp
|
|
src/seafile/fs/seafile_file_system.cpp
|
|
src/seafile/fs/winfsp_adapter.cpp
|
|
include/seafile/fs/winfsp_adapter.hpp
|
|
src/util/string_util.cpp
|
|
)
|
|
|
|
target_compile_definitions(seadisk PRIVATE
|
|
NOMINMAX
|
|
UNICODE
|
|
_UNICODE
|
|
)
|
|
|
|
target_include_directories(seadisk PRIVATE
|
|
"${WINFSP_INCLUDE_DIR}"
|
|
include
|
|
)
|
|
|
|
target_link_directories(seadisk PRIVATE
|
|
"${WINFSP_DIR}/lib"
|
|
)
|
|
|
|
target_link_libraries(seadisk PRIVATE
|
|
${WINFSP_LIB}
|
|
delayimp
|
|
tl::expected
|
|
nlohmann_json::nlohmann_json
|
|
date::date
|
|
date::date-tz
|
|
cpr::cpr
|
|
argparse::argparse
|
|
ada::ada
|
|
spdlog::spdlog
|
|
ICU::uc
|
|
ICU::i18n
|
|
)
|
|
|
|
target_link_options(seadisk PRIVATE
|
|
"/DELAYLOAD:winfsp-${WINFSP_PLATFORM}.dll"
|
|
)
|
|
|
|
target_compile_options(seadisk PRIVATE
|
|
/Zc:preprocessor
|
|
) |