cmake: updates

* add USE_SYSTEM_FMT & USE_SYSTEM_TOML
* switch back to libeb
This commit is contained in:
shenleban tongying 2023-05-31 23:39:29 -04:00 committed by YiFang Xiao
parent 88eda36125
commit 97eec7012c
6 changed files with 38 additions and 20 deletions

View file

@ -53,7 +53,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: true
submodules: false
- name: Run build-wrapper
run: |
@ -106,7 +106,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: true
submodules: false
- name: install dependencies
run: |
brew install pcre2 harfbuzz freetype

View file

@ -8,6 +8,9 @@ option(WITH_EPWING_SUPPORT "Enable epwing support" ON)
option(WITH_XAPIAN "enable Xapian support" ON)
option(WITH_ZIM "enable zim support" ON)
# options for linux packaging
option(USE_SYSTEM_FMT "use system fmt instead of bundled one" OFF)
option(USE_SYSTEM_TOML "use system toml++ instead of bundled one" OFF)
include(FeatureSummary)
@ -79,11 +82,14 @@ target_sources(${GOLDENDICT} PRIVATE
resources.qrc
src/scripts/scripts.qrc
src/stylesheets/css.qrc
thirdparty/fmt/format.cc
${ALL_SOURCE_FILES}
${MACOS_SOURCE_FILES}
${QSINGLEAPP_SOURCE_FILES})
if (NOT USE_SYSTEM_FMT)
target_sources(${GOLDENDICT} PRIVATE thirdparty/fmt/format.cc)
endif ()
### Common parts amount all platforms
# Note: used as c++ string thus need surrounding " "
@ -108,9 +114,16 @@ target_include_directories(${GOLDENDICT} PRIVATE
${PROJECT_SOURCE_DIR}/src/dict
${PROJECT_SOURCE_DIR}/src/ui
${PROJECT_SOURCE_DIR}/thirdparty/tomlplusplus
${PROJECT_SOURCE_DIR}/thirdparty/fmt/include
)
if (NOT USE_SYSTEM_TOML)
target_include_directories(${GOLDENDICT} PRIVATE ${PROJECT_SOURCE_DIR}/thirdparty/tomlplusplus)
endif ()
if (NOT USE_SYSTEM_FMT)
target_include_directories(${GOLDENDICT} PRIVATE ${PROJECT_SOURCE_DIR}/thirdparty/fmt/include)
endif ()
#### Compile definitions
target_compile_definitions(${GOLDENDICT} PUBLIC
@ -134,11 +147,9 @@ if (WITH_XAPIAN)
target_compile_definitions(${GOLDENDICT} PUBLIC USE_XAPIAN)
endif ()
if(WITH_ZIM)
target_compile_definitions(${GOLDENDICT} PUBLIC
MAKE_ZIM_SUPPORT
)
endif()
if (WITH_ZIM)
target_compile_definitions(${GOLDENDICT} PUBLIC MAKE_ZIM_SUPPORT)
endif ()
#### libraries linking && includes for Win or Unix

View file

@ -44,10 +44,9 @@ pkg_check_modules(PKGCONFIG_DEPS IMPORTED_TARGET
)
target_link_libraries(${GOLDENDICT} PRIVATE
# pkg-config packages need manually link
PkgConfig::PKGCONFIG_DEPS
BZip2::BZip2
ZLIB::ZLIB #hidden requirement of dsl_details.cc and more?
ZLIB::ZLIB
Iconv::Iconv
)
@ -67,13 +66,21 @@ if (WITH_XAPIAN)
endif ()
if (WITH_EPWING_SUPPORT)
add_subdirectory(thirdparty/eb EXCLUDE_FROM_ALL)
target_link_libraries(${GOLDENDICT} PRIVATE eb)
find_library(EB_LIBRARY eb REQUIRED)
target_link_libraries(${GOLDENDICT} PRIVATE ${EB_LIBRARY})
endif ()
if(WITH_ZIM)
pkg_check_modules(ZIM REQUIRED IMPORTED_TARGET
libzim
)
if (WITH_ZIM)
pkg_check_modules(ZIM REQUIRED IMPORTED_TARGET libzim)
target_link_libraries(${GOLDENDICT} PRIVATE PkgConfig::ZIM)
endif()
endif ()
if (USE_SYSTEM_FMT)
find_package(fmt)
target_link_libraries(${GOLDENDICT} PRIVATE fmt::fmt)
endif ()
if (USE_SYSTEM_TOML)
find_package(tomlplusplus)
target_link_libraries(${GOLDENDICT} PRIVATE tomlplusplus::tomlplusplus)
endif ()

View file

@ -412,7 +412,7 @@ HEADERS += \
src/wordfinder.hh \
src/wordlist.hh \
src/zipfile.hh \
thirdparty/tomlplusplus/toml.hpp
thirdparty/tomlplusplus/toml++/toml.h
FORMS += $$files(src/ui/*.ui)

View file

@ -1,5 +1,5 @@
#include "metadata.hh"
#include "toml.hpp"
#include "toml++/toml.h"
#include <QDebug>
#include <QFile>