updated documentation, tweaked CMakeLists.txt, added Gentoo ebuild

This commit is contained in:
tastytea 2018-01-13 21:12:07 +01:00
parent 34f81d89d6
commit c43b3ce9e8
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
4 changed files with 62 additions and 8 deletions

View File

@ -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})

View File

@ -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

View File

@ -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
}