Skip to content

Commit

Permalink
fix: Add documentation workflow and awesome documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
VolkerEnderlein committed May 13, 2024
1 parent e587907 commit f4c1795
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .github/workflows/documentation-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Awesome Documentation Build

on:
workflow_dispatch: # Allow manual triggers
push:
branches: [ master ]

jobs:
ubuntu-build:
name: Ubuntu Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Create build directory and run CMake
run: |
sudo apt-get -y update
sudo apt-get -y install fdoxygen graphviz reeglut3-dev libgtk2.0-dev libgtkgl2.0-dev libboost-dev
mkdir cmake_download_dir
DOWNLOAD_FILE_COIN=coin-latest-Ubuntu2204-gcc11-x64.tar.gz
RELEASE_ID=`curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/coin3d/coin/releases | jq -r --arg COIN_REPO_TAG_NAME "CI-builds" '.[] | select(.tag_name==$COIN_REPO_TAG_NAME) | .id'`
ASSET_ID=`curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/coin3d/coin/releases/$RELEASE_ID | jq -r --arg DOWNLOAD_FILE_COIN "$DOWNLOAD_FILE_COIN" '.assets[] | select(.name==$DOWNLOAD_FILE_COIN) | .id'`
export DOWNLOAD_ADDRESS_COIN=https://api.github.com/repos/coin3d/coin/releases/assets/$ASSET_ID
echo download file $DOWNLOAD_FILE_COIN from address $DOWNLOAD_ADDRESS_COIN
curl -s -S -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/octet-stream" -o $DOWNLOAD_FILE_COIN $DOWNLOAD_ADDRESS_COIN
tar xzf $DOWNLOAD_FILE_COIN -C cmake_download_dir
curl -L -o doxygen-1.10.0.linux.bin.tar.gz https://github.com/doxygen/doxygen/releases/download/Release_1_10_0/doxygen-1.10.0.linux.bin.tar.gz
tar xzf doxygen-1.10.0.linux.bin.tar.gz
export PATH=${{ github.workspace }}/doxygen-1.10.0/bin:$PATH
cmake -S . -B cmake_build_dir -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=cmake_install_dir -DCMAKE_PREFIX_PATH=cmake_download_dir/Coin3D -DSOGTK_BUILD_AWESOME_DOCUMENTATION=ON
- name: Build project
run: |
export PATH=${{ github.workspace }}/doxygen-1.10.0/bin:$PATH
doxygen --version
cmake --build cmake_build_dir --target documentation_awesome --config Release -- -j4
- name: Deploy Awesome Documentation to Github Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: cmake_build_dir/html_awesome
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ option(WITH_STATIC_DEFAULTS "Enable statically linked in default materials" ON)
option(HAVE_SPACENAV_SUPPORT "Enable Space Navigator support" ON)
option(SO${GUI}_USE_CPACK "If enabled the cpack subrepo is mandatory" OFF)
option(SO${GUI}_BUILD_DOCUMENTATION "Build and install API documentation (requires Doxygen)." OFF)
option(SO${GUI}_BUILD_AWESOME_DOCUMENTATION "Build and install API documentation in new modern style (requires Doxygen)." OFF)
option(SO${GUI}_BUILD_TESTS "Build small test programs." ON)
option(SO${GUI}_SANITIZE_ADDRESS "Add sanitize address options." OFF)

Expand All @@ -113,6 +114,7 @@ report_prepare(
WITH_STATIC_DEFAULTS
HAVE_SPACENAV_SUPPORT
SO${GUI}_BUILD_DOCUMENTATION
SO${GUI}_BUILD_AWESOME_DOCUMENTATION
SO${GUI}_BUILD_INTERNAL_DOCUMENTATION
SO${GUI}_BUILD_DOC_MAN
SO${GUI}_BUILD_DOC_QTHELP
Expand Down
50 changes: 50 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,56 @@ if(SO${GUI}_BUILD_DOCUMENTATION)
endif()
endif()

# Add a target to generate new modern API documentation with Doxygen
if(SO${GUI}_BUILD_AWESOME_DOCUMENTATION)
find_package(Doxygen)
if(NOT DOXYGEN_FOUND)
message(FATAL_ERROR "Doxygen is needed to build the documentation.")
endif()

if(NOT "${Coin_DOC_DIR}" STREQUAL "")
get_filename_component(_coin_versioned_dir ${Coin_DOC_DIR} NAME)
set(DOXYGEN_TAGFILES "${Coin_DOC_DIR}/html/Coin.tag=../../${_coin_versioned_dir}/html")
endif()

# ############################################################################
# Setup documentation options
# ############################################################################
set(GENERATE_HTMLHELP NO)
set(DOXYGEN_GENERATE_MAN NO)
set(GENERATE_QHP NO)
set(GENERATE_TREEVIEW YES)
set(DOXYGEN_INTERNAL_DOCS NO)
set(DOXYGEN_EXTRACT_PRIVATE NO)
set(DOXYGEN_WARN_IF_UNDOCUMENTED YES)
set(DOXYGEN_EXCLUDE)
set(GITHUB_LINK "https://github.com/coin3d/so${gui}")

set(DOXYFILE_AWESOME "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_awesome")
set(HTML_HEADER_AWESOME "${CMAKE_BINARY_DIR}/header_awesome.html")
set(DOXYGEN_OUTPUT_AWESOME "${CMAKE_BINARY_DIR}/html_awesome/index.html")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Inventor/${Gui}/common/sogui.doxygen.awesome.cmake.in" ${DOXYFILE_AWESOME} @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Inventor/${Gui}/common/docs/doxygen-awesome/doxygen-custom/header.html.cmake.in" ${HTML_HEADER_AWESOME} @ONLY)

# ############################################################################
# Setup documentation targets
# ############################################################################
add_custom_command(
OUTPUT ${DOXYGEN_OUTPUT_AWESOME}
COMMAND ${CMAKE_COMMAND} -E echo_append "Generating modern API documentation with Doxygen "
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_AWESOME}
COMMAND ${CMAKE_COMMAND} -E echo "done."
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
DEPENDS ${DOXYFILE_AWESOME}
)
add_custom_target(documentation_awesome ALL DEPENDS ${DOXYGEN_OUTPUT_AWESOME})

# ############################################################################
# Install built documentation files
# ############################################################################
install(DIRECTORY "${CMAKE_BINARY_DIR}/html_awesome" DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT documentation REGEX ".*\\.(chm|qch)" EXCLUDE)
endif()

# ############################################################################
# Installation headers
# ############################################################################
Expand Down
2 changes: 1 addition & 1 deletion src/Inventor/Gtk/common

0 comments on commit f4c1795

Please sign in to comment.