2024-02-04 18:24:04 +00:00
|
|
|
cmake_minimum_required(VERSION 3.14)
|
|
|
|
|
|
|
|
include(cmake/prelude.cmake)
|
|
|
|
|
|
|
|
project(
|
|
|
|
gd-tools
|
2024-02-07 20:32:30 +00:00
|
|
|
VERSION 1.5
|
2024-02-04 18:24:04 +00:00
|
|
|
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)
|
|
|
|
|
2024-02-07 20:32:30 +00:00
|
|
|
# ---- Non GUIX Platforms ----
|
2024-02-04 18:24:04 +00:00
|
|
|
|
2024-02-07 20:32:30 +00:00
|
|
|
#[===[
|
|
|
|
# ---- Download Dependencies ----
|
|
|
|
|
|
|
|
include(FetchContent)
|
2024-02-04 18:24:04 +00:00
|
|
|
|
2024-02-07 20:32:30 +00:00
|
|
|
# Testing library
|
|
|
|
FetchContent_Declare(catch GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v3.5.2)
|
|
|
|
FetchContent_MakeAvailable(catch)
|
2024-02-04 18:24:04 +00:00
|
|
|
|
2024-02-07 20:32:30 +00:00
|
|
|
FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git
|
|
|
|
GIT_TAG 3b15fa82ea74739b574d705fea44959b58142eb8)
|
|
|
|
FetchContent_MakeAvailable(cpr)
|
2024-02-04 18:24:04 +00:00
|
|
|
|
2024-02-07 20:32:30 +00:00
|
|
|
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)
|
2024-02-04 18:24:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---- Declare executable ----
|
|
|
|
|
2024-02-07 20:32:30 +00:00
|
|
|
#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
|
2024-02-04 18:24:04 +00:00
|
|
|
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)
|
|
|
|
|
2024-02-07 20:32:30 +00:00
|
|
|
|
2024-02-04 18:24:04 +00:00
|
|
|
add_executable(gd-tools_exe src/main.cpp ${SOURCES} ${HEADERS})
|
|
|
|
add_executable(gd-tools::exe ALIAS gd-tools_exe)
|
|
|
|
|
|
|
|
|
2024-02-07 20:32:30 +00:00
|
|
|
# ---- Compile ----
|
|
|
|
|
|
|
|
set_property(TARGET gd-tools_exe PROPERTY OUTPUT_NAME gd-tools)
|
2024-02-04 18:24:04 +00:00
|
|
|
target_compile_features(gd-tools_exe PRIVATE cxx_std_23)
|
|
|
|
|
2024-02-07 20:32:30 +00:00
|
|
|
#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)
|
|
|
|
|
2024-02-04 18:24:04 +00:00
|
|
|
|
|
|
|
# ---- Install rules ----
|
|
|
|
|
|
|
|
if(NOT CMAKE_SKIP_INSTALL_RULES)
|
|
|
|
include(cmake/install-rules.cmake)
|
|
|
|
endif()
|
|
|
|
|
2024-02-07 20:32:30 +00:00
|
|
|
include(cmake/dev-mode.cmake)
|
2024-02-04 18:24:04 +00:00
|
|
|
# ---- Developer mode ----
|
|
|
|
|
2024-02-07 20:32:30 +00:00
|
|
|
option(gd-tools_DEVELOPER_MODE "Test gd-tools" ON)
|
|
|
|
|
2024-02-04 18:24:04 +00:00
|
|
|
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()
|
|
|
|
|
2024-02-07 20:32:30 +00:00
|
|
|
#target_link_libraries(gd-tools_exe PRIVATE -lasan -lubsan)
|
|
|
|
|