This commit is contained in:
Erik Frojdh 2020-03-16 15:43:46 +01:00
parent 7f4f8e8f09
commit 89d70097f6
3 changed files with 64 additions and 1 deletions

View File

@ -3,7 +3,7 @@ find_package(Sphinx)
if (DOXYGEN_FOUND AND SPHINX_FOUND)
message(${CMAKE_PROJECT_SORURCE_DIR}/slsDetectorSoftware/src)
# message(${CMAKE_PROJECT_SORURCE_DIR}/slsDetectorSoftware/src)
# Utility to generate command line documentation
add_executable(gendoc src/gendoc.cpp)
# This is a bit hacky, but better than exposing stuff?
@ -30,6 +30,7 @@ if (DOXYGEN_FOUND AND SPHINX_FOUND)
set(SPHINX_SOURCE_FILES
src/commandline.rst
src/container_utils.rst
src/consuming.rst
src/dependencies.rst
src/detector.rst
src/index.rst

61
docs/src/consuming.rst Normal file
View File

@ -0,0 +1,61 @@
Consuming slsDetectorPackage
===============================
Depending on how you want to build your integration with
slsDetectorPackage there are a few different ways to
consume the package.
CMake with submodule in your project
---------------------------------------
If you are using CMake to build your integration and want to build everything
in one go we support adding slsDetectorPackage as a subfolder in your cmake project.
a minimal example would be.
.. code-block:: cmake
project(myDetectorIntegration)
cmake_minimum_required(VERSION 3.12)
add_subdirectory(slsDetectorPackage)
#Add your executable
add_executable(example main.cpp)
target_compile_features(example PRIVATE cxx_std_11)
#Link towards slsDetectorShared
target_link_libraries(example slsDetectorShared)
An example that also uses git submodules is available in our github repo
https://github.com/slsdetectorgroup/cmake-subfolder-example
No tools minimal approach
-----------------------------
.. code-block:: c++
#include "Detector.h"
#include <iostream>
int main(){
sls::Detector det;
//Get all values and print them
std::cout << "Hostname: " << det.getHostname() << "\n";
std::cout << "Type: " << det.getDetectorType() << "\n";
std::cout << "Udp ip: " << det.getSourceUDPIP() << "\n";
//Get mac addr
const int module = 0;
auto mac = det.getSourceUDPMAC()[module];
std::cout << "Mac addr of module "<< module << " is " << mac.str() << '\n';
}⏎
.. code-block:: bash
g++ -I/install/path/include/ -L/install/path/lib64/ myapp.cpp -lSlsDetector -lSlsSupport -Wl,-rpath=../install/path/lib64

View File

@ -12,6 +12,7 @@ Welcome to slsDetectorPackage's documentation!
installation
dependencies
consuming
.. toctree::
:caption: C++ API