Skip to content

Commit

Permalink
fix: address CMake problems found by openBSD package
Browse files Browse the repository at this point in the history
* remove unused WITH_XAPIAN option
* don't link Qt TTS if not requested
  • Loading branch information
shenlebantongying committed Mar 19, 2024
1 parent ebce607 commit 8e2ddea
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 30 deletions.
29 changes: 10 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.25) # ubuntu 23.04 Fedora 36

option(WITH_FFMPEG_PLAYER "Enable support for FFMPEG player" ON)
option(WITH_EPWING_SUPPORT "Enable epwing support" ON)
option(WITH_XAPIAN "enable Xapian support" ON)
option(WITH_ZIM "enable zim support" ON)
option(WITH_TTS "enable QTexttoSpeech support" ON)

Expand Down Expand Up @@ -36,18 +35,13 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

#### Qt

find_package(Qt6 REQUIRED COMPONENTS
Concurrent
Core5Compat
LinguistTools
Multimedia
PrintSupport
WebEngineWidgets
Widgets
Svg
Xml
TextToSpeech
)
set(GD_QT_COMPONENTS Concurrent Core5Compat LinguistTools Multimedia PrintSupport WebEngineWidgets Widgets Svg Xml)

if (WITH_TTS)
list(APPEND GD_QT_COMPONENTS TextToSpeech)
endif ()

find_package(Qt6 REQUIRED COMPONENTS ${GD_QT_COMPONENTS})

qt_standard_project_setup() # availiable after find_package(Qt6 .... Core
set(CMAKE_AUTORCC ON) # not included in the qt_standard_project_setup
Expand Down Expand Up @@ -130,9 +124,11 @@ target_link_libraries(${GOLDENDICT} PRIVATE
Qt6::WebEngineWidgets
Qt6::Widgets
Qt6::Svg
Qt6::TextToSpeech
)

if (WITH_TTS)
target_link_libraries(${GOLDENDICT} PRIVATE Qt6::TextToSpeech)
endif ()

target_include_directories(${GOLDENDICT} PRIVATE
${PROJECT_SOURCE_DIR}/thirdparty/qtsingleapplication/src
Expand Down Expand Up @@ -172,11 +168,6 @@ if (NOT WITH_EPWING_SUPPORT)
target_compile_definitions(${GOLDENDICT} PUBLIC NO_EPWING_SUPPORT)
endif ()


if (WITH_XAPIAN)
target_compile_definitions(${GOLDENDICT} PUBLIC USE_XAPIAN)
endif ()

if (WITH_ZIM)
target_compile_definitions(${GOLDENDICT} PUBLIC MAKE_ZIM_SUPPORT)
endif ()
Expand Down
13 changes: 3 additions & 10 deletions CMake_Unix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@ endif ()

##### Finding packages from package manager


find_package(PkgConfig REQUIRED)
# Provided by Cmake
find_package(ZLIB REQUIRED)
find_package(BZip2 REQUIRED)


# Consider all PkgConfig dependencies as one
pkg_check_modules(PKGCONFIG_DEPS IMPORTED_TARGET
hunspell
Expand All @@ -43,7 +40,8 @@ pkg_check_modules(PKGCONFIG_DEPS IMPORTED_TARGET
vorbis # .ogg
vorbisfile
liblzma
)
xapian-core
)

target_link_libraries(${GOLDENDICT} PRIVATE
PkgConfig::PKGCONFIG_DEPS
Expand All @@ -69,15 +67,10 @@ if (WITH_FFMPEG_PLAYER)
libavformat
libavutil
libswresample
)
)
target_link_libraries(${GOLDENDICT} PRIVATE PkgConfig::FFMPEG)
endif ()

if (WITH_XAPIAN)
find_package(Xapian REQUIRED) # https://github.com/xapian/xapian/tree/master/xapian-core/cmake
target_link_libraries(${GOLDENDICT} PRIVATE ${XAPIAN_LIBRARIES})
endif ()

if (WITH_EPWING_SUPPORT)
find_library(EB_LIBRARY eb REQUIRED)
target_link_libraries(${GOLDENDICT} PRIVATE ${EB_LIBRARY})
Expand Down
1 change: 0 additions & 1 deletion src/version.hh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Version {

const QLatin1String flags = QLatin1String(
"USE_XAPIAN"
#ifdef MAKE_ZIM_SUPPORT
" MAKE_ZIM_SUPPORT"
#endif
Expand Down

0 comments on commit 8e2ddea

Please sign in to comment.