diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bcf89ce..db5eafe5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,18 +85,28 @@ else () message( STATUS "End-to-end encryption (E2EE) support is turned off.") endif () -if (GTAD_PATH) +if (GTAD_PATH AND MATRIX_DOC_PATH) get_filename_component(ABS_GTAD_PATH "${GTAD_PATH}" REALPATH) + if (EXISTS ${ABS_GTAD_PATH}) + get_filename_component(ABS_API_DEF_PATH "${MATRIX_DOC_PATH}/data/api" REALPATH) + message (STATUS "Testing ${ABS_API_DEF_PATH}") + if (NOT IS_DIRECTORY ${ABS_API_DEF_PATH}) + get_filename_component(ABS_API_DEF_PATH "${MATRIX_DOC_PATH}/api" REALPATH) + message (STATUS "Testing ${ABS_API_DEF_PATH}") + endif () + if (IS_DIRECTORY ${ABS_API_DEF_PATH}) + set(GENERATE_API 1) + if (NOT CLANG_FORMAT) + set(CLANG_FORMAT clang-format) + endif() + get_filename_component(ABS_CLANG_FORMAT "${CLANG_FORMAT}" PROGRAM) + else () + message( WARNING "${MATRIX_DOC_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} doesn't exist; disabling API stubs generation") + endif () endif () -if (MATRIX_DOC_PATH) - get_filename_component(ABS_API_DEF_PATH "${MATRIX_DOC_PATH}/api" REALPATH) -endif () -if (ABS_GTAD_PATH AND ABS_API_DEF_PATH) - if (NOT CLANG_FORMAT) - set(CLANG_FORMAT clang-format) - endif() - get_filename_component(ABS_CLANG_FORMAT "${CLANG_FORMAT}" PROGRAM) -endif() message( STATUS ) message( STATUS "=============================================================================" ) @@ -110,11 +120,11 @@ message( STATUS "Using compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_V message( STATUS "Install Prefix: ${CMAKE_INSTALL_PREFIX}" ) message( STATUS " Header files will be installed to ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_INCLUDEDIR}" ) message( STATUS "Using Qt ${Qt5_VERSION} at ${Qt5_Prefix}" ) -if (ABS_API_DEF_PATH AND ABS_GTAD_PATH) +if (GENERATE_API) message( STATUS "Generating API stubs enabled (use --target update-api)" ) message( STATUS " Using GTAD at ${ABS_GTAD_PATH}" ) message( STATUS " Using API files at ${ABS_API_DEF_PATH}" ) - if (ABS_CLANG_FORMAT) + if (EXISTS ${ABS_CLANG_FORMAT}) message( STATUS "clang-format is at ${ABS_CLANG_FORMAT}") else () message( STATUS "${CLANG_FORMAT} is NOT FOUND; API files won't be reformatted") @@ -190,7 +200,7 @@ set(FULL_CSAPI_DIR lib/${CSAPI_DIR}) set(ASAPI_DEF_DIR application-service/definitions) set(ISAPI_DEF_DIR identity/definitions) -if (MATRIX_DOC_PATH AND GTAD_PATH) +if (GENERATE_API) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.12.0") # We use globbing with CONFIGURE_DEPENDS to produce two file lists: # one of all API files for clang-format and another of just .cpp @@ -222,7 +232,7 @@ if (MATRIX_DOC_PATH AND GTAD_PATH) VERBATIM ) add_custom_target(update-api DEPENDS generate-unformatted-api) - if (ABS_CLANG_FORMAT) + if (EXISTS ${ABS_CLANG_FORMAT}) set(CLANG_FORMAT_ARGS -i -sort-includes ${CLANG_FORMAT_ARGS}) # FIXME: the list of files should be produced after GTAD has run. # For now it's produced at CMake invocation. If file() hasn't found |