cmake_minimum_required(VERSION 3.14) include(cmake/prelude.cmake) project( gd-tools VERSION 1.5 DESCRIPTION "A set of helpful programs to enhance goldendict for immersion learning." HOMEPAGE_URL "https://github.com/Ajatt-Tools/gd-tools" LANGUAGES CXX ) include(cmake/project-is-top-level.cmake) include(cmake/variables.cmake) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) # ---- Non GUIX Platforms ---- #[===[ # ---- Download Dependencies ---- include(FetchContent) # Testing library FetchContent_Declare(catch GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v3.5.2) FetchContent_MakeAvailable(catch) FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git GIT_TAG 3b15fa82ea74739b574d705fea44959b58142eb8) FetchContent_MakeAvailable(cpr) FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz) FetchContent_MakeAvailable(json) ]===] #[===[ Find Local Libs add_subdirectory(json) add_subdirectory(rdricpp) ]===] #[===[ NON GUIX PKG MANAGERS find_package(marisa REQUIRED) find_package(rdricpp REQUIRED) find_package(nlohmann-json REQUIRED) ]===] # ------------------ #Guix/Unix/Mac/Windows #add_subdirectory(rdricpp) #Guix/Unix/Mac #add_subdirectory(cpr-1.10.5) # ---- Declare executable ---- #Windows #set(SOURCES src/anki_search.cpp src/echo.cpp src/massif.cpp src/images.cpp src/marisa.cpp src/util.cpp src/kana_conv.cpp) #set(HEADERS src/anki_search.h src/unistd_win.h src/echo.h src/massif.h src/images.h src/marisa.h src/util.h src/kana_conv.h src/utf8.h) #Guix/Unix set(SOURCES src/anki_search.cpp src/echo.cpp src/massif.cpp src/images.cpp src/marisa.cpp src/util.cpp src/kana_conv.cpp) set(HEADERS src/anki_search.h src/echo.h src/massif.h src/images.h src/marisa.h src/util.h src/kana_conv.h) add_executable(gd-tools_exe src/main.cpp ${SOURCES} ${HEADERS}) add_executable(gd-tools::exe ALIAS gd-tools_exe) # ---- Compile ---- set_property(TARGET gd-tools_exe PROPERTY OUTPUT_NAME gd-tools) target_compile_features(gd-tools_exe PRIVATE cxx_std_23) #Guix target_link_libraries(gd-tools_exe PRIVATE cpr marisa rdricpp) #Windows #target_link_libraries(gd-tools_exe PRIVATE libmarisa.a cpr::cpr nlohmann_json::nlohmann_json rdricpp) # ---- Install rules ---- if(NOT CMAKE_SKIP_INSTALL_RULES) include(cmake/install-rules.cmake) endif() include(cmake/dev-mode.cmake) # ---- Developer mode ---- option(gd-tools_DEVELOPER_MODE "Test gd-tools" ON) if(NOT gd-tools_DEVELOPER_MODE) return() elseif(NOT PROJECT_IS_TOP_LEVEL) message( AUTHOR_WARNING "Developer mode is intended for developers of gd-tools" ) endif() #target_link_libraries(gd-tools_exe PRIVATE -lasan -lubsan)