diff options
-rw-r--r-- | CMakeLists.txt | 20 | ||||
-rw-r--r-- | README.md | 17 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 8 |
3 files changed, 23 insertions, 22 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a17e1f9..9fbf3a9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -241,9 +241,9 @@ target_link_libraries(${PROJECT_NAME} QtOlm Qt5::Core Qt5::Network Qt5::Gui Qt5: set(TEST_BINARY quotest) add_executable(${TEST_BINARY} ${tests_SRCS}) -target_link_libraries(${TEST_BINARY} Qt5::Core Qt5::Test Quotient) +target_link_libraries(${TEST_BINARY} Qt5::Core Qt5::Test ${PROJECT_NAME}) -configure_file(Quotient.pc.in ${CMAKE_CURRENT_BINARY_DIR}/Quotient.pc @ONLY NEWLINE_STYLE UNIX) +configure_file(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY NEWLINE_STYLE UNIX) # Installation @@ -259,15 +259,15 @@ include(CMakePackageConfigHelpers) # NB: SameMajorVersion doesn't really work yet, as we're within 0.x trail. # Maybe consider jumping the gun and releasing 1.0, as semver advises? write_basic_package_version_file( - "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/QuotientConfigVersion.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake" COMPATIBILITY SameMajorVersion ) export(PACKAGE ${PROJECT_NAME}) export(EXPORT ${PROJECT_NAME}Targets FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Targets.cmake") -configure_file(cmake/QuotientConfig.cmake - "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/QuotientConfig.cmake" +configure_file(cmake/${PROJECT_NAME}Config.cmake + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake" COPYONLY ) @@ -275,21 +275,21 @@ set(ConfigFilesLocation "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") install(EXPORT ${PROJECT_NAME}Targets FILE ${PROJECT_NAME}Targets.cmake DESTINATION ${ConfigFilesLocation}) -install(FILES cmake/QuotientConfig.cmake - "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/QuotientConfigVersion.cmake" +install(FILES cmake/${PROJECT_NAME}Config.cmake + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake" DESTINATION ${ConfigFilesLocation} ) -install(EXPORT_ANDROID_MK QuotientTargets DESTINATION share/ndk-modules) +install(EXPORT_ANDROID_MK ${PROJECT_NAME}Targets DESTINATION share/ndk-modules) if (WIN32) install(FILES mime/packages/freedesktop.org.xml DESTINATION mime/packages) endif (WIN32) -if (QUOTIENT_INSTALL_TESTS) +if (${PROJECT_NAME}_INSTALL_TESTS) install(TARGETS ${TEST_BINARY} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif () if (UNIX AND NOT APPLE) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Quotient.pc + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endif() @@ -77,13 +77,12 @@ Static linkage is the default on Windows/macOS; feel free to experiment with dynamic linking and submit PRs if you get reusable results. The example/test application that comes with libQuotient, -[qmc-example](https://github.com/quotient-im/libQuotient/tree/master/examples) -includes most common use cases such as sending messages, uploading files, +[quotest](tests) includes most common use cases such as sending messages, uploading files, setting room state etc.; for more extensive usage check out the source code of [Quaternion](https://github.com/quotient-im/Quaternion) (the reference client of Quotient) or [Spectral](https://gitlab.com/b0/spectral). -To ease the first step, `examples/CMakeLists.txt` is a good starting point +To ease the first step, `tests/CMakeLists.txt` is a good starting point for your own CMake-based project using libQuotient. ## Building the library @@ -115,18 +114,18 @@ You can install the library with CMake: cmake --build . --target install ``` This will also install cmake package config files; once this is done, you -should be able to use `examples/CMakeLists.txt` to compile qmc-example -with the _installed_ library. Installation of the `qmc-example` binary +should be able to use [`tests/CMakeLists.txt`](tests/CMakeLists.txt) to compile quotest +with the _installed_ library. Installation of the `quotest` binary along with the rest of the library can be skipped -by setting `QMATRIXCLIENT_INSTALL_EXAMPLE` to `OFF`. +by setting `Quotient_INSTALL_TESTS` to `OFF`. ### qmake-based -The library provides a .pri file with an intention to be included from a bigger project's .pro file. As a starting point you can use `qmc-example.pro` that will build a minimal example of library usage for you. In the root directory of the project sources: +The library provides a .pri file with an intention to be included from a bigger project's .pro file. As a starting point you can use `quotest.pro` that will build a minimal example of library usage for you. In the root directory of the project sources: ```shell script -qmake qmc-example.pro +qmake quotest.pro make all ``` -This will get you `debug/qmc-example` and `release/qmc-example` +This will get you `debug/quotest` and `release/quotest` console executables that login to the Matrix server at matrix.org with credentials of your choosing (pass the username and password as arguments), run a sync long-polling loop and do some tests of the library API. Note that diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 490a2506..cb8c99f8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -48,7 +48,9 @@ endforeach () find_package(Qt5 5.9 REQUIRED Network Gui Multimedia Test) get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE) -find_package(Quotient REQUIRED) +set(LIBRARY_NAME "Quotient") + +find_package(${LIBRARY_NAME} REQUIRED) get_filename_component(Quotient_Prefix "${Quotient_DIR}/../.." ABSOLUTE) message( STATUS "${PROJECT_NAME} configuration:" ) @@ -57,12 +59,12 @@ if (CMAKE_BUILD_TYPE) endif(CMAKE_BUILD_TYPE) message( STATUS " Compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" ) message( STATUS " Qt: ${Qt5_VERSION} at ${Qt5_Prefix}" ) -message( STATUS " Quotient: ${Quotient_VERSION} at ${Quotient_Prefix}" ) +message( STATUS " ${LIBRARY_NAME}: ${${LIBRARY_NAME}_VERSION} at ${${LIBRARY_NAME}_Prefix}" ) set(example_SRCS quotest.cpp) add_executable(${PROJECT_NAME} ${example_SRCS}) -target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Test Quotient) +target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Test ${LIBRARY_NAME}) # Installation |