Skip to content

Commit

Permalink
Update gen_doc script and Doxygen configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
JonatanAntoni committed Feb 12, 2025
1 parent 36b16c3 commit 6e319e4
Show file tree
Hide file tree
Showing 5 changed files with 244 additions and 5,346 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
doc/html
*.bak
doxygen/svd.doxy
doxygen/svd.dxy
doxygen/src/history.txt
61 changes: 15 additions & 46 deletions doxygen/gen_doc.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Version: 2.0
# Date: 2022-08-30
# This bash script generates CMSIS-View documentation
Expand All @@ -10,70 +10,39 @@
set -o pipefail

# Set version of gen pack library
REQUIRED_GEN_PACK_LIB="0.2.0"
REQUIRED_GEN_PACK_LIB="0.11.1"

DIRNAME=$(dirname $(readlink -f $0))
DOXYGEN=$(which doxygen 2>/dev/null)
REQ_DXY_VERSION="1.9.2"
REQ_DXY_VERSION="1.9.6"

if [[ ! -f "${DOXYGEN}" ]]; then
echo "Doxygen not found!" >&2
echo "Did you miss to add it to PATH?"
exit 1
############ DO NOT EDIT BELOW ###########

# Set GEN_PACK_LIB_PATH to use a specific gen-pack library root
# ... instead of bootstrap based on REQUIRED_GEN_PACK_LIB
if [[ -n "${GEN_PACK_LIB_PATH}" ]] && [[ -f "${GEN_PACK_LIB_PATH}/gen-pack" ]]; then
. "${GEN_PACK_LIB_PATH}/gen-pack"
else
version=$("${DOXYGEN}" --version | sed -E 's/.*([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
echo "Doxygen is ${DOXYGEN} at version ${version}"
if [[ "${version}" != "${REQ_DXY_VERSION}" ]]; then
echo "Doxygen required to be at version ${REQ_DXY_VERSION}!" >&2
exit 1
fi
. <(curl -sL "https://raw.githubusercontent.com/Open-CMSIS-Pack/gen-pack/main/bootstrap")
fi

############ DO NOT EDIT BELOW ###########

function install_lib() {
local URL="https://github.com/Open-CMSIS-Pack/gen-pack/archive/refs/tags/v$1.tar.gz"
echo "Downloading gen_pack lib to '$2'"
mkdir -p "$2"
curl -L "${URL}" -s | tar -xzf - --strip-components 1 -C "$2" || exit 1
}

function load_lib() {
local GLOBAL_LIB="/usr/local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
local USER_LIB="${HOME}/.local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
if [[ ! -d "${GLOBAL_LIB}" && ! -d "${USER_LIB}" ]]; then
echo "Required gen-pack lib not found!" >&2
install_lib "${REQUIRED_GEN_PACK_LIB}" "${USER_LIB}"
fi

if [[ -d "${GLOBAL_LIB}" ]]; then
. "${GLOBAL_LIB}/gen-pack"
elif [[ -d "${USER_LIB}" ]]; then
. "${USER_LIB}/gen-pack"
else
echo "Required gen-pack lib is not installed!" >&2
exit 1
fi
}

load_lib
find_git
find_doxygen "${REQ_DXY_VERSION}"

if [ -z $VERSION ]; then
VERSION_FULL=$(git_describe "v")
VERSION=${VERSION_FULL%+*}
fi

pushd "${DIRNAME}" > /dev/null
pushd "${DIRNAME}" || exit > /dev/null

echo "Generating documentation ..."

sed -e "s/{projectNumber}/${VERSION}/" svd.dxy.in > svd.dxy

git_changelog -f html -p "v" > src/history.txt

echo "\"${DOXYGEN}\" svd.dxy"
"${DOXYGEN}" svd.dxy
echo "\"${UTILITY_DOXYGEN}\" svd.dxy"
"${UTILITY_DOXYGEN}" svd.dxy

if [[ $2 != 0 ]]; then
mkdir -p "${DIRNAME}/../doc/html/search/"
Expand All @@ -91,6 +60,6 @@ sed -e "s/{datetime}/${datetime}/" "${DIRNAME}/templates/footer.js.in" \
| sed -e "s/{projectNumberFull}/${VERSION_FULL}/" \
> "${DIRNAME}/../doc/html/footer.js"

popd > /dev/null
popd || exit > /dev/null

exit 0
Loading

0 comments on commit 6e319e4

Please sign in to comment.