aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt35
1 files changed, 33 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93cb16fd..49608f95 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,6 +52,11 @@ if (CMAKE_BUILD_TYPE)
endif(CMAKE_BUILD_TYPE)
message( STATUS "Using compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" )
message( STATUS "Using Qt ${Qt5_VERSION} at ${Qt5_Prefix}" )
+if (MATRIX_DOC_PATH AND GTAD_PATH)
+ message( STATUS "Generating API stubs enabled" )
+ message( STATUS " Using GTAD at ${GTAD_PATH}" )
+ message( STATUS " Using CS API files at ${MATRIX_DOC_PATH}/api/client-server" )
+endif ()
message( STATUS "=============================================================================" )
message( STATUS )
@@ -86,11 +91,37 @@ set(libqmatrixclient_SRCS
lib/jobs/downloadfilejob.cpp
)
-aux_source_directory(lib/jobs/generated libqmatrixclient_job_SRCS)
+set(API_DEF_PATH ${MATRIX_DOC_PATH}/api/client-server)
+file(GLOB_RECURSE API_DEFS RELATIVE ${PROJECT_SOURCE_DIR}
+ ${API_DEF_PATH}/*.yaml
+ ${API_DEF_PATH}/definitions/*.yaml
+ ${MATRIX_DOC_PATH}/event-schemas/schema/*
+)
+set(GTAD_CONFIG_DIR lib/jobs)
+set(GEN_SRC_DIR lib/jobs/generated)
+if (MATRIX_DOC_PATH AND GTAD_PATH)
+ add_custom_target(update-api
+ ${GTAD_PATH} --config ${GTAD_CONFIG_DIR}/gtad.yaml --out ${GEN_SRC_DIR}
+ ${API_DEF_PATH}
+ cas_login_redirect.yaml- cas_login_ticket.yaml-
+ old_sync.yaml- room_initial_sync.yaml- # deprecated
+ sync.yaml-
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+ SOURCES ${GTAD_CONFIG_DIR}/gtad.yaml
+ ${GTAD_CONFIG_DIR}/{{base}}.h.mustache
+ ${GTAD_CONFIG_DIR}/{{base}}.cpp.mustache
+ ${API_DEFS}
+ VERBATIM
+ )
+endif()
+
+aux_source_directory(${GEN_SRC_DIR} libqmatrixclient_job_SRCS)
+aux_source_directory(${GEN_SRC_DIR}/definitions libqmatrixclient_def_SRCS)
set(example_SRCS examples/qmc-example.cpp)
-add_library(QMatrixClient ${libqmatrixclient_SRCS} ${libqmatrixclient_job_SRCS})
+add_library(QMatrixClient ${libqmatrixclient_SRCS}
+ ${libqmatrixclient_job_SRCS} ${libqmatrixclient_def_SRCS})
set(API_VERSION "0.2")
set_property(TARGET QMatrixClient PROPERTY VERSION "${API_VERSION}.0")
set_property(TARGET QMatrixClient PROPERTY SOVERSION 0 )