Skip to content

Commit

Permalink
update ci to deplay documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
YanzhaoW committed Nov 23, 2024
1 parent 3e6b537 commit dbb7cbb
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 29 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/publish_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ jobs:
submodules: 'true'
- name: run doxygen
run: |
brew install doxygen graphviz
mkdir -p build
doxygen
brew install doxygen graphviz python3 cmake ninja
python3 -m pip install --upgrade pip
pip install sphinx breathe sphinx-rtd-theme
cmake --workflow --preset build-doc
- uses: actions/upload-pages-artifact@v3
with:
path: build/html
path: build/doc/sphinx
retention-days: 1

deploy-doc:
Expand Down
49 changes: 28 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,39 @@ cmake_minimum_required(VERSION 3.28)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

include(option_settings)

set(ENV{CMAKE_ENABLE_TEST} ${ENABLE_TEST})

project(
srs
VERSION 0.1.1
LANGUAGES CXX C)

include(install_config)
include(project_config)
include(check_compilers)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_SCAN_FOR_MODULES OFF)

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
list(APPEND CMAKE_CXX_FLAGS "-fexperimental-library")
endif()

include(import_packages)

add_subdirectory(frontend)
add_subdirectory(backend)
add_subdirectory(examples)
add_subdirectory(doc)
if(ENABLE_TEST)
add_subdirectory(test)
if(BUILD_ONLY_DOC)
add_subdirectory(doc)
else()
if(BUILD_DOC)
add_subdirectory(doc)
endif()
include(install_config)
include(project_config)
include(check_compilers)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_SCAN_FOR_MODULES OFF)

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
list(APPEND CMAKE_CXX_FLAGS "-fexperimental-library")
endif()

include(import_packages)

add_subdirectory(frontend)
add_subdirectory(backend)
add_subdirectory(examples)
if(ENABLE_TEST)
add_subdirectory(test)
endif()
endif()
27 changes: 27 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@
"CONAN_INSTALL_ARGS": "--build=missing;-scompiler.cppstd=gnu20",
"BUILD_STATIC": "ON"
}
},
{
"name": "build-doc",
"displayName": "build-doc",
"description": "Documentation only build",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"BUILD_ONLY_DOC": "ON"
}
}
],
"buildPresets": [
Expand All @@ -40,6 +49,11 @@
{
"name": "static",
"configurePreset": "static"
},
{
"name": "build-doc",
"configurePreset": "build-doc",
"targets": "doc"
}
],
"workflowPresets": [
Expand Down Expand Up @@ -68,6 +82,19 @@
"name": "static"
}
]
},
{
"name": "build-doc",
"steps": [
{
"type": "configure",
"name": "build-doc"
},
{
"type": "build",
"name": "build-doc"
}
]
}
]
}
2 changes: 2 additions & 0 deletions cmake/option_settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ option(USE_ROOT "Force to use ROOT dependency." OFF)
option(NO_ROOT "Disable the usage of ROOT dependency." OFF)
option(BUILD_STATIC "Enable static linking of libstdc++." OFF)
option(ENABLE_TEST "Enable testing framework of the project." ON)
option(BUILD_DOC "Build the documentation for this project." OFF)
option(BUILD_ONLY_DOC "Only build the documentation for this project." OFF)

set(SPHINX_BUILDER
"html"
Expand Down
6 changes: 3 additions & 3 deletions doc/conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = '@CMAKE_PROJECT_NAME@'
copyright = '2024, Yanzhao Wang'
author = 'Yanzhao Wang'
copyright = '2024, Yanzhao Wang (王彥昭)'
author = 'Yanzhao Wang (王彥昭)'
release = '@CMAKE_PROJECT_VERSION@'

# -- General configuration ---------------------------------------------------
Expand All @@ -23,7 +23,7 @@ html_context = {
'display_github': True,
'github_user': 'YanzhaoW',
'github_repo': 'srs-daq',
'github_version': 'dev',
'github_version': 'dev/doc/',
}

source_suffix = ['.rst' ]
Expand Down
1 change: 0 additions & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

install_conda
build_source
Source Code @ GitHub <https://github.com/YanzhaoW/srs-daq>

.. toctree::
:maxdepth: 2
Expand Down

0 comments on commit dbb7cbb

Please sign in to comment.