From 0b25e82c4064d0ee64a7dc348938fc4f48a600d8 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Wed, 7 Aug 2024 01:38:23 +0500 Subject: [PATCH 1/3] Fix cmake install It now works and produces the same output as qmake. Also you don't need to run lrelease manually anymore with cmake. --- src/CMakeLists.txt | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1da25cc8f1..51c6527e0d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,7 +27,8 @@ include(libraries/sonnet/src/plugins/hunspell/hunspell/CMakeLists.txt) # noneed for md2html set(BUILD_MD2HTML_EXECUTABLE FALSE) -add_subdirectory(libraries/md4c) +set(BUILD_SHARED_LIBS OFF) +add_subdirectory(libraries/md4c EXCLUDE_FROM_ALL) add_executable(QOwnNotes "") @@ -75,20 +76,20 @@ set(BUILD_SHARED_LIBS OFF) # Disable building tests inside QHotKey library set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) set(QHOTKEY_EXAMPLES OFF) -add_subdirectory(libraries/qhotkey) +add_subdirectory(libraries/qhotkey EXCLUDE_FROM_ALL) # FakeVim library set(CREATE_STATIC_LIBRARY ON) if(MSVC) add_compile_definitions(FAKEVIM_STATIC_DEFINE QTCREATOR_UTILS_STATIC_LIB) endif() -add_subdirectory(libraries/fakevim) -add_subdirectory(libraries/diff_match_patch) +add_subdirectory(libraries/fakevim EXCLUDE_FROM_ALL) +add_subdirectory(libraries/diff_match_patch EXCLUDE_FROM_ALL) option(USE_QLITE_HTML "Build using QLiteHtml for preview" OFF) if (USE_QLITEHTML) add_definitions(-DUSE_QLITEHTML=1) - add_subdirectory(libraries/qlitehtml) + add_subdirectory(libraries/qlitehtml EXCLUDE_FROM_ALL) endif() message("Using Qt version ${QT_VERSION_MAJOR}") @@ -560,22 +561,6 @@ endif() add_custom_target(translations DEPENDS ${QON_QM_FILES}) -if(NOT QT_TRANSLATIONS_DIR) - # If this directory is missing, we are in a Qt5 environment. - # Extract the qmake executable location - get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION) - # Ask Qt5 where to put the translations - execute_process( COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_TRANSLATIONS - OUTPUT_VARIABLE qt_translations_dir OUTPUT_STRIP_TRAILING_WHITESPACE ) - # make sure we have / and not \ as qmake gives on windows - file( TO_CMAKE_PATH "${qt_translations_dir}" qt_translations_dir) - set( QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH - "The location of the Qt translations" FORCE) -endif() - -install(FILES ${QON_QM_FILES} - DESTINATION ${QT_TRANSLATIONS_DIR}) - target_sources(QOwnNotes PRIVATE ${SOURCE_FILES} ${RESOURCE_FILES} @@ -620,8 +605,15 @@ if(MSVC) ) endif() -# Sonnet support if we can get it to run in the future -#find_package(KF5Sonnet) -#target_link_libraries(KF5::SonnetCore KF5::SonnetUi) - add_compile_definitions(QAPPLICATION_CLASS=QApplication) + +## Installation + +install(TARGETS QOwnNotes DESTINATION bin) +install(DIRECTORY images/icons DESTINATION share/icons/hicolor) +install(FILES PBE.QOwnNotes.desktop DESTINATION share/applications) +if (QON_QT6_BUILD) + install(FILES ${QON_QM_FILES} DESTINATION share/qt6/translations) +else() + install(FILES ${QON_QM_FILES} DESTINATION share/qt5/translations) +endif() From 4fd64917b8d82156b88366b0afb7ca15d7d7b4e2 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Wed, 7 Aug 2024 01:42:32 +0500 Subject: [PATCH 2/3] cmake: Use hunspell everywhere --- src/CMakeLists.txt | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 51c6527e0d..2656ecb3d9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -420,7 +420,7 @@ set(SOURCE_FILES entities/bookmark.h entities/bookmark.cpp entities/commandsnippet.h entities/commandsnippet.cpp) -if(NOT APPLE) +# spellchecker list(APPEND SOURCE_FILES libraries/sonnet/src/plugins/hunspell/hunspellclient.cpp libraries/sonnet/src/plugins/hunspell/hunspellclient.h @@ -474,16 +474,6 @@ list(APPEND SOURCE_FILES ) endif() -if (APPLE) - list(APPEND SOURCE_FILES - libraries/sonnet/src/plugins/nsspellchecker/nsspellcheckerclient.h - libraries/sonnet/src/plugins/nsspellchecker/nsspellcheckerclient.mm - libraries/sonnet/src/plugins/nsspellchecker/nsspellcheckerdebug.cpp - libraries/sonnet/src/plugins/nsspellchecker/nsspellcheckerdebug.h - libraries/sonnet/src/plugins/nsspellchecker/nsspellcheckerdict.h - libraries/sonnet/src/plugins/nsspellchecker/nsspellcheckerdict.mm) -endif() - # Translation files SET(QON_TS_FILES languages/QOwnNotes_en.ts From df808ab1ed220fcdc5ac8b6a52de16706d79ef05 Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle Date: Wed, 7 Aug 2024 06:10:25 +0200 Subject: [PATCH 3/3] #3077 fix: remove obsolete endif Signed-off-by: Patrizio Bekerle --- src/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2656ecb3d9..d1a2306691 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -472,7 +472,6 @@ list(APPEND SOURCE_FILES libraries/sonnet/src/plugins/hunspell/hunspell/src/parsers/xmlparser.cxx libraries/sonnet/src/plugins/hunspell/hunspell/src/parsers/xmlparser.hxx ) -endif() # Translation files SET(QON_TS_FILES