-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
# Description This commit switches the project's build system from qmake to CMake. Using CMake has several advantages: * Looking forward, Qt 6 uses CMake by default. It will be easier to migrate to Qt 6 with CMake as the default build system. * CMake is essentially an industry standard for C++ projects. This is a good learning opportunity, and because there are many people using CMake, it is easy to find resources for most edge-cases. * Automatic discovery of tests whose build system is CMake-by-default. Part of a series of commits for #136. ## Type of change - [x] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [x] This change requires a documentation update # How Has This Been Tested? Tested by building debug builds on macOS, Windows, and Linux. Packaging for release has not yet been tested, and will be tested once a release is closer. # Checklist: - [x] My code follows the style guidelines of this project (`black` for Python code, `.clang-format` in the `src/jyut-dict` directory for C++) - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have translated my user-facing strings to all currently-supported languages - [x] I have made corresponding changes to the documentation
1 parent
f5f7bd6
commit 83e44f0
Showing
7 changed files
with
238 additions
and
374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,232 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
project(CantoneseDictionary VERSION 2.23.0408 LANGUAGES CXX) | ||
|
||
set(CMAKE_AUTOUIC ON) | ||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS | ||
LinguistTools | ||
Multimedia | ||
Network | ||
Sql | ||
Svg | ||
TextToSpeech | ||
Widgets) | ||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS | ||
LinguistTools | ||
Multimedia | ||
Network | ||
Sql | ||
Svg | ||
TextToSpeech | ||
Widgets) | ||
find_package(KF5Archive) | ||
|
||
set(TS_FILES | ||
resources/translations/jyutdictionary-en.ts | ||
resources/translations/jyutdictionary-fr.ts | ||
resources/translations/jyutdictionary-fr_CA.ts | ||
resources/translations/jyutdictionary-yue_Hans.ts | ||
resources/translations/jyutdictionary-yue_Hant.ts | ||
resources/translations/jyutdictionary-zh_Hans.ts | ||
resources/translations/jyutdictionary-zh_Hant.ts | ||
resources/translations/jyutdictionary-zh_Hans_HK.ts | ||
resources/translations/jyutdictionary-zh_Hant_HK.ts) | ||
|
||
set(PROJECT_SOURCES | ||
components/definitioncard/definitioncardsection.cpp | ||
components/definitioncard/definitioncardwidget.cpp | ||
components/definitioncard/definitioncontentwidget.cpp | ||
components/definitioncard/definitionheaderwidget.cpp | ||
components/dictionarylist/dictionarylistdelegate.cpp | ||
components/dictionarylist/dictionarylistmodel.cpp | ||
components/dictionarylist/dictionarylistview.cpp | ||
components/entrysearchresult/resultlistdelegate.cpp | ||
components/entrysearchresult/resultlistmodel.cpp | ||
components/entrysearchresult/resultlistview.cpp | ||
components/entryview/entryactionwidget.cpp | ||
components/entryview/entrycontentwidget.cpp | ||
components/entryview/entryheaderwidget.cpp | ||
components/entryview/entryscrollarea.cpp | ||
components/entryview/entryscrollareawidget.cpp | ||
components/entryview/entryviewsentencecardsection.cpp | ||
components/favouritewindow/favouritesplitter.cpp | ||
components/historyview/searchhistorylistdelegate.cpp | ||
components/historyview/searchhistorylistmodel.cpp | ||
components/historyview/searchhistorylistview.cpp | ||
components/historyview/searchhistorytab.cpp | ||
components/historyview/viewhistorylistdelegate.cpp | ||
components/historyview/viewhistorylistmodel.cpp | ||
components/historyview/viewhistorylistview.cpp | ||
components/historyview/viewhistorytab.cpp | ||
components/layouts/flowlayout.cpp | ||
components/magnifywindow/magnifyscrollarea.cpp | ||
components/magnifywindow/magnifyscrollareawidget.cpp | ||
components/mainwindow/mainsplitter.cpp | ||
components/mainwindow/maintoolbar.cpp | ||
components/mainwindow/searchlineedit.cpp | ||
components/mainwindow/searchoptionsradiogroupbox.cpp | ||
components/related/relatedbutton.cpp | ||
components/related/relatedbuttoncontentwidget.cpp | ||
components/related/relatedbuttonheaderwidget.cpp | ||
components/related/relatedsection.cpp | ||
components/sentencecard/loadingwidget.cpp | ||
components/sentencecard/sentencecardwidget.cpp | ||
components/sentencecard/sentencecontentwidget.cpp | ||
components/sentencecard/sentenceheaderwidget.cpp | ||
components/sentencesearchresult/sentenceresultlistdelegate.cpp | ||
components/sentencesearchresult/sentenceresultlistmodel.cpp | ||
components/sentencesearchresult/sentenceresultlistview.cpp | ||
components/sentenceview/sentencescrollarea.cpp | ||
components/sentenceview/sentencescrollareawidget.cpp | ||
components/sentenceview/sentenceviewcontentwidget.cpp | ||
components/sentenceview/sentenceviewheaderwidget.cpp | ||
components/sentenceview/sentenceviewsentencecardsection.cpp | ||
components/sentencewindow/sentencesplitter.cpp | ||
components/settings/advancedtab.cpp | ||
components/settings/contacttab.cpp | ||
components/settings/dictionarytab.cpp | ||
components/settings/settingstab.cpp | ||
components/settings/texttab.cpp | ||
dialogs/defaultdialog.cpp | ||
dialogs/dictionarytabfailuredialog.cpp | ||
dialogs/downloadaudiodialog.cpp | ||
dialogs/downloadresultdialog.cpp | ||
dialogs/entryspeakerrordialog.cpp | ||
dialogs/exportdatabasedialog.cpp | ||
dialogs/noupdatedialog.cpp | ||
dialogs/overwriteconflictingdictionarydialog.cpp | ||
dialogs/resetsettingsdialog.cpp | ||
dialogs/restoredatabasedialog.cpp | ||
logic/database/queryparseutils.cpp | ||
logic/database/sqldatabasemanager.cpp | ||
logic/database/sqldatabaseutils.cpp | ||
logic/database/sqluserdatautils.cpp | ||
logic/database/sqluserhistoryutils.cpp | ||
logic/dictionary/dictionarymetadata.cpp | ||
logic/dictionary/dictionarysource.cpp | ||
logic/download/downloader.cpp | ||
logic/entry/definitionsset.cpp | ||
logic/entry/entry.cpp | ||
logic/entry/entryspeaker.cpp | ||
logic/search/searchoptionsmediator.cpp | ||
logic/search/sqlsearch.cpp | ||
logic/sentence/sentenceset.cpp | ||
logic/sentence/sourcesentence.cpp | ||
logic/settings/settings.cpp | ||
logic/settings/settingsutils.cpp | ||
logic/update/jyutdictionaryreleasechecker.cpp | ||
logic/utils/chineseutils.cpp | ||
logic/utils/scriptdetector.cpp | ||
logic/utils/utils.cpp | ||
logic/utils/utils_qt.cpp | ||
main.cpp | ||
windows/aboutwindow.cpp | ||
windows/historywindow.cpp | ||
windows/mainwindow.cpp | ||
windows/settingswindow.cpp | ||
windows/updatewindow.cpp | ||
${TS_FILES} | ||
) | ||
|
||
include_directories( | ||
${CMAKE_SOURCE_DIR} | ||
) | ||
|
||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) | ||
qt_add_executable(CantoneseDictionary | ||
MANUAL_FINALIZATION | ||
${PROJECT_SOURCES} | ||
resources/resource.qrc | ||
) | ||
|
||
# qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) | ||
else() | ||
add_executable(CantoneseDictionary | ||
${PROJECT_SOURCES} | ||
resources/resource.qrc | ||
) | ||
|
||
# qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) | ||
endif() | ||
|
||
target_link_libraries(CantoneseDictionary | ||
PRIVATE Qt${QT_VERSION_MAJOR}::Widgets | ||
PRIVATE Qt${QT_VERSION_MAJOR}::Multimedia | ||
PRIVATE Qt${QT_VERSION_MAJOR}::Network | ||
PRIVATE Qt${QT_VERSION_MAJOR}::Sql | ||
PRIVATE Qt${QT_VERSION_MAJOR}::Svg | ||
PRIVATE Qt${QT_VERSION_MAJOR}::TextToSpeech | ||
PRIVATE KF5::Archive | ||
) | ||
|
||
add_subdirectory( | ||
logic/utils/test/TestChineseUtils | ||
) | ||
add_subdirectory( | ||
logic/utils/test/TestScriptDetector | ||
) | ||
|
||
set_target_properties(CantoneseDictionary PROPERTIES | ||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/platform/mac/Info.plist | ||
MACOSX_BUNDLE TRUE | ||
WIN32_EXECUTABLE TRUE | ||
) | ||
|
||
if (APPLE) | ||
target_link_libraries(CantoneseDictionary PRIVATE "-framework AppKit") | ||
TARGET_SOURCES(CantoneseDictionary | ||
PRIVATE logic/utils/utils_mac.mm | ||
PRIVATE resources/db/dict.db | ||
PRIVATE resources/db/user.db | ||
PRIVATE resources/licenses/FLOW_LAYOUT_LICENSE.txt | ||
PRIVATE resources/settings/settings.ini | ||
PRIVATE resources/icon/icon.icns | ||
PRIVATE platform/mac/en.lproj/InfoPlist.strings | ||
PRIVATE platform/mac/fr.lproj/InfoPlist.strings | ||
PRIVATE platform/mac/yue_Hans.lproj/InfoPlist.strings | ||
PRIVATE platform/mac/yue_Hant.lproj/InfoPlist.strings | ||
PRIVATE platform/mac/zh_Hans.lproj/InfoPlist.strings | ||
PRIVATE platform/mac/zh_Hant.lproj/InfoPlist.strings) | ||
|
||
set_property(SOURCE resources/db/dict.db PROPERTY MACOSX_PACKAGE_LOCATION "Resources") | ||
set_property(SOURCE resources/db/user.db PROPERTY MACOSX_PACKAGE_LOCATION "Resources") | ||
set_property(SOURCE resources/licenses/FLOW_LAYOUT_LICENSE.txt PROPERTY MACOSX_PACKAGE_LOCATION "Resources/Licenses") | ||
set_property(SOURCE resources/settings/settings.ini PROPERTY MACOSX_PACKAGE_LOCATION "Resources") | ||
set_property(SOURCE resources/icon/icon.icns PROPERTY MACOSX_PACKAGE_LOCATION "Resources") | ||
set_property(SOURCE platform/mac/en.lproj/InfoPlist.strings PROPERTY MACOSX_PACKAGE_LOCATION "Resources/en.lproj") | ||
set_property(SOURCE platform/mac/fr.lproj/InfoPlist.strings PROPERTY MACOSX_PACKAGE_LOCATION "Resources/fr.lproj") | ||
set_property(SOURCE platform/mac/yue_Hans.lproj/InfoPlist.strings PROPERTY MACOSX_PACKAGE_LOCATION "Resources/yue-Hans.lproj") | ||
set_property(SOURCE platform/mac/yue_Hant.lproj/InfoPlist.strings PROPERTY MACOSX_PACKAGE_LOCATION "Resources/yue-Hant.lproj") | ||
set_property(SOURCE platform/mac/zh_Hans.lproj/InfoPlist.strings PROPERTY MACOSX_PACKAGE_LOCATION "Resources/zh-hans.lproj") | ||
set_property(SOURCE platform/mac/zh_Hant.lproj/InfoPlist.strings PROPERTY MACOSX_PACKAGE_LOCATION "Resources/zh-hant.lproj") | ||
elseif (UNIX) | ||
TARGET_SOURCES(CantoneseDictionary PRIVATE logic/utils/utils_linux.cpp) | ||
configure_file(resources/db/dict.db dict.db COPYONLY) | ||
configure_file(resources/db/user.db user.db COPYONLY) | ||
configure_file(resources/licenses/FLOW_LAYOUT_LICENSE.txt FLOW_LAYOUT_LICENSE.txt COPYONLY) | ||
configure_file(resources/settings/settings.ini settings.ini COPYONLY) | ||
elseif (WIN32) | ||
enable_language("RC") | ||
TARGET_SOURCES(CantoneseDictionary PRIVATE | ||
logic/utils/utils_windows.cpp | ||
platform/windows/app.rc) | ||
configure_file(resources/db/dict.db dict.db COPYONLY) | ||
configure_file(resources/db/user.db user.db COPYONLY) | ||
configure_file(resources/licenses/FLOW_LAYOUT_LICENSE.txt FLOW_LAYOUT_LICENSE.txt COPYONLY) | ||
configure_file(resources/settings/settings.ini settings.ini COPYONLY) | ||
endif() | ||
|
||
install(TARGETS CantoneseDictionary | ||
BUNDLE DESTINATION . | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
|
||
if(QT_VERSION_MAJOR EQUAL 6) | ||
qt_finalize_executable(test) | ||
endif() | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
IDI_ICON1 ICON "icon.ico" |
Binary file not shown.