Skip to content
Snippets Groups Projects
Select Git revision
  • df28b9a72b3d6cda7c7fed5c4d0e9d511e35f7fc
  • main default protected
  • f-sss4grpc
  • dev
  • 108-implement-rpc-call-for-server-side-scripting
  • f-windows-conan-create
  • f-to-string
  • f-update-requirements
  • f-related-projects
  • f-role
  • f-remote-path
  • f-rel-path
  • f-consol-message
  • v0.3.0
  • v0.2.2
  • v0.2.1
  • v0.2.0
  • v0.1.2
  • v0.1.1
  • v0.1
  • v0.0.19
  • v0.0.18
  • v0.0.16
  • v0.0.15
  • v0.0.10
  • v0.0.9
  • v0.0.8
  • v0.0.7
  • v0.0.6
  • v0.0.5
  • v0.0.4
  • v0.0.3
  • v0.0.2
33 results

CMakeLists.txt

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    CMakeLists.txt 3.69 KiB
    #
    # This file is a part of the CaosDB Project.
    #
    # Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com>
    # Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
    #
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU Affero General Public License as
    # published by the Free Software Foundation, either version 3 of the
    # License, or (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU Affero General Public License for more details.
    #
    # You should have received a copy of the GNU Affero General Public License
    # along with this program. If not, see <https://www.gnu.org/licenses/>.
    #
    
    cmake_minimum_required(VERSION 3.13)
    find_package(Doxygen)
    
    if (DOXYGEN_FOUND)
        string(REPLACE ";" " " DOXYGEN_INPUT
            "${libcaosdb_INCL} ${PROJECT_INCLUDE_DIR}/ccaosdb.h")
        configure_file(Doxyfile.in Doxyfile)
    
    
        # Note: do not put "ALL" - this builds docs together with application EVERY TIME!
        add_custom_target(doc-doxygen
            COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
            COMMENT "Generating API documentation with Doxygen"
            VERBATIM )
    
        find_program(SPHINX_CMD sphinx-build)
        if (SPHINX_CMD)
            configure_file(conf.py.in conf.py)
            configure_file(index.rst.in index.rst)
    
            # create C++ docs
            configure_file(cppapi/index.rst.in cppapi/index.rst)
    
            # create rst pages for every header file
            list(LENGTH libcaosdb_INCL len_header_files)
            math(EXPR len_header_files "${len_header_files} - 1")
            foreach (i RANGE "${len_header_files}")
                list(GET libcaosdb_INCL ${i} HEADER_FILE)
                string(REPLACE
                    "${PROJECT_INCLUDE_DIR}/"
                    ""
                    HEADER_FILE_NAME
                    ${HEADER_FILE})
                string(REPLACE
                    "${CMAKE_BINARY_DIR}/include/"
                    ""
                    HEADER_FILE_NAME
                    ${HEADER_FILE_NAME})
                string(REPLACE
                    "caosdb/"
                    ""
                    DOC_FILE_NAME
                    ${HEADER_FILE_NAME})
                configure_file(
                    header_file.rst.in
                    cppapi/_${DOC_FILE_NAME}.rst)
            endforeach ()
    
            # create (plain) C docs
            configure_file(capi/index.rst.in capi/index.rst)
            set(HEADER_FILE_NAME ccaosdb.h)
            set(HEADER_FILE ccaosdb.h)
            configure_file(
                header_file.rst.in
                capi/_ccaosdb.rst)
    
            add_custom_target(doc-sphinx
                COMMAND ${SPHINX_CMD}
                    -b html
                    -n
                    -c ${CMAKE_CURRENT_BINARY_DIR}
                    ${CMAKE_CURRENT_BINARY_DIR}
                    sphinx_out
                    DEPENDS doc-doxygen
                    Examples.rst
                    Install_develop.rst
                    FEATURES.md
                    CHANGELOG.md
                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
                COMMENT "Generating API documentation with Sphinx"
                VERBATIM
                )
            # Copying files is necessary: https://stackoverflow.com/a/45808534/232888
            file(COPY
                Examples.rst
                Install_develop.rst
                DEPENDENCIES.md
                CHANGELOG.md
                FEATURES.md
                # Tutorial.rst
                DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
        else ()
            message("Sphinx need to be installed to generate the sphinx documentation")
        endif ()
    
    else ()
      message("Doxygen need to be installed to generate the doxygen documentation")
    endif (DOXYGEN_FOUND)