Skip to content

Commit

Permalink
configuration for autodoc with sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
adeeconometrics committed Jun 4, 2024
1 parent 5b94a33 commit 67dceff
Show file tree
Hide file tree
Showing 11 changed files with 5,991 additions and 8 deletions.
32 changes: 26 additions & 6 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: C/C++ CI

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:
build:
Expand All @@ -14,9 +14,14 @@ jobs:
- name: git
run: git --version
- name: configure
run: sudo apt-get install make cmake build-essential
run: |
sudo apt-get install make cmake build-essential libomp-dev doxygen
pip3 install sphinx
pip3 install breathe
pip3 install pydata-sphinx-theme
pip3 install sphinx-sitemap
- name: gtest
run: |
run: |
sudo apt-get install libgtest-dev
cd ${{github.workspace}}
mkdir lib
Expand All @@ -28,13 +33,28 @@ jobs:
cmake ../
make
- name: build
run: |
run: |
cd ${{github.workspace}}
mkdir build
cd build
cmake ../
make
- name: test
run: |
run: |
cd ${{github.workspace}}/build
ctest --output-on-failure
- name: checout repo
uses: actions/[email protected]
- name: build docs
run: |
cd docs_sphinx
doxygen Doxyfile.in
make html
cd _build/html
touch .nojekyll
- name: deploy docs
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: docs_sphinx/_build/html # The folder the action should deploy.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
lib/
build/
docs/
venv/
bin/
docs_sphinx/_build/
docs_sphinx/_static/
docs_sphinx/_templates/
*/**.o
*.**.exe
25 changes: 24 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ file(GLOB_RECURSE INC_FILES include/*.hpp)

add_executable(${PROJECT_NAME} ${SRC_FILES})
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)

# Fetch GTest library
set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/googletest)
Expand All @@ -41,6 +42,7 @@ if(WIN32)
endif()

# Add test directory
# include(CTest)
enable_testing()

add_executable(unittest ${CMAKE_CURRENT_SOURCE_DIR}/test/unittest.cpp)
Expand All @@ -53,4 +55,25 @@ gtest_discover_tests(unittest)
set(CPACK_PACKAGE_NAME "AutoDiff")
set(CPACK_PACKAGE_VERSION "1.0.0")
set(CPACK_GENERATOR "ZIP")
include(CPack)
include(CPack)

find_package(Doxygen)

if(DOXYGEN_FOUND)
# set input and output files
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs_doxy/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.out)

# request to configure the file
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
message("Doxygen build started")

# Note: do not put "ALL" - this builds docs together with application EVERY TIME!
add_custom_target(docs
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
else(DOXYGEN_FOUND)
message("Doxygen need to be installed to generate the doxygen documentation")
endif(DOXYGEN_FOUND)
Loading

0 comments on commit 67dceff

Please sign in to comment.