diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 77a04b733..d27bcbbbf 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -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 diff --git a/docs/src/consuming.rst b/docs/src/consuming.rst new file mode 100644 index 000000000..c3c25f60f --- /dev/null +++ b/docs/src/consuming.rst @@ -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 + 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 \ No newline at end of file diff --git a/docs/src/index.rst b/docs/src/index.rst index 3b5141d26..63a3162ac 100644 --- a/docs/src/index.rst +++ b/docs/src/index.rst @@ -12,6 +12,7 @@ Welcome to slsDetectorPackage's documentation! installation dependencies + consuming .. toctree:: :caption: C++ API