From c43b3ce9e870bde6315113b26d2813ef212c7213 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 13 Jan 2018 21:12:07 +0100 Subject: [PATCH] updated documentation, tweaked CMakeLists.txt, added Gentoo ebuild --- CMakeLists.txt | 22 +++++++++++++---- README.md | 17 ++++++++++--- packages/gentoo/mastodon-cpp-9999.ebuild | 31 ++++++++++++++++++++++++ src/{example => examples}/example.cpp | 0 4 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 packages/gentoo/mastodon-cpp-9999.ebuild rename src/{example => examples}/example.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4467562..10d4582 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required (VERSION 3.7) +include(GNUInstallDirs) project (mastodon-cpp VERSION 0.1.1 LANGUAGES CXX @@ -24,19 +25,30 @@ set_target_properties(mastodon-cpp PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${mastodon-cpp_VERSION_MAJOR} ) -install(TARGETS mastodon-cpp DESTINATION lib) target_link_libraries(mastodon-cpp boost_system ssl crypto) -install(FILES ${PROJECT_SOURCE_DIR}/src/mastodon-cpp.hpp DESTINATION include) +install(TARGETS mastodon-cpp LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(FILES ${PROJECT_SOURCE_DIR}/src/mastodon-cpp.hpp + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + +# Documentation +if(WITH_DOC) + execute_process(COMMAND ./build_doc.sh + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}") + install(DIRECTORY ${PROJECT_SOURCE_DIR}/doc/html + DESTINATION ${CMAKE_INSTALL_DOCDIR}/mastodon-cpp-${PROJECT_VERSION}) + install(FILES ${PROJECT_SOURCE_DIR}/src/examples/example.cpp + DESTINATION ${CMAKE_INSTALL_DOCDIR}/mastodon-cpp-${PROJECT_VERSION}/examples) +endif() # Example client -if(NOT LIB_ONLY) - file(GLOB_RECURSE sources_example src/example/*.cpp) +if(WITH_EXAMPLES) + file(GLOB_RECURSE sources_example src/examples/example.cpp) add_executable(example ${sources_example}) target_link_libraries(example mastodon-cpp) endif() # Tests -if(NOT NOTESTS) +if(WITH_TESTS) include(CTest) file(GLOB sources_tests "src/tests/test_*.cpp") foreach(src ${sources_tests}) diff --git a/README.md b/README.md index be54cde..6633fe6 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,10 @@ All versions below 1.0.0 (SOVERSION 0) are considered insecure, unstable and can ## Get sourcecode +### Release + +Download the current release at [GitHub](https://github.com/tastytea/mastodon-cpp/releases). + ### Development version git clone https://github.com/tastytea/mastodon-cpp.git @@ -25,12 +29,19 @@ All versions below 1.0.0 (SOVERSION 0) are considered insecure, unstable and can cmake .. make -If you want to compile a debug build, use `cmake -DCMAKE_BUILD_TYPE=Debug ..` -instead. +cmake options: + + * `-DCMAKE_BUILD_TYPE=Debug` for a debug build + * `-DWITH_EXAMPLES=ON` if you want to compile the examples + * `-DWITH_TESTS=ON` if you want to compile the tests + * `-DWITH_DOC=ON` if you want to compile the HTML reference + +You can run the tests with `ctest ..` inside the build directory. +Install with `make install`. # Usage -The reference can be generated with `build_doc.sh`, if doxygen is installed. Or just look in `src/mastodon-cpp.hpp`. There is an example in `src/example`. +The HTML reference can be generated with `build_doc.sh`, if doxygen is installed. Or just look in `src/mastodon-cpp.hpp`. There is an example in `src/examples/`. ## Compiling your project diff --git a/packages/gentoo/mastodon-cpp-9999.ebuild b/packages/gentoo/mastodon-cpp-9999.ebuild new file mode 100644 index 0000000..7152989 --- /dev/null +++ b/packages/gentoo/mastodon-cpp-9999.ebuild @@ -0,0 +1,31 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=6 +inherit git-r3 cmake-utils + +DESCRIPTION="mastodon-cpp is a C++ wrapper for the Mastodon API." +HOMEPAGE="https://github.com/tastytea/mastodon-cpp" +EGIT_REPO_URI="https://github.com/tastytea/mastodon-cpp.git" +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="" +IUSE="doc" +RDEPEND=">=dev-libs/boost-1.63.0" +DEPEND=">=dev-util/cmake-3.9.6 + doc? ( >=app-doc/doxygen-1.8.13-r1 ) + ${RDEPEND}" + +src_unpack() { + git-r3_src_unpack +} + +src_configure() { + local mycmakeargs=( + -DWITH_DOC="$(usex doc)" + -DWITH_EXAMPLES=NO + -DWITH_TESTS=NO + ) + cmake-utils_src_configure +} diff --git a/src/example/example.cpp b/src/examples/example.cpp similarity index 100% rename from src/example/example.cpp rename to src/examples/example.cpp