2023-04-18 04:43:15 +00:00
cmake_minimum_required ( VERSION 3.25 ) # ubuntu 23.04 Fedora 36
2022-11-26 03:23:08 +00:00
option ( WITH_FFMPEG_PLAYER "Enable support for FFMPEG player" ON )
2022-12-06 01:45:58 +00:00
option ( WITH_EPWING_SUPPORT "Enable epwing support" ON )
2023-05-27 04:12:16 +00:00
option ( WITH_ZIM "enable zim support" ON )
2023-09-26 03:09:05 +00:00
option ( WITH_TTS "enable QTexttoSpeech support" ON )
2023-05-27 04:12:16 +00:00
2023-06-01 03:39:29 +00:00
# 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 )
2022-11-26 03:23:08 +00:00
2024-07-02 20:55:12 +00:00
option ( WITH_VCPKG_BREAKPAD "build with Breakpad support for VCPKG build only" OFF )
2024-05-13 19:27:36 +00:00
2023-08-05 04:50:00 +00:00
## Change binary & resources folder to parallel install with original GD.
## This flag should be avoided because it leads to small regressions:
## 1. There are personal scripts assuming the binary name to be "goldendict" -> require everyone to change the name in their script
## 2. There are icon themes that assuming the icon name to be "goldendict" -> invalidate the GD icon when using a icon theme
## 3. There are dictionary packages that install files to "/usr/share/goldendict/content" -> nullify the auto dict discovery
option ( USE_ALTERNATIVE_NAME "Force the name goldendict-ng " OFF )
2024-05-13 19:27:36 +00:00
set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}" ) # to put staff in the ./cmake folder
2024-07-11 07:05:10 +00:00
# vcpkg handling code, must be placed before project()
if ( WIN32 )
if ( DEFINED CMAKE_TOOLCHAIN_FILE )
message ( STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}" )
else ( )
message ( STATUS "CMAKE_TOOLCHAIN_FILE is not set. Try fetching cached vcpkg." )
include ( FetchContent )
FetchContent_Declare (
v c p k g - e x p o r t
U R L h t t p s : / / g i t h u b . c o m / x i a o y i f a n g / g o l d e n d i c t - n g / r e l e a s e s / d o w n l o a d / v c p k g _ 2 4 0 7 1 1 _ 3 d 7 2 d 8 c 9 3 0 e 1 b 6 a 1 b 2 4 3 2 b 2 6 2 c 6 1 a f 7 d 3 2 8 7 d c d 0 / g o l d e n d i c t - n g - v c p k g - e x p o r t . t a r . z s t
U R L _ H A S H S H A 5 1 2 = C B 7 A B 2 0 F 0 3 C E 1 B B 1 D 4 6 F E 5 D F 2 5 C 9 B 9 F 4 E 3 6 5 B 7 2 C E 0 A 8 1 7 B 3 C 9 E 3 9 B D 0 C 8 5 D C 5 7 1 F 9 9 2 3 6 3 A 1 A 5 E 8 D D 1 E 3 1 C 4 4 F F 8 8 C 5 1 E 9 A 8 8 A 5 3 7 6 8 8 C 6 0 7 0 B 4 E 5 8 F F 8 F A 2 5 8 5 E A B 7
)
FetchContent_MakeAvailable ( vcpkg-export )
set ( VCPKG_MANIFEST_MODE OFF CACHE BOOL "disable existing manifest mode caused by the existrance of vcpkg.json" FORCE )
set ( CMAKE_TOOLCHAIN_FILE "${CMAKE_BINARY_DIR}/_deps/vcpkg-export-src/scripts/buildsystems/vcpkg.cmake" )
endif ( )
endif ( )
if ( WITH_VCPKG_BREAKPAD )
list ( APPEND VCPKG_MANIFEST_FEATURES "breakpad" )
endif ( )
2024-07-02 20:55:12 +00:00
2023-04-18 04:43:15 +00:00
include ( FeatureSummary )
2022-11-26 03:23:08 +00:00
2023-05-05 10:43:22 +00:00
project ( goldendict-ng
2024-05-06 09:08:31 +00:00
V E R S I O N 2 4 . 0 5 . 1 3
2022-11-26 03:23:08 +00:00
L A N G U A G E S C X X C )
2024-05-03 20:14:27 +00:00
set ( GOLDENDICT "goldendict" ) # binary/executable name
2024-05-05 07:45:19 +00:00
if ( USE_ALTERNATIVE_NAME )
2023-08-05 04:50:00 +00:00
set ( GOLDENDICT "goldendict-ng" )
endif ( )
2024-05-05 07:45:19 +00:00
if ( APPLE )
2024-05-05 07:54:59 +00:00
set ( GOLDENDICT "GoldenDict-ng" )
2024-05-05 07:45:19 +00:00
endif ( )
2023-05-05 10:43:22 +00:00
2022-11-26 03:23:08 +00:00
set ( CMAKE_CXX_STANDARD 17 )
set ( CMAKE_CXX_STANDARD_REQUIRED ON )
2023-08-06 11:16:53 +00:00
#### Qt
2022-11-26 03:23:08 +00:00
2024-03-20 03:08:17 +00:00
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 } )
2022-11-26 03:23:08 +00:00
2023-08-06 11:16:53 +00:00
qt_standard_project_setup ( ) # availiable after find_package(Qt6 .... Core
set ( CMAKE_AUTORCC ON ) # not included in the qt_standard_project_setup
#### Things required during configuration
2022-11-26 03:23:08 +00:00
2023-07-30 05:21:14 +00:00
block ( ) # generate version.txt
2024-04-01 22:40:01 +00:00
string ( TIMESTAMP build_time UTC )
2023-07-30 05:21:14 +00:00
find_package ( Git )
if ( EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GIT_FOUND )
execute_process (
C O M M A N D $ { G I T _ E X E C U T A B L E } - C " $ { C M A K E _ S O U R C E _ D I R } " r e v - p a r s e - - s h o r t H E A D
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E
O U T P U T _ V A R I A B L E G I T _ H A S H )
file ( WRITE "${CMAKE_SOURCE_DIR}/version.txt" "${PROJECT_VERSION}.${GIT_HASH} at ${build_time}" )
else ( ) # not built in a git repo
file ( WRITE "${CMAKE_SOURCE_DIR}/version.txt" "${PROJECT_VERSION} at ${build_time}" )
endif ( )
endblock ( )
2022-11-26 03:23:08 +00:00
2023-08-06 11:16:53 +00:00
if ( WIN32 )
# Binaries output dir for windows. The default ${CMAKE_BINARY_DIR} is too messy, use subfolder instead
# So that we can directly use windeployqt inside the output folder and obtain a redistributable GD
set ( GD_WIN_OUTPUT_DIR ${ CMAKE_BINARY_DIR } / ${ GOLDENDICT } )
endif ( )
2022-11-26 03:23:08 +00:00
#### Sources Files
2023-04-17 17:40:05 +00:00
# auto discovery of ui files https://cmake.org/cmake/help/v3.26/prop_tgt/AUTOUIC_SEARCH_PATHS.html
set ( CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/src/ui/" )
2023-04-18 04:43:15 +00:00
# https://cmake.org/cmake/help/latest/command/file.html#filesystem
# ! Using GLOB_RECURSE is not recommended by cmake's documentation
# CONFIGURE_DEPENDS will trigger file tree recheck in every rebuilds.
file ( GLOB_RECURSE ALL_SOURCE_FILES CONFIGURE_DEPENDS src/*.cc src/*.hh src/*.c )
2022-11-26 03:23:08 +00:00
if ( APPLE )
2023-04-18 04:43:15 +00:00
file ( GLOB_RECURSE MACOS_SOURCE_FILES CONFIGURE_DEPENDS src/macos/*.mm )
2024-05-03 20:14:27 +00:00
set ( MACOS_APP_ICON ${ CMAKE_SOURCE_DIR } /icons/macicon.icns )
set_source_files_properties ( ${ MACOS_APP_ICON } PROPERTIES MACOSX_PACKAGE_LOCATION "Resources" )
2022-11-26 03:23:08 +00:00
endif ( )
2023-08-06 11:16:53 +00:00
if ( WIN32 )
set ( WINDOWS_ICON_RC icons/programicon.rc )
endif ( )
2023-04-18 04:43:15 +00:00
set ( QSINGLEAPP_SOURCE_FILES
2022-11-26 03:23:08 +00:00
t h i r d p a r t y / q t s i n g l e a p p l i c a t i o n / s r c / q t l o c a l p e e r . c p p
t h i r d p a r t y / q t s i n g l e a p p l i c a t i o n / s r c / q t l o c a l p e e r . h
t h i r d p a r t y / q t s i n g l e a p p l i c a t i o n / s r c / q t s i n g l e a p p l i c a t i o n . c p p
t h i r d p a r t y / q t s i n g l e a p p l i c a t i o n / s r c / q t s i n g l e a p p l i c a t i o n . h
2023-08-06 11:16:53 +00:00
)
2022-11-26 03:23:08 +00:00
2023-08-06 11:16:53 +00:00
qt_add_executable ( ${ GOLDENDICT } )
2023-05-05 10:43:22 +00:00
2023-05-28 00:32:36 +00:00
target_sources ( ${ GOLDENDICT } PRIVATE
2023-04-18 04:43:15 +00:00
i c o n s / f l a g s . q r c
r e s o u r c e s . q r c
s r c / s c r i p t s / s c r i p t s . q r c
s r c / s t y l e s h e e t s / c s s . q r c
$ { A L L _ S O U R C E _ F I L E S }
$ { M A C O S _ S O U R C E _ F I L E S }
2024-05-03 20:14:27 +00:00
$ { M A C O S _ A P P _ I C O N }
2023-08-06 11:16:53 +00:00
$ { Q S I N G L E A P P _ S O U R C E _ F I L E S }
$ { W I N D O W S _ I C O N _ R C }
)
2022-11-26 03:23:08 +00:00
2023-06-01 03:39:29 +00:00
if ( NOT USE_SYSTEM_FMT )
target_sources ( ${ GOLDENDICT } PRIVATE thirdparty/fmt/format.cc )
endif ( )
2023-04-18 04:43:15 +00:00
### Common parts amount all platforms
2022-12-14 10:00:15 +00:00
2023-05-05 10:43:22 +00:00
# Note: used as c++ string thus need surrounding " "
2023-04-18 04:43:15 +00:00
add_compile_definitions ( PROGRAM_VERSION= "${PROJECT_VERSION}" )
2022-11-26 03:23:08 +00:00
2023-05-05 10:43:22 +00:00
target_link_libraries ( ${ GOLDENDICT } PRIVATE
2022-11-26 03:23:08 +00:00
Q t 6 : : X m l
Q t 6 : : C o n c u r r e n t
Q t 6 : : C o r e 5 C o m p a t
Q t 6 : : M u l t i m e d i a
2024-01-31 07:04:35 +00:00
Q t 6 : : P r i n t S u p p o r t
2022-11-26 03:23:08 +00:00
Q t 6 : : W e b E n g i n e W i d g e t s
Q t 6 : : W i d g e t s
Q t 6 : : S v g
)
2024-03-20 03:08:17 +00:00
if ( WITH_TTS )
target_link_libraries ( ${ GOLDENDICT } PRIVATE Qt6::TextToSpeech )
endif ( )
2022-11-26 03:23:08 +00:00
2023-05-28 00:32:36 +00:00
target_include_directories ( ${ GOLDENDICT } PRIVATE
2023-04-18 04:43:15 +00:00
$ { P R O J E C T _ S O U R C E _ D I R } / t h i r d p a r t y / q t s i n g l e a p p l i c a t i o n / s r c
$ { P R O J E C T _ S O U R C E _ D I R } / s r c /
$ { P R O J E C T _ S O U R C E _ D I R } / s r c / c o m m o n
$ { P R O J E C T _ S O U R C E _ D I R } / s r c / d i c t
2023-04-29 06:59:19 +00:00
$ { P R O J E C T _ S O U R C E _ D I R } / s r c / u i
2023-05-05 10:43:22 +00:00
)
2024-05-13 19:27:36 +00:00
if ( WIN32 )
target_include_directories ( ${ GOLDENDICT } PRIVATE ${ PROJECT_SOURCE_DIR } /src/windows )
endif ( )
2023-06-01 03:39:29 +00:00
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 ( )
2023-05-05 10:43:22 +00:00
#### Compile definitions
2023-04-18 04:43:15 +00:00
2023-05-05 10:43:22 +00:00
target_compile_definitions ( ${ GOLDENDICT } PUBLIC
C M A K E _ U S E D _ H A C K # temporal hack to avoid breaking qmake build
U S E _ I C O N V
M A K E _ Q T M U L T I M E D I A _ P L A Y E R
M A K E _ C H I N E S E _ C O N V E R S I O N _ S U P P O R T
)
2023-04-18 04:43:15 +00:00
2024-05-13 19:27:36 +00:00
if ( WIN32 )
target_compile_definitions ( ${ GOLDENDICT } PUBLIC
_ _ W I N 3 2
I N C L U D E _ L I B R A R Y _ P A T H
)
endif ( )
2023-04-18 04:43:15 +00:00
if ( WITH_FFMPEG_PLAYER )
2023-05-05 10:43:22 +00:00
target_compile_definitions ( ${ GOLDENDICT } PUBLIC MAKE_FFMPEG_PLAYER )
2023-04-18 04:43:15 +00:00
endif ( )
2023-09-26 03:09:05 +00:00
if ( NOT WITH_TTS )
target_compile_definitions ( ${ GOLDENDICT } PUBLIC NO_TTS_SUPPORT )
endif ( )
2023-04-18 04:43:15 +00:00
if ( NOT WITH_EPWING_SUPPORT )
2023-05-05 10:43:22 +00:00
target_compile_definitions ( ${ GOLDENDICT } PUBLIC NO_EPWING_SUPPORT )
2023-04-18 04:43:15 +00:00
endif ( )
2022-11-26 03:23:08 +00:00
2023-06-01 03:39:29 +00:00
if ( WITH_ZIM )
target_compile_definitions ( ${ GOLDENDICT } PUBLIC MAKE_ZIM_SUPPORT )
endif ( )
2023-05-27 04:12:16 +00:00
2024-07-02 20:55:12 +00:00
if ( WITH_VCPKG_BREAKPAD )
target_compile_definitions ( ${ GOLDENDICT } PUBLIC USE_BREAKPAD )
endif ( )
2023-05-05 10:43:22 +00:00
#### libraries linking && includes for Win or Unix
2023-04-18 04:43:15 +00:00
2024-07-11 07:05:10 +00:00
if ( WIN32 )
2024-05-13 19:27:36 +00:00
include ( Deps_Vcpkg )
2023-05-05 10:43:22 +00:00
else ( )
2024-05-13 19:27:36 +00:00
include ( Deps_Unix )
2023-04-18 04:43:15 +00:00
endif ( )
2023-05-05 10:43:22 +00:00
#### add translations
2023-04-18 04:43:15 +00:00
2022-11-26 03:23:08 +00:00
# include all *ts files under locale
file ( GLOB TRANS_FILES "locale/*.ts" )
2023-08-06 11:16:53 +00:00
if ( WIN32 )
# Put generated files to output dir's locale
set_source_files_properties ( ${ TRANS_FILES } PROPERTIES OUTPUT_LOCATION "${GD_WIN_OUTPUT_DIR}/locale" )
else ( )
set_source_files_properties ( ${ TRANS_FILES } PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/locale" )
endif ( )
2024-05-13 19:27:36 +00:00
2023-05-05 10:43:22 +00:00
qt_add_translations ( ${ GOLDENDICT } TS_FILES ${ TRANS_FILES }
2022-11-26 03:23:08 +00:00
Q M _ F I L E S _ O U T P U T _ V A R I A B L E q m _ f i l e s )
2024-06-09 12:48:23 +00:00
add_dependencies ( ${ GOLDENDICT } "release_translations" )
2022-11-26 03:23:08 +00:00
2023-08-06 11:16:53 +00:00
#### installation or assemble redistribution
2023-05-05 10:43:22 +00:00
if ( APPLE )
2024-05-03 20:14:27 +00:00
set ( PLIST_FILE "${CMAKE_BINARY_DIR}/info_generated.plist" )
configure_file ( "${CMAKE_SOURCE_DIR}/redist/mac_info_plist_template_cmake.plist" "${PLIST_FILE}" @ONLY )
2023-05-05 10:43:22 +00:00
set_target_properties ( ${ GOLDENDICT } PROPERTIES
M A C O S X _ B U N D L E T R U E
2024-05-03 20:14:27 +00:00
M A C O S X _ B U N D L E _ I N F O _ P L I S T " $ { P L I S T _ F I L E } "
)
set ( Assembling_Dir "${CMAKE_BINARY_DIR}/redist" )
2024-05-05 07:45:19 +00:00
set ( App_Name "${GOLDENDICT}.app" )
2024-05-05 05:24:32 +00:00
set ( Redistributable_APP "${Assembling_Dir}/${App_Name}" )
2024-05-05 07:45:19 +00:00
2024-05-03 20:14:27 +00:00
qt_generate_deploy_script (
T A R G E T $ { G O L D E N D I C T }
O U T P U T _ S C R I P T d e p l o y _ s c r i p t
C O N T E N T " qt_deploy_runtime_dependencies (
E X E C U T A B L E \ " $ { R e d i s t r i b u t a b l e _ A P P } \ "
G E N E R A T E _ Q T _ C O N F
N O _ A P P _ S T O R E _ C O M P L I A N C E
) "
)
install ( TARGETS ${ GOLDENDICT } BUNDLE DESTINATION "${Assembling_Dir}" )
install ( FILES ${ qm_files } DESTINATION "${Redistributable_APP}/Contents/MacOS/locale" )
install ( DIRECTORY "${CMAKE_SOURCE_DIR}/opencc" DESTINATION "${Redistributable_APP}/Contents/MacOS" )
install ( SCRIPT ${ deploy_script } )
install ( CODE "execute_process(COMMAND codesign --force --deep -s - ${Redistributable_APP})" )
find_program ( CREATE-DMG "create-dmg" )
if ( CREATE-DMG )
install ( CODE "
execute_process ( COMMAND ${ CREATE-DMG } \
- - s k i p - j e n k i n s \
- - f o r m a t \ " U L M O \ "
- - v o l n a m e $ { C M A K E _ P R O J E C T _ N A M E } - $ { C M A K E _ P R O J E C T _ V E R S I O N } - $ { C M A K E _ S Y S T E M _ P R O C E S S O R } \
- - v o l i c o n $ { C M A K E _ S O U R C E _ D I R } / i c o n s / m a c i c o n . i c n s \
2024-05-05 05:24:32 +00:00
- - i c o n \ " $ { A p p _ N a m e } \ " 1 0 0 1 0 0
2024-05-03 20:14:27 +00:00
- - a p p - d r o p - l i n k 3 0 0 1 0 0 \
2024-07-09 03:12:43 +00:00
\ " G o l d e n D i c t - n g - $ { C M A K E _ P R O J E C T _ V E R S I O N } - Q t $ { Q t 6 _ V E R S I O N } - m a c O S - $ { C M A K E _ S Y S T E M _ P R O C E S S O R } . d m g \ " \
2024-05-03 20:14:27 +00:00
\ " $ { A s s e m b l i n g _ D i r } \ " ) "
)
else ( )
message ( WARNING "create-dmg not found. No .dmg will be created" )
endif ( )
2023-05-05 10:43:22 +00:00
endif ( )
2022-11-26 03:23:08 +00:00
2023-05-05 10:43:22 +00:00
if ( LINUX OR BSD )
2023-08-06 11:16:53 +00:00
install ( TARGETS ${ GOLDENDICT } )
2023-07-25 12:04:49 +00:00
install ( FILES ${ CMAKE_SOURCE_DIR } /redist/io.github.xiaoyifang.goldendict_ng.desktop DESTINATION share/applications )
install ( FILES ${ CMAKE_SOURCE_DIR } /redist/io.github.xiaoyifang.goldendict_ng.metainfo.xml DESTINATION share/metainfo )
2022-11-26 03:23:08 +00:00
2023-08-05 04:50:00 +00:00
if ( NOT USE_ALTERNATIVE_NAME )
# see: config.cc -> getProgramDataDir
add_compile_definitions ( PROGRAM_DATA_DIR= "${CMAKE_INSTALL_PREFIX}/share/goldendict" )
install ( FILES ${ CMAKE_SOURCE_DIR } /redist/icons/goldendict.png DESTINATION share/pixmaps )
install ( FILES ${ qm_files } DESTINATION share/goldendict/locale )
else ( )
add_compile_definitions ( PROGRAM_DATA_DIR= "${CMAKE_INSTALL_PREFIX}/share/goldendict-ng" )
install ( FILES ${ CMAKE_SOURCE_DIR } /redist/icons/goldendict.png DESTINATION share/pixmaps
R E N A M E g o l d e n d i c t - n g . p n g )
install ( FILES ${ qm_files } DESTINATION share/goldendict-ng/locale )
block ( ) # patch the desktop file to adapt the binary & icon file's name change
file ( READ "${CMAKE_SOURCE_DIR}/redist/io.github.xiaoyifang.goldendict_ng.desktop" DESKTOP_FILE_CONTENT )
string ( REGEX REPLACE "\nIcon=goldendict\n" "\nIcon=goldendict-ng\n" DESKTOP_FILE_CONTENT "${DESKTOP_FILE_CONTENT}" )
string ( REGEX REPLACE "\nExec=goldendict %u\n" "\nExec=goldendict-ng %u\n" DESKTOP_FILE_CONTENT "${DESKTOP_FILE_CONTENT}" )
file ( WRITE "${CMAKE_SOURCE_DIR}/redist/io.github.xiaoyifang.goldendict_ng.desktop" "${DESKTOP_FILE_CONTENT}" )
endblock ( )
endif ( )
2023-04-18 04:43:15 +00:00
endif ( )
2022-11-26 03:23:08 +00:00
2023-08-06 11:16:53 +00:00
if ( WIN32 )
2024-05-13 19:27:36 +00:00
2023-08-06 11:16:53 +00:00
set_target_properties ( ${ GOLDENDICT }
P R O P E R T I E S
W I N 3 2 _ E X E C U T A B L E T R U E
R U N T I M E _ O U T P U T _ D I R E C T O R Y " $ { G D _ W I N _ O U T P U T _ D I R } "
L I B R A R Y _ O U T P U T _ D I R E C T O R Y " $ { G D _ W I N _ O U T P U T _ D I R } "
)
2024-07-11 07:05:10 +00:00
set ( CMAKE_INSTALL_PREFIX "${GD_WIN_OUTPUT_DIR}" CACHE PATH "If you see this message, don't change this unless you want look into CMake build script. If you are an expert, yes, this is wrong. Help welcomed." FORCE )
2024-05-13 19:27:36 +00:00
2024-07-11 07:05:10 +00:00
qt_generate_deploy_script (
T A R G E T $ { G O L D E N D I C T }
O U T P U T _ S C R I P T d e p l o y _ s c r i p t
C O N T E N T " qt_deploy_runtime_dependencies (
E X E C U T A B L E \ " $ { C M A K E _ I N S T A L L _ P R E F I X } / g o l d e n d i c t . e x e \ "
B I N _ D I R .
L I B _ D I R .
) "
)
2024-05-13 19:27:36 +00:00
2024-07-11 07:05:10 +00:00
install ( SCRIPT ${ deploy_script } )
install ( DIRECTORY "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/opencc" DESTINATION . )
# TODO: do we really need to carry a copy of openSSL?
install ( FILES "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin/libssl-3-x64.dll" DESTINATION . )
install ( FILES "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin/libcrypto-3-x64.dll" DESTINATION . )
2024-04-05 04:05:06 +00:00
2024-05-13 19:27:36 +00:00
# trick CPack to make the output folder as NSIS installer
install ( DIRECTORY "${GD_WIN_OUTPUT_DIR}/"
D E S T I N A T I O N .
F I L E S _ M A T C H I N G
P A T T E R N " * "
P A T T E R N " * . p d b " E X C L U D E
P A T T E R N " * . i l k " E X C L U D E )
2024-07-09 03:12:43 +00:00
set ( CPACK_PACKAGE_FILE_NAME "GoldenDict-ng-${PROJECT_VERSION}-Qt${Qt6Widgets_VERSION}" )
2024-07-07 04:23:32 +00:00
set ( CPACK_GENERATOR "7Z;NSIS64" )
# override the default install path, which is $PROGRAMFILES64\${project-name} ${project-version} in NSIS
set ( CPACK_PACKAGE_INSTALL_DIRECTORY "GoldenDict-ng" )
# NSIS specificS
2024-04-05 04:05:06 +00:00
set ( CPACK_NSIS_MANIFEST_DPI_AWARE ON )
2024-07-07 04:23:32 +00:00
set ( CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/icons/programicon.ico" )
set ( CPACK_NSIS_PACKAGE_NAME "${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}" )
set ( CPACK_NSIS_DISPLAY_NAME "${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}" )
set ( CPACK_NSIS_URL_INFO_ABOUT [=[https://xiaoyifang.github.io/goldendict-ng/]=] )
2024-04-05 04:05:06 +00:00
set ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt" )
2024-07-07 04:23:32 +00:00
set ( CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\GoldenDict-ng.lnk' '$INSTDIR\\\\${GOLDENDICT}.exe'" )
set ( CPACK_NSIS_DELETE_ICONS_EXTRA "Delete '$SMPROGRAMS\\\\$START_MENU\\\\GoldenDict-ng.lnk'" )
2024-05-13 19:27:36 +00:00
2024-07-07 04:23:32 +00:00
include ( CPack )
2023-08-06 11:16:53 +00:00
endif ( )
2023-04-18 04:43:15 +00:00
2023-05-17 23:56:17 +00:00
feature_summary ( WHAT ALL DESCRIPTION "Build configuration:" )