Skip to content

Commit

Permalink
First shot at QML integration
Browse files Browse the repository at this point in the history
  • Loading branch information
KitsuneRal committed Jan 13, 2025
1 parent d6bb721 commit 9f706f9
Show file tree
Hide file tree
Showing 5 changed files with 237 additions and 220 deletions.
222 changes: 3 additions & 219 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ set(${PROJECT_NAME}_INSTALL_INCLUDEDIR
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

find_package(${Qt} ${QtMinVersion} REQUIRED Core Network Gui Test Sql)
find_package(${Qt} ${QtMinVersion} REQUIRED Core Network Gui Test Sql QmlIntegration)
get_filename_component(Qt_Prefix "${${Qt}_DIR}/../../../.." ABSOLUTE)

find_package(${Qt}Keychain REQUIRED)
Expand All @@ -112,225 +112,9 @@ set_package_properties(OpenSSL PROPERTIES

add_library(${QUOTIENT_LIB_NAME})

target_sources(${QUOTIENT_LIB_NAME} PUBLIC FILE_SET HEADERS BASE_DIRS .
FILES
Quotient/quotient_common.h
Quotient/quotient_export.h
Quotient/function_traits.h
Quotient/omittable.h
Quotient/expected.h
Quotient/networkaccessmanager.h
Quotient/connectiondata.h
Quotient/connection.h
Quotient/connection_p.h
Quotient/ssosession.h
Quotient/logging_categories_p.h
Quotient/room.h
Quotient/roomstateview.h
Quotient/user.h
Quotient/roommember.h
Quotient/avatar.h
Quotient/uri.h
Quotient/uriresolver.h
Quotient/eventstats.h
Quotient/syncdata.h
Quotient/settings.h
Quotient/networksettings.h
Quotient/converters.h
Quotient/util.h
Quotient/ranges_extras.h
Quotient/eventitem.h
Quotient/accountregistry.h
Quotient/mxcreply.h
Quotient/events/event.h
Quotient/events/roomevent.h
Quotient/events/stateevent.h
Quotient/events/single_key_value.h
Quotient/events/simplestateevents.h
Quotient/events/eventcontent.h
Quotient/events/eventrelation.h
Quotient/events/roomcreateevent.h
Quotient/events/roomtombstoneevent.h
Quotient/events/roommessageevent.h
Quotient/events/roommemberevent.h
Quotient/events/roomcanonicalaliasevent.h
Quotient/events/roomavatarevent.h
Quotient/events/roompowerlevelsevent.h
Quotient/events/typingevent.h
Quotient/events/accountdataevents.h
Quotient/events/receiptevent.h
Quotient/events/reactionevent.h
Quotient/events/callevents.h
Quotient/events/directchatevent.h
Quotient/events/encryptionevent.h
Quotient/events/encryptedevent.h
Quotient/events/roomkeyevent.h
Quotient/events/stickerevent.h
Quotient/events/filesourceinfo.h
Quotient/events/redactionevent.h
Quotient/jobs/requestdata.h
Quotient/jobs/basejob.h
Quotient/jobs/jobhandle.h
Quotient/jobs/syncjob.h
Quotient/jobs/mediathumbnailjob.h
Quotient/jobs/downloadfilejob.h
Quotient/database.h
Quotient/connectionencryptiondata_p.h
Quotient/keyverificationsession.h
Quotient/e2ee/e2ee_common.h
Quotient/e2ee/qolmaccount.h
Quotient/e2ee/qolmsession.h
Quotient/e2ee/qolminboundsession.h
Quotient/e2ee/qolmoutboundsession.h
Quotient/e2ee/qolmutility.h
Quotient/e2ee/qolmsession.h
Quotient/e2ee/qolmmessage.h
Quotient/e2ee/cryptoutils.h
Quotient/e2ee/sssshandler.h
Quotient/events/keyverificationevent.h
Quotient/keyimport.h
Quotient/qt_connection_util.h
Quotient/thread.h
PRIVATE
Quotient/function_traits.cpp
Quotient/networkaccessmanager.cpp
Quotient/connectiondata.cpp
Quotient/connection.cpp
Quotient/ssosession.cpp
Quotient/room.cpp
Quotient/roomstateview.cpp
Quotient/user.cpp
Quotient/roommember.cpp
Quotient/avatar.cpp
Quotient/uri.cpp
Quotient/uriresolver.cpp
Quotient/eventstats.cpp
Quotient/syncdata.cpp
Quotient/settings.cpp
Quotient/networksettings.cpp
Quotient/converters.cpp
Quotient/util.cpp
Quotient/eventitem.cpp
Quotient/accountregistry.cpp
Quotient/mxcreply.cpp
Quotient/events/event.cpp
Quotient/events/roomevent.cpp
Quotient/events/stateevent.cpp
Quotient/events/eventcontent.cpp
Quotient/events/eventrelation.cpp
Quotient/events/roomcreateevent.cpp
Quotient/events/roomtombstoneevent.cpp
Quotient/events/roommessageevent.cpp
Quotient/events/roommemberevent.cpp
Quotient/events/roompowerlevelsevent.cpp
Quotient/events/receiptevent.cpp
Quotient/events/callevents.cpp
Quotient/events/directchatevent.cpp
Quotient/events/encryptionevent.cpp
Quotient/events/encryptedevent.cpp
Quotient/events/filesourceinfo.cpp
Quotient/jobs/requestdata.cpp
Quotient/jobs/basejob.cpp
Quotient/jobs/syncjob.cpp
Quotient/jobs/mediathumbnailjob.cpp
Quotient/jobs/downloadfilejob.cpp
Quotient/database.cpp
Quotient/connectionencryptiondata_p.cpp
Quotient/keyverificationsession.cpp
Quotient/e2ee/e2ee_common.cpp
Quotient/e2ee/qolmaccount.cpp
Quotient/e2ee/qolmsession.cpp
Quotient/e2ee/qolminboundsession.cpp
Quotient/e2ee/qolmoutboundsession.cpp
Quotient/e2ee/qolmutility.cpp
Quotient/e2ee/qolmsession.cpp
Quotient/e2ee/qolmmessage.cpp
Quotient/e2ee/cryptoutils.cpp
Quotient/e2ee/sssshandler.cpp
Quotient/keyimport.cpp
Quotient/thread.cpp
libquotientemojis.qrc
)

# Configure API files generation

set(CSAPI_DIR csapi)
set(FULL_CSAPI_DIR Quotient/${CSAPI_DIR})
set(ASAPI_DEF_DIR application-service/definitions)
add_subdirectory(Quotient)

set(API_GENERATION_ENABLED 0)
if (NOT MATRIX_SPEC_PATH AND MATRIX_DOC_PATH)
set(MATRIX_SPEC_PATH ${MATRIX_DOC_PATH})
endif()
if (GTAD_PATH AND MATRIX_SPEC_PATH)
# REALPATH resolves ~ (home directory) while PROGRAM doesn't
get_filename_component(ABS_GTAD_PATH "${GTAD_PATH}" REALPATH)
get_filename_component(ABS_GTAD_PATH "${ABS_GTAD_PATH}" PROGRAM PROGRAM_ARGS GTAD_ARGS)
if (EXISTS ${ABS_GTAD_PATH})
get_filename_component(ABS_API_DEF_PATH "${MATRIX_SPEC_PATH}/data/api" REALPATH)
if (NOT IS_DIRECTORY ${ABS_API_DEF_PATH})
# Check the old place of API files
get_filename_component(ABS_API_DEF_PATH "${MATRIX_SPEC_PATH}/api" REALPATH)
endif ()
if (IS_DIRECTORY ${ABS_API_DEF_PATH})
set(API_GENERATION_ENABLED 1)
else ()
message( WARNING "${MATRIX_SPEC_PATH} doesn't seem to point to a valid matrix-doc repo; disabling API stubs generation")
endif ()
else (EXISTS ${ABS_GTAD_PATH})
message( WARNING "${GTAD_PATH} is not executable; disabling API stubs generation")
endif ()
endif ()
if (API_GENERATION_ENABLED)
message( STATUS "Using GTAD at ${ABS_GTAD_PATH}" )
message( STATUS "Found API files at ${ABS_API_DEF_PATH}" )
if (NOT CLANG_FORMAT)
set(CLANG_FORMAT clang-format)
endif()
get_filename_component(ABS_CLANG_FORMAT "${CLANG_FORMAT}" PROGRAM PROGRAM_ARGS CLANG_FORMAT_ARGS)
if (NOT ABS_CLANG_FORMAT)
message( WARNING "${CLANG_FORMAT} is NOT FOUND; API files won't be formatted")
endif ()

set(FULL_CSAPI_SRC_DIR ${ABS_API_DEF_PATH}/client-server)
file(GLOB_RECURSE API_DEFS RELATIVE ${PROJECT_SOURCE_DIR}
${FULL_CSAPI_SRC_DIR}/*.yaml
${ABS_API_DEF_PATH}/${ASAPI_DEF_DIR}/*.yaml
)
add_custom_target(update-api
${ABS_GTAD_PATH} --config ../gtad/gtad.yaml --out ${CSAPI_DIR}
${FULL_CSAPI_SRC_DIR}
old_sync.yaml- room_initial_sync.yaml- # deprecated
sync.yaml- # we have a better handcrafted implementation
${GTAD_ARGS}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/Quotient
SOURCES gtad/gtad.yaml
gtad/data.h.mustache
gtad/operation.h.mustache
gtad/operation.cpp.mustache
gtad/preamble.mustache
gtad/define_models.mustache
${API_DEFS}
VERBATIM
)
endif()
add_feature_info(EnableApiCodeGeneration "${API_GENERATION_ENABLED}"
"build target update-api")

# Produce the list of all Matrix API files for building the library. When this
# list changes (normally after calling GTAD), CONFIGURE_DEPENDS will force
# the build system to call CMake again. Checking for the glob change slows down
# each build (even if the target does not involve API generation). It would be
# ideal if GTAD could compare the initial (saved somewhere) and the generated
# file list itself and write down to some .cmake file if those are different,
# which would trigger the reconfiguration specifically before the next build.
# For now CONFIGURE_DEPENDS is the best approximation of that.

file(GLOB_RECURSE api_ALL_HEADERS CONFIGURE_DEPENDS ${FULL_CSAPI_DIR}/*.h Quotient/${ASAPI_DEF_DIR}/*.h)
target_sources(${QUOTIENT_LIB_NAME} PUBLIC FILE_SET HEADERS FILES ${api_ALL_HEADERS})

file(GLOB_RECURSE api_ALL_IMPLS CONFIGURE_DEPENDS ${FULL_CSAPI_DIR}/*.cpp)
target_sources(${QUOTIENT_LIB_NAME} PRIVATE ${api_ALL_IMPLS})
target_sources(${QUOTIENT_LIB_NAME} PRIVATE libquotientemojis.qrc)

# Set BUILDING_SHARED_QUOTIENT if building as a shared library
target_compile_definitions(${QUOTIENT_LIB_NAME} PRIVATE
Expand Down
Loading

0 comments on commit 9f706f9

Please sign in to comment.