Back to home page

EIC code displayed by LXR

 
 

    


Warning, /acts/docs/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 if(ACTS_BUILD_DOCS)
0002     # Some of the sympy code generators are written as jupytext notebooks: the
0003     # build runs them as scripts, and a notebook viewer opens the very same file
0004     # as an explained derivation. Execute those and render them into markdown
0005     # pages so the explanation, and the outputs it produces, are published with
0006     # the rest of the documentation. See docs/render_notebook.py.
0007     include(ActsEnsureUv)
0008 
0009     set(DOXYGEN_NOTEBOOK_DIR ${CMAKE_CURRENT_BINARY_DIR}/notebooks)
0010     # Created unconditionally: doxygen warns about an INPUT path that does not
0011     # exist, and warnings are errors in CI.
0012     file(MAKE_DIRECTORY ${DOXYGEN_NOTEBOOK_DIR})
0013 
0014     # Add one notebook to the documentation. PAGE_ID is both the name of the
0015     # generated markdown file and the doxygen page label, so other pages can
0016     # refer to it with @ref.
0017     function(acts_render_notebook)
0018         set(oneValueArgs SOURCE PAGE_ID)
0019         cmake_parse_arguments(PARSE_ARGV 0 ARGS "" "${oneValueArgs}" "")
0020 
0021         set(_output ${DOXYGEN_NOTEBOOK_DIR}/${ARGS_PAGE_ID}.md)
0022 
0023         # The renderer brings jupytext and nbconvert itself (inline script
0024         # metadata); what has to be added here is whatever the notebook imports.
0025         # The python version tracks codegen/manifest.json, so that a notebook
0026         # renders under the same interpreter the build generates code with.
0027         add_custom_command(
0028             OUTPUT ${_output}
0029             COMMAND
0030                 ${uv_exe} run --quiet --python 3.13 --no-project
0031                 --with-requirements
0032                 ${PROJECT_SOURCE_DIR}/codegen/requirements.txt --with
0033                 ${PROJECT_SOURCE_DIR}/codegen
0034                 ${CMAKE_CURRENT_SOURCE_DIR}/render_notebook.py ${ARGS_SOURCE}
0035                 ${_output} --page-id ${ARGS_PAGE_ID}
0036             DEPENDS
0037                 ${ARGS_SOURCE}
0038                 ${CMAKE_CURRENT_SOURCE_DIR}/render_notebook.py
0039                 ${PROJECT_SOURCE_DIR}/codegen/src/codegen/sympy_common.py
0040             COMMENT "Executing and rendering notebook ${ARGS_PAGE_ID}"
0041             VERBATIM
0042         )
0043 
0044         set_property(GLOBAL APPEND PROPERTY ACTS_DOCS_NOTEBOOKS ${_output})
0045     endfunction()
0046 
0047     acts_render_notebook(
0048         SOURCE
0049             ${PROJECT_SOURCE_DIR}/Core/src/Propagator/detail/generate_sympy_jac.py
0050         PAGE_ID codegen_sympy_jac
0051     )
0052 
0053     get_property(_docs_notebooks GLOBAL PROPERTY ACTS_DOCS_NOTEBOOKS)
0054     add_custom_target(docs-notebooks DEPENDS ${_docs_notebooks})
0055 
0056     include(FetchContent)
0057     FetchContent_Declare(
0058         doxygen-awesome-css
0059         GIT_REPOSITORY https://github.com/jothepro/doxygen-awesome-css.git
0060         GIT_TAG 1f3620084ff75734ed192101acf40e9dff01d848
0061     )
0062     FetchContent_MakeAvailable(doxygen-awesome-css)
0063 
0064     # Save the location the files were cloned into
0065     # This allows us to get the path to doxygen-awesome.css
0066     FetchContent_GetProperties(doxygen-awesome-css SOURCE_DIR AWESOME_CSS_DIR)
0067 
0068     set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
0069     set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
0070     set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
0071     configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY)
0072 
0073     doxygen_add_docs(
0074         docs
0075         COMMENT "Generating documentation using doxygen"
0076         CONFIG_FILE ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
0077     )
0078 
0079     add_dependencies(docs docs-notebooks)
0080 
0081     # docs build is off by default
0082     set_target_properties(docs PROPERTIES EXCLUDE_FROM_ALL TRUE)
0083 endif()
0084 
0085 # Additional target example build that is off by default but can be build
0086 # without the rest of the documentation
0087 add_library(docs-examples SHARED)
0088 set_target_properties(docs-examples PROPERTIES EXCLUDE_FROM_ALL TRUE)
0089 target_sources(
0090     docs-examples
0091     PRIVATE
0092         examples/logging.cpp
0093         examples/units.cpp
0094         examples/errors.cpp
0095         examples/geometry_module.cpp
0096         examples/material_designation.cpp
0097 )
0098 target_link_libraries(docs-examples PRIVATE Acts::Core)
0099 
0100 if(ACTS_BUILD_PLUGIN_JSON)
0101     target_sources(docs-examples PRIVATE examples/material_map_json.cpp)
0102     target_link_libraries(docs-examples PRIVATE Acts::PluginJson)
0103 endif()
0104 
0105 if(ACTS_BUILD_PLUGIN_DD4HEP)
0106     target_link_libraries(docs-examples PRIVATE Acts::PluginDD4hep)
0107     target_compile_definitions(docs-examples PRIVATE ACTS_BUILD_PLUGIN_DD4HEP)
0108 endif()
0109 
0110 # Compile the module writing templates as real geometry modules so the
0111 # snippet examples are verified at build time.
0112 #! [Plain Module CMake]
0113 include(ActsGeometryModuleHelpers)
0114 acts_add_geometry_module(
0115     docs-geometry-module-template
0116     examples/geometry_module_template.cpp
0117 )
0118 #! [Plain Module CMake]
0119 add_dependencies(docs-examples docs-geometry-module-template)
0120 
0121 if(ACTS_BUILD_PLUGIN_DD4HEP)
0122     #! [DD4hep Module CMake]
0123     include(ActsDD4hepGeometryModuleHelpers)
0124     acts_add_dd4hep_geometry_module(
0125         docs-geometry-module-template-dd4hep
0126         examples/geometry_module_template_dd4hep.cpp
0127     )
0128     #! [DD4hep Module CMake]
0129     add_dependencies(docs-examples docs-geometry-module-template-dd4hep)
0130 endif()