From ce047db78774778cc83b7c593eb9e0c4bf2848c5 Mon Sep 17 00:00:00 2001 From: blue Date: Sun, 9 May 2021 02:12:17 +0300 Subject: [PATCH] patches from Vae about making libraries static, and about boost, findLMDB CMake script, drop dependency for qtquickcontrols --- CMakeLists.txt | 1 - README.md | 3 +- cmake/FindLMDB.cmake | 47 ++++++++++++++++++++++ core/CMakeLists.txt | 7 +++- core/passwordStorageEngines/CMakeLists.txt | 2 +- external/simpleCrypt/CMakeLists.txt | 2 +- ui/CMakeLists.txt | 5 +-- ui/widgets/vcard/CMakeLists.txt | 2 +- 8 files changed, 59 insertions(+), 10 deletions(-) create mode 100644 cmake/FindLMDB.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index d4caf91..e88fdc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,6 @@ include(GNUInstallDirs) include_directories(.) find_package(Qt5Widgets CONFIG REQUIRED) -find_package(Qt5QuickCompiler CONFIG REQUIRED) find_package(Qt5LinguistTools) if(NOT CMAKE_BUILD_TYPE) diff --git a/README.md b/README.md index 84c114a..f2101d6 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ - lmdb - CMake 3.0 or higher - qxmpp 1.1.0 or higher -- kwallet (optional) +- KDE Frameworks: kwallet (optional) +- KDE Frameworks: KIO (optional) ### Getting diff --git a/cmake/FindLMDB.cmake b/cmake/FindLMDB.cmake new file mode 100644 index 0000000..8bf48b4 --- /dev/null +++ b/cmake/FindLMDB.cmake @@ -0,0 +1,47 @@ +#This file is taken from here https://gitlab.ralph.or.at/causal-rt/causal-cpp/, it was GPLv3 license +#Thank you so much, mr. Ralph Alexander Bariz, I hope you don't mind me using your code + +# Try to find LMDB headers and library. +# +# Usage of this module as follows: +# +# find_package(LMDB) +# +# Variables used by this module, they can change the default behaviour and need +# to be set before calling find_package: +# +# LMDB_ROOT_DIR Set this variable to the root installation of +# LMDB if the module has problems finding the +# proper installation path. +# +# Variables defined by this module: +# +# LMDB_FOUND System has LMDB library/headers. +# LMDB_LIBRARIES The LMDB library. +# LMDB_INCLUDE_DIRS The location of LMDB headers. + +find_path(LMDB_ROOT_DIR + NAMES include/lmdb.h +) + +find_library(LMDB_LIBRARIES + NAMES lmdb + HINTS ${LMDB_ROOT_DIR}/lib +) + +find_path(LMDB_INCLUDE_DIRS + NAMES lmdb.h + HINTS ${LMDB_ROOT_DIR}/include +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LMDB DEFAULT_MSG + LMDB_LIBRARIES + LMDB_INCLUDE_DIRS +) + +mark_as_advanced( + LMDB_ROOT_DIR + LMDB_LIBRARIES + LMDB_INCLUDE_DIRS +) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 2e832e2..f8aa267 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -1,12 +1,15 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.3) project(squawkCORE) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") + set(CMAKE_AUTOMOC ON) find_package(Qt5Core CONFIG REQUIRED) find_package(Qt5Gui CONFIG REQUIRED) find_package(Qt5Network CONFIG REQUIRED) find_package(Qt5Xml CONFIG REQUIRED) +find_package(LMDB REQUIRED) set(squawkCORE_SRC squawk.cpp @@ -25,7 +28,7 @@ set(squawkCORE_SRC add_subdirectory(passwordStorageEngines) # Tell CMake to create the helloworld executable -add_library(squawkCORE ${squawkCORE_SRC}) +add_library(squawkCORE STATIC ${squawkCORE_SRC}) if(SYSTEM_QXMPP) diff --git a/core/passwordStorageEngines/CMakeLists.txt b/core/passwordStorageEngines/CMakeLists.txt index ec750d9..735c0ad 100644 --- a/core/passwordStorageEngines/CMakeLists.txt +++ b/core/passwordStorageEngines/CMakeLists.txt @@ -14,7 +14,7 @@ if (WITH_KWALLET) kwallet.cpp ) - add_library(kwalletPSE ${kwalletPSE_SRC}) + add_library(kwalletPSE STATIC ${kwalletPSE_SRC}) target_include_directories(kwalletPSE PUBLIC ${KWALLET_INTERFACE_INCLUDE_DIRECTORIES}) target_include_directories(kwalletPSE PUBLIC ${Qt5GUI_INTERFACE_INCLUDE_DIRECTORIES}) diff --git a/external/simpleCrypt/CMakeLists.txt b/external/simpleCrypt/CMakeLists.txt index bdb62c6..88f5d23 100644 --- a/external/simpleCrypt/CMakeLists.txt +++ b/external/simpleCrypt/CMakeLists.txt @@ -10,7 +10,7 @@ set(simplecrypt_SRC ) # Tell CMake to create the helloworld executable -add_library(simpleCrypt ${simplecrypt_SRC}) +add_library(simpleCrypt STATIC ${simplecrypt_SRC}) # Use the Widgets module from Qt 5. target_link_libraries(simpleCrypt Qt5::Core) diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt index 00570c9..11b8f3d 100644 --- a/ui/CMakeLists.txt +++ b/ui/CMakeLists.txt @@ -8,8 +8,7 @@ set(CMAKE_AUTOUIC ON) # Find the QtWidgets library find_package(Qt5 CONFIG REQUIRED COMPONENTS Widgets DBus Core) -find_package(Boost 1.36.0 CONFIG REQUIRED COMPONENTS - date_time filesystem iostreams) +find_package(Boost 1.36.0 REQUIRED) if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) endif() @@ -35,7 +34,7 @@ set(squawkUI_SRC ) # Tell CMake to create the helloworld executable -add_library(squawkUI ${squawkUI_SRC}) +add_library(squawkUI STATIC ${squawkUI_SRC}) # Use the Widgets module from Qt 5. target_link_libraries(squawkUI squawkWidgets) diff --git a/ui/widgets/vcard/CMakeLists.txt b/ui/widgets/vcard/CMakeLists.txt index 4d2ee15..73b157c 100644 --- a/ui/widgets/vcard/CMakeLists.txt +++ b/ui/widgets/vcard/CMakeLists.txt @@ -16,7 +16,7 @@ set(vCardUI_SRC ) # Tell CMake to create the helloworld executable -add_library(vCardUI ${vCardUI_SRC}) +add_library(vCardUI STATIC ${vCardUI_SRC}) # Use the Widgets module from Qt 5. target_link_libraries(vCardUI Qt5::Widgets)