4343 endif ()
4444 endforeach ()
4545 foreach (FLAG unused-parameter gnu-zero-variadic-macro-arguments
46- subobject-linkage) # Switch these off
46+ subobject-linkage dollar-in-identifier-extension ) # Switch these off
4747 CHECK_CXX_COMPILER_FLAG("-Wno-${FLAG} " Wno-${FLAG} _SUPPORTED)
4848 if (Wno-${FLAG} _SUPPORTED AND
4949 NOT CMAKE_CXX_FLAGS MATCHES "W(no-)?${FLAG} ($| )" )
@@ -90,28 +90,23 @@ set(${PROJECT_NAME}_INSTALL_INCLUDEDIR
9090set (CMAKE_AUTOMOC ON )
9191set (CMAKE_AUTORCC ON )
9292
93- find_package (${Qt} ${QtMinVersion} REQUIRED Core Network Gui Test Sql)
93+ find_package (${Qt} ${QtMinVersion} REQUIRED COMPONENTS Core Network Gui Test Sql)
94+ find_package (${Qt} ${QtMinVersion} COMPONENTS CorePrivate)
9495get_filename_component (Qt_Prefix "${${Qt} _DIR}/../../../.." ABSOLUTE )
9596
9697if (${Qt} Core_VERSION VERSION_GREATER_EQUAL 6.10)
9798 find_package (${Qt} ${QtMinVersion} REQUIRED COMPONENTS CorePrivate)
9899endif ()
99100
100101find_package (${Qt} Keychain REQUIRED)
102+ find_package (Corrosion REQUIRED)
101103
102- find_package (Olm 3.2.5 REQUIRED)
103- set_package_properties(Olm PROPERTIES
104- DESCRIPTION "Implementation of the Olm and Megolm cryptographic ratchets"
105- URL "https://gitlab.matrix.org/matrix-org/olm"
106- TYPE REQUIRED
107- )
104+ if (NOT WIN32 )
105+ find_package (PkgConfig REQUIRED)
106+ pkg_check_modules(SQLITE sqlite3 REQUIRED IMPORTED_TARGET)
107+ endif ()
108108
109- find_package (OpenSSL 1.1.0 REQUIRED)
110- set_package_properties(OpenSSL PROPERTIES
111- DESCRIPTION "Open source SSL and TLS implementation and cryptographic library"
112- URL "https://www.openssl.org/"
113- TYPE REQUIRED
114- )
109+ corrosion_import_crate(MANIFEST_PATH Quotient/crypto-sdk/Cargo.toml)
115110
116111add_library (${QUOTIENT_LIB_NAME} )
117112
@@ -143,6 +138,7 @@ target_sources(${QUOTIENT_LIB_NAME} PUBLIC FILE_SET HEADERS BASE_DIRS .
143138 Quotient/eventitem.h
144139 Quotient/accountregistry.h
145140 Quotient/mxcreply.h
141+ Quotient/rust_util.h
146142 Quotient/events/event.h
147143 Quotient/events/roomevent.h
148144 Quotient/events/stateevent.h
@@ -176,23 +172,13 @@ target_sources(${QUOTIENT_LIB_NAME} PUBLIC FILE_SET HEADERS BASE_DIRS .
176172 Quotient/jobs/syncjob.h
177173 Quotient/jobs/mediathumbnailjob.h
178174 Quotient/jobs/downloadfilejob.h
179- Quotient/database.h
180- Quotient/connectionencryptiondata_p.h
181175 Quotient/keyverificationsession.h
182176 Quotient/e2ee/e2ee_common.h
183- Quotient/e2ee/qolmaccount.h
184- Quotient/e2ee/qolmsession.h
185- Quotient/e2ee/qolminboundsession.h
186- Quotient/e2ee/qolmoutboundsession.h
187- Quotient/e2ee/qolmutility.h
188- Quotient/e2ee/qolmsession.h
189- Quotient/e2ee/qolmmessage.h
190- Quotient/e2ee/cryptoutils.h
191- Quotient/e2ee/sssshandler.h
192177 Quotient/events/keyverificationevent.h
193178 Quotient/keyimport.h
194179 Quotient/qt_connection_util.h
195180 Quotient/thread.h
181+ Quotient/e2ee/sssshandler.h
196182 # The following headers are not included from public headers and so excluded from distribution
197183 PRIVATE FILE_SET private_headers TYPE HEADERS BASE_DIRS . FILES
198184 Quotient/logging_categories_p.h
@@ -218,6 +204,7 @@ target_sources(${QUOTIENT_LIB_NAME} PUBLIC FILE_SET HEADERS BASE_DIRS .
218204 Quotient/eventitem.cpp
219205 Quotient/accountregistry.cpp
220206 Quotient/mxcreply.cpp
207+ Quotient/rust_util.cpp
221208 Quotient/events/event.cpp
222209 Quotient/events/roomevent.cpp
223210 Quotient/events/stateevent.cpp
@@ -239,21 +226,11 @@ target_sources(${QUOTIENT_LIB_NAME} PUBLIC FILE_SET HEADERS BASE_DIRS .
239226 Quotient/jobs/syncjob.cpp
240227 Quotient/jobs/mediathumbnailjob.cpp
241228 Quotient/jobs/downloadfilejob.cpp
242- Quotient/database.cpp
243- Quotient/connectionencryptiondata_p.cpp
244229 Quotient/keyverificationsession.cpp
245230 Quotient/e2ee/e2ee_common.cpp
246- Quotient/e2ee/qolmaccount.cpp
247- Quotient/e2ee/qolmsession.cpp
248- Quotient/e2ee/qolminboundsession.cpp
249- Quotient/e2ee/qolmoutboundsession.cpp
250- Quotient/e2ee/qolmutility.cpp
251- Quotient/e2ee/qolmsession.cpp
252- Quotient/e2ee/qolmmessage.cpp
253- Quotient/e2ee/cryptoutils.cpp
254- Quotient/e2ee/sssshandler.cpp
255231 Quotient/keyimport.cpp
256232 Quotient/thread.cpp
233+ Quotient/e2ee/sssshandler.cpp
257234 libquotientemojis.qrc
258235)
259236
@@ -374,9 +351,22 @@ target_include_directories(${QUOTIENT_LIB_NAME} PUBLIC
374351 $<BUILD_INTERFACE:$<$<NOT :$<BOOL :${QUOTIENT_FORCE_NAMESPACED_INCLUDES} >>:${CMAKE_CURRENT_SOURCE_DIR} /Quotient>>
375352)
376353
354+ find_package (OpenSSL REQUIRED)
355+
377356target_link_libraries (${QUOTIENT_LIB_NAME}
378- PUBLIC ${Qt} ::Core ${Qt} ::Network ${Qt} ::Gui qt${${Qt} Core_VERSION_MAJOR}keychain Olm::Olm ${Qt} ::Sql
379- PRIVATE OpenSSL::Crypto ${Qt} ::CorePrivate)
357+ PUBLIC ${Qt} ::Core ${Qt} ::Network ${Qt} ::Gui qt${${Qt} Core_VERSION_MAJOR}keychain ${Qt} ::Sql
358+ PRIVATE ${Qt} ::CorePrivate matrix_rust_sdk_crypto_cpp OpenSSL::Crypto)
359+
360+ if (NOT WIN32 )
361+ target_link_libraries (${QUOTIENT_LIB_NAME} PRIVATE PkgConfig::SQLITE)
362+ else ()
363+ target_link_libraries (${QUOTIENT_LIB_NAME} PRIVATE Bcrypt.lib)
364+ endif ()
365+
366+ target_include_directories (${QUOTIENT_LIB_NAME} PRIVATE
367+ ${CMAKE_BINARY_DIR} /cargo/build /${Rust_CARGO_TARGET} /cxxbridge/matrix-rust-sdk-crypto/src/)
368+
369+
380370
381371configure_file (${PROJECT_NAME} .pc.in ${CMAKE_CURRENT_BINARY_DIR} /${QUOTIENT_LIB_NAME} .pc @ONLY NEWLINE_STYLE UNIX )
382372
@@ -401,6 +391,7 @@ write_basic_package_version_file(
401391 COMPATIBILITY SameMajorVersion
402392)
403393
394+ install (TARGETS matrix_rust_sdk_crypto_cpp EXPORT ${QUOTIENT_LIB_NAME} Targets)
404395export (PACKAGE ${QUOTIENT_LIB_NAME} )
405396export (EXPORT ${QUOTIENT_LIB_NAME} Targets
406397 FILE "${CMAKE_CURRENT_BINARY_DIR} /${QUOTIENT_LIB_NAME} /${QUOTIENT_LIB_NAME} Targets.cmake" )
@@ -444,8 +435,6 @@ message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
444435message (STATUS " Header files install prefix: ${CMAKE_INSTALL_PREFIX} /${${PROJECT_NAME} _INSTALL_INCLUDEDIR}" )
445436message (STATUS "Using Qt ${${Qt} _VERSION} at ${Qt_Prefix} " )
446437message (STATUS "Using QtKeychain ${${Qt} Keychain_VERSION} at ${${Qt} Keychain_DIR}" )
447- message (STATUS "Using libOlm ${Olm_VERSION} at ${Olm_DIR} " )
448- message (STATUS "Using OpenSSL libcrypto ${OPENSSL_VERSION} at ${OPENSSL_CRYPTO_LIBRARY} " )
449438message (STATUS )
450439feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES
451440 FATAL_ON_MISSING_REQUIRED_PACKAGES)
0 commit comments