Skip to content

Commit

Permalink
Simplify fetching m.css
Browse files Browse the repository at this point in the history
m.css is now fetched from a fork that implements some pull requests that
have not yet been accepted into the main repository, but also contains
the fix for trailing return types being messed up.
  • Loading branch information
friendlyanon committed Jul 16, 2021
1 parent 31a9b09 commit 85cff27
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
30 changes: 13 additions & 17 deletions cmake-init/templates/common/cmake/docs.cmake
Expand Up @@ -34,35 +34,31 @@ endif()

# ---- Dependencies ----

# Fetch m.css manually, so this script can be used without having to configure
# the project
set(committish 9385194fa3392a7162e7535cc2478814e382ff8a)
set(
mcss_url
https://github.com/friendlyanon/m.css/releases/download/release-1/mcss.zip
)
set(mcss_root "${PROJECT_BINARY_DIR}/mcss")
set(mcss_zip "${mcss_root}/${committish}.zip")
if(NOT EXISTS "${mcss_zip}")
file(REMOVE_RECURSE "${mcss_root}")
set(mcss_extract "${mcss_root}/_extract")
file(MAKE_DIRECTORY "${mcss_extract}")
message(STATUS "Downloading m.css (${committish})")
set(mcss_url "https://github.com/mosra/m.css/archive/${committish}.zip")
if(NOT EXISTS "${mcss_root}")
file(MAKE_DIRECTORY "${mcss_root}")
message(STATUS "Downloading m.css")
file(
DOWNLOAD "${mcss_url}" "${mcss_zip}"
EXPECTED_HASH MD5=45C4DCFE34471402AE88C453EED098CF
DOWNLOAD "${mcss_url}" "${mcss_root}/mcss.zip"
EXPECTED_HASH MD5=00cd2757ebafb9bcba7f5d399b3bec7f
STATUS status
)
if(NOT status MATCHES "^0;")
message(FATAL_ERROR "file(DOWNLOAD) returned with ${status}")
endif()
execute_process(
COMMAND "${CMAKE_COMMAND}" -E tar xf "${mcss_zip}"
WORKING_DIRECTORY "${mcss_extract}"
COMMAND "${CMAKE_COMMAND}" -E tar xf "${mcss_root}/mcss.zip"
WORKING_DIRECTORY "${mcss_root}"
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "Trying to extract m.css returned with ${result}")
endif()
file(GLOB mcss_source "${mcss_extract}/*")
file(RENAME "${mcss_source}" "${mcss_root}/src")
file(REMOVE "${mcss_root}/mcss.zip")
endif()

find_package(Python3 3.6 REQUIRED)
Expand All @@ -80,7 +76,7 @@ foreach(file IN ITEMS Doxyfile conf.py)
configure_file("docs/${file}.in" "${working_dir}/${file}" @ONLY)
endforeach()

set(mcss_script "${mcss_root}/src/documentation/doxygen.py")
set(mcss_script "${mcss_root}/documentation/doxygen.py")
set(config "${working_dir}/conf.py")

if(DEFINED CMAKE_SCRIPT_MODE_FILE)
Expand Down
1 change: 1 addition & 0 deletions cmake-init/templates/common/docs/Doxyfile.in
Expand Up @@ -18,6 +18,7 @@ USE_MDFILE_AS_MAINPAGE = "@PROJECT_SOURCE_DIR@/README.md"
# set relative include paths
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = "@PROJECT_SOURCE_DIR@/include" "@PROJECT_SOURCE_DIR@"
STRIP_FROM_INC_PATH =

# We use m.css to generate the html documentation, so we only need XML output
GENERATE_XML = YES
Expand Down

0 comments on commit 85cff27

Please sign in to comment.