Skip to content

Commit

Permalink
Fixing documentation build on Ubuntu-24.04.
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed Sep 9, 2024
1 parent 2d7e7d9 commit 3d6c2b4
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/actions_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ jobs:
shell: bash
run: ctest -V

- name: Documentation
working-directory: ${{runner.workspace}}/build
shell: bash
run: make doc_comms

build_clang_old_ubuntu_20_04:
runs-on: ubuntu-20.04
strategy:
Expand Down Expand Up @@ -380,6 +385,11 @@ jobs:
shell: bash
run: ctest -V

- name: Documentation
working-directory: ${{runner.workspace}}/build
shell: bash
run: make doc_comms

build_msvc_2019:
runs-on: windows-2019
strategy:
Expand Down
15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,21 @@ set (LIB_COMMS_CMAKE_FILES
find_package (Doxygen)
if (DOXYGEN_FOUND)
set (doc_output_dir "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/doc/comms")

set (match_str "OUTPUT_DIRECTORY[^\n]*")
set (replacement_str "OUTPUT_DIRECTORY = ${doc_output_dir}")
set (output_file "${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf")

set (out_dir_match_str "OUTPUT_DIRECTORY[^\n]*")
set (out_dir_replacement_str "OUTPUT_DIRECTORY = ${doc_output_dir}")

set (config_file "${CMAKE_CURRENT_SOURCE_DIR}/doxygen/doxygen.conf")
file (READ ${config_file} config_text)
string (REGEX REPLACE "${match_str}" "${replacement_str}" modified_config_text "${config_text}")
string (REGEX REPLACE "${out_dir_match_str}" "${out_dir_replacement_str}" modified_config_text "${config_text}")

if (UNIX)
set (dia_path_match_str "DIA_PATH[^\n]*")
set (dia_path_replacement_str "DIA_PATH = ${PROJECT_SOURCE_DIR}/script")
string (REGEX REPLACE "${dia_path_match_str}" "${dia_path_replacement_str}" modified_config_text "${modified_config_text}")
endif ()

file (WRITE "${output_file}" "${modified_config_text}")

add_custom_target ("doc_comms"
Expand Down
39 changes: 39 additions & 0 deletions script/dia
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

# Replacement of "dia" on Linux, because doxygen hardcodes "-t png-libart" parameters while "dia" doesn't have this filter any more

MISSING_FILTER="png-libart"
REPLACEMENT_FILTER="cairo-png"
DIA_PATH="/usr/bin/dia"

###########################################

has_requested_filter=$(${DIA_PATH} --list-filters 2>/dev/null | grep ${MISSING_FILTER})
if [ -n "${has_requested_filter}" ]; then
exec ${DIA_PATH} "$@"
exit 0
fi

new_params=()

while [[ $# -gt 0 ]]; do
case "$1" in
-t)
# If the current argument is "-t", shift and check the next argument
shift
if [ "$1" == "${MISSING_FILTER}" ]; then
new_params+=("-t" "${REPLACEMENT_FILTER}")
else
new_params+=("-t" "$1")
fi
;;
*)
# For all other arguments, just add them to the array
new_params+=("$1")
;;
esac
shift
done

echo "!!! Invoking ${DIA_PATH} ${new_params[@]}"
exec ${DIA_PATH} "${new_params[@]}"

0 comments on commit 3d6c2b4

Please sign in to comment.