summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-12-18 03:21:17 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2020-12-18 03:53:57 +0100
commit15d8eb2b8bc481bb143c257bfc81a368b04c82ca (patch)
tree65929441523189ed2ff003bb6fc25fe7331170ad
parentAdd download keys from secret storage (diff)
downloadnheko-15d8eb2b8bc481bb143c257bfc81a368b04c82ca.tar.xz
Update deps for keychain
-rw-r--r--.ci/macos/Brewfile3
-rw-r--r--CMakeLists.txt32
-rw-r--r--io.github.NhekoReborn.Nheko.json18
-rw-r--r--src/Cache.cpp4
4 files changed, 51 insertions, 6 deletions
diff --git a/.ci/macos/Brewfile b/.ci/macos/Brewfile
index 4ef9967c..7e9687c7 100644
--- a/.ci/macos/Brewfile
+++ b/.ci/macos/Brewfile
@@ -11,4 +11,5 @@ brew "nlohmann_json"
 brew "gstreamer"
 brew "gst-plugins-base"
 brew "gst-plugins-good"
-brew "gst-plugins-bad"
\ No newline at end of file
+brew "gst-plugins-bad"
+brew "qtkeychain"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 877d7d54..326e5794 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,8 @@ option(USE_BUNDLED_LMDBXX "Use the bundled version of lmdb++."
 	${HUNTER_ENABLED})
 option(USE_BUNDLED_TWEENY "Use the bundled version of tweeny."
 	${HUNTER_ENABLED})
+option(USE_BUNDLED_QTKEYCHAIN "Use the bundled version of Qt5Keychain."
+	${HUNTER_ENABLED})
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
 
@@ -136,7 +138,24 @@ endif()
 find_package(Qt5 COMPONENTS Core Widgets LinguistTools Concurrent Svg Multimedia Qml QuickControls2 QuickWidgets REQUIRED)
 find_package(Qt5QuickCompiler)
 find_package(Qt5DBus)
+
+if (USE_BUNDLED_QTKEYCHAIN)
+	include(FetchContent)
+	FetchContent_Declare(
+		qt5keychain
+		GIT_REPOSITORY https://github.com/frankosterfeld/qtkeychain.git
+		GIT_TAG        v0.12.0
+		)
+	if (BUILD_SHARED_LIBS)
+		set(QTKEYCHAIN_STATIC OFF CACHE INTERNAL "")
+	else()
+		set(QTKEYCHAIN_STATIC ON CACHE INTERNAL "")
+	endif()
+	set(BUILD_TEST_APPLICATION OFF CACHE INTERNAL "")
+	FetchContent_MakeAvailable(qt5keychain)
+else()
 find_package(Qt5Keychain REQUIRED)
+endif()
 
 if (APPLE)
 	find_package(Qt5MacExtras REQUIRED)
@@ -334,25 +353,25 @@ endif()
 find_package(OpenSSL 1.1.0 REQUIRED)
 if(USE_BUNDLED_MTXCLIENT)
 	include(FetchContent)
-	set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "")
-	set(BUILD_LIB_TESTS OFF CACHE INTERNAL "")
 	FetchContent_Declare(
 		MatrixClient
 		GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
-		GIT_TAG        ed6315563409ce9d47978ff2a2d771b863e375c5
+		GIT_TAG        ce8bc9c3dd6bba432e716f55136133111b0186e7
 		)
+	set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "")
+	set(BUILD_LIB_TESTS OFF CACHE INTERNAL "")
 	FetchContent_MakeAvailable(MatrixClient)
 else()
 	find_package(MatrixClient 0.3.1 REQUIRED)
 endif()
 if(USE_BUNDLED_OLM)
 	include(FetchContent)
-	set(OLM_TESTS OFF CACHE INTERNAL "")
 	FetchContent_Declare(
 		Olm
 		GIT_REPOSITORY https://gitlab.matrix.org/matrix-org/olm.git
 		GIT_TAG        3.1.4
 		)
+	set(OLM_TESTS OFF CACHE INTERNAL "")
 	FetchContent_MakeAvailable(Olm)
 else()
 	find_package(Olm 3)
@@ -574,6 +593,11 @@ else()
 endif()
 target_include_directories(nheko PRIVATE src includes third_party/blurhash third_party/cpp-httplib-0.5.12)
 
+# Fixup bundled keychain include dirs
+if (USE_BUNDLED_QTKEYCHAIN)
+target_include_directories(nheko PRIVATE ${qt5keychain_SOURCE_DIR} ${qt5keychain_BINARY_DIR})
+endif()
+
 target_link_libraries(nheko PRIVATE
 	MatrixClient::MatrixClient
 	Boost::iostreams
diff --git a/io.github.NhekoReborn.Nheko.json b/io.github.NhekoReborn.Nheko.json
index 913e239a..34b0d7e7 100644
--- a/io.github.NhekoReborn.Nheko.json
+++ b/io.github.NhekoReborn.Nheko.json
@@ -95,6 +95,22 @@
       ]
     },
     {
+      "config-opts": [
+        "-DCMAKE_BUILD_TYPE=Release",
+        "-DBUILD_TEST_APPLICATION=OFF"
+      ],
+      "buildsystem": "cmake-ninja",
+      "name": "QtKeychain",
+      "sources": [
+        {
+          "commit": "815fe610353ff8ad7e2f1121c368a74df8db5eb7",
+          "tag": "v0.12.0",
+          "type": "git",
+          "url": "https://github.com/frankosterfeld/qtkeychain.git"
+        }
+      ]
+    },
+    {
       "config-opts":[
         "-DJSON_BuildTests=OFF"
       ],
@@ -145,7 +161,7 @@
       "name": "mtxclient",
       "sources": [
         {
-          "commit": "ed6315563409ce9d47978ff2a2d771b863e375c5",
+          "commit": "ce8bc9c3dd6bba432e716f55136133111b0186e7",
           "type": "git",
           "url": "https://github.com/Nheko-Reborn/mtxclient.git"
         }
diff --git a/src/Cache.cpp b/src/Cache.cpp
index 9da0d87d..674b5793 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -26,7 +26,11 @@
 #include <QMap>
 #include <QStandardPaths>
 
+#if __has_include(<keychain.h>)
+#include <keychain.h>
+#else
 #include <qt5keychain/keychain.h>
+#endif
 
 #include <mtx/responses/common.hpp>