Skip to content

Commit 3802855

Browse files
committed
CMake documentation
1 parent 2f69443 commit 3802855

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1439
-9186
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ jobs:
6868
name: ${{ matrix.os }}
6969
path: |
7070
build/**/*.log
71+
build/**/*.txt
7172
tests/**/*.dat
7273
tests/**/*.out
7374
tests/**/*.inp

.github/workflows/doc.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- GPU
7+
8+
workflow_dispatch:
9+
10+
jobs:
11+
doc:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Build Documentation
18+
run: |
19+
sudo apt install cmake ninja-build doxygen graphviz
20+
pip3 install fypp
21+
mkdir -p build/install
22+
cd build
23+
cmake -GNinja -DCMAKE_INSTALL_PREFIX=$(pwd)/install -DMFC_BUILD_DOC=ON ..
24+
ninja install
25+
26+
- name: Publish Documentation
27+
run: |
28+
set +e
29+
cd build
30+
git ls-remote "${{ secrets.DOC_PUSH_URL }}" -q
31+
code=$?
32+
if [ "$code" -ne "0" ]; then exit 0; fi
33+
git config --global user.name "MFC Action"
34+
git config --global user.email "MFC Action"
35+
git clone "${{ secrets.DOC_PUSH_URL }}"
36+
cd MFC-DOC
37+
mv .github ..
38+
rm -rf $(pwd)/*
39+
mv ../.github .
40+
mv ../install/doc/* .
41+
git add -A
42+
git commit -m "${{ github.sha }}: $(date +%d/%m/%Y-%H:%M:%S)" || true
43+
git push
44+
45+
# DOC_PUSH_URL should be of the format:
46+
# - "https://${{ github.repository_owner }}:${{ TOKEN }}@github.com/${{ github.repository_owner }}/${{ github.repository_owner }}.github.io"

AUTHORS

Lines changed: 0 additions & 12 deletions
This file was deleted.

CITATION.cff

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Documentation on this file format is available here:
2+
# - https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-citation-files
3+
# - https://citation-file-format.github.io/
4+
5+
cff-version: 1.2.0
6+
message: "If you use this software, please cite it as below."
7+
title: "Multicomponent Flow Code"
8+
url: "https://github.com/MFlowCode/MFC"
9+
preferred-citation:
10+
type: article
11+
title: "MFC: An open-source high-order multi-component, multi-phase, and multi-scale compressible flow solver"
12+
journal: "Computer Physics Communications"
13+
doi: "10.1016/j.cpc.2020.107396"
14+
volume: 266
15+
start: 107396
16+
month: 5
17+
year: 2021
18+
authors:
19+
- given-names: Spencer H.
20+
family-names: Bryngelson
21+
- given-names: Kevin
22+
family-names: Schmidmayer
23+
- given-names: Vedran
24+
family-names: Coralic
25+
- given-names: Jomela C.
26+
family-names: Meng
27+
- given-names: Kazuki
28+
family-names: Maeda
29+
- given-names: Tim
30+
family-names: Colonius

CMakeLists.txt

Lines changed: 110 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,25 @@ PROJECT(MFC LANGUAGES C CXX Fortran)
44

55

66
# === Options
7-
OPTION(MFC_WITH_MPI "Build with MPI" ON)
8-
OPTION(MFC_WITH_OPEN_ACC "Build with OpenACC" OFF)
9-
OPTION(MFC_BUILD_PRE_PROCESS "Build pre_process" OFF)
10-
OPTION(MFC_BUILD_SIMULATION "Build simulation" OFF)
11-
OPTION(MFC_BUILD_POST_PROCESS "Build post_process" OFF)
12-
OPTION(MFC_BUILD_ALL "Build pre_process, simulation, and post_process" OFF)
7+
OPTION(MFC_WITH_MPI "Build with MPI" ON)
8+
OPTION(MFC_WITH_OPEN_ACC "Build with OpenACC" OFF)
9+
OPTION(MFC_BUILD_PRE_PROCESS "Build pre_process" OFF)
10+
OPTION(MFC_BUILD_SIMULATION "Build simulation" OFF)
11+
OPTION(MFC_BUILD_POST_PROCESS "Build post_process" OFF)
12+
OPTION(MFC_BUILD_DOC "Build documentation" OFF)
13+
OPTION(MFC_BUILD_ALL "Build pre_process, simulation, and post_process" OFF)
1314

1415
IF (MFC_BUILD_ALL)
1516
SET(MFC_BUILD_PRE_PROCESS ON FORCE)
1617
SET(MFC_BUILD_SIMULATION ON FORCE)
1718
SET(MFC_BUILD_POST_PROCESS ON FORCE)
19+
SET(MFC_BUILD_DOC ON FORCE)
1820
ENDIF()
1921

2022

2123
# === Imports
2224
INCLUDE(GNUInstallDirs)
25+
INCLUDE(ExternalProject)
2326
INCLUDE(CheckIPOSupported)
2427
INCLUDE(CheckFortranCompilerFlag)
2528

@@ -49,7 +52,7 @@ ELSEIF (CMAKE_Fortran_COMPILER_ID STREQUAL "AppleClang")
4952
ENDIF()
5053

5154
# === === Find Fypp
52-
FIND_PROGRAM(FYPP_PATH fypp REQUIRED)
55+
FIND_PROGRAM(FYPP_EXE fypp REQUIRED)
5356

5457

5558
# === Miscellaneous Configuration
@@ -133,7 +136,7 @@ ENDIF()
133136

134137
# === Locate Libraries
135138
# === === MPI
136-
IF (MFC_WITH_MPI)
139+
IF (MFC_WITH_MPI AND (MFC_BUILD_PRE_PROCESS OR MFC_BUILD_SIMULATION OR MFC_BUILD_POST_PROCESS))
137140
FIND_PACKAGE(MPI COMPONENTS Fortran REQUIRED)
138141
ENDIF()
139142

@@ -187,7 +190,7 @@ MACRO(HANDLE_FYPP target)
187190

188191
ADD_CUSTOM_COMMAND(
189192
OUTPUT "${f90_filepath}"
190-
COMMAND "fypp" "${fpp_filepath}" "${f90_filepath}"
193+
COMMAND "${FYPP_EXE}" "${fpp_filepath}" "${f90_filepath}"
191194
DEPENDS "${fpp_filepath}" "${CMAKE_CURRENT_SOURCE_DIR}/src/common_code/case.fpp"
192195
COMMENT "Preprocessing ${fpp_filename}"
193196
VERBATIM
@@ -200,14 +203,15 @@ ENDMACRO()
200203

201204

202205
# === Handle src/ Folder
203-
# === === src/common_code
206+
# === === Fypp / Sources
204207
HANDLE_FYPP(common)
208+
HANDLE_FYPP(pre_process)
209+
HANDLE_FYPP(simulation)
210+
HANDLE_FYPP(post_process)
205211

206212

207213
# === === src/pre_process_code
208214
IF (MFC_BUILD_PRE_PROCESS)
209-
HANDLE_FYPP(pre_process)
210-
211215
ADD_EXECUTABLE(pre_process "${pre_process_srcs}" "${common_srcs}")
212216

213217

@@ -226,8 +230,6 @@ ENDIF()
226230

227231
# === === src/simulation_code
228232
IF (MFC_BUILD_SIMULATION)
229-
HANDLE_FYPP(simulation)
230-
231233
ADD_EXECUTABLE(simulation "${simulation_srcs}" "${common_srcs}")
232234

233235

@@ -286,8 +288,6 @@ ENDIF()
286288

287289
# === === src/post_process_code
288290
IF (MFC_BUILD_POST_PROCESS)
289-
HANDLE_FYPP(post_process)
290-
291291
ADD_EXECUTABLE(post_process "${post_process_srcs}" "${common_srcs}")
292292

293293
TARGET_LINK_LIBRARIES(post_process PRIVATE SILO::SILO HDF5::HDF5 FFTW::FFTW)
@@ -302,3 +302,97 @@ IF (MFC_BUILD_POST_PROCESS)
302302

303303
INSTALL(TARGETS post_process RUNTIME DESTINATION bin)
304304
ENDIF()
305+
306+
307+
ADD_CUSTOM_TARGET("doc")
308+
309+
MACRO(GEN_DOCS target name)
310+
311+
SET(DOXYGEN_PROJECT_NAME "${name}")
312+
313+
FILE(
314+
COPY "${CMAKE_CURRENT_SOURCE_DIR}/doc/${target}"
315+
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doxygen"
316+
)
317+
318+
CONFIGURE_FILE(
319+
"${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in"
320+
"${CMAKE_CURRENT_BINARY_DIR}/doxygen/${target}/Doxyfile"
321+
@ONLY
322+
)
323+
324+
FILE(
325+
COPY "${CMAKE_CURRENT_SOURCE_DIR}/doc/res"
326+
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doxygen"
327+
)
328+
329+
FILE(
330+
COPY "${CMAKE_CURRENT_SOURCE_DIR}/doc/config.js"
331+
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doxygen"
332+
)
333+
334+
ADD_CUSTOM_COMMAND(
335+
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/doxygen/${target}/html/index.html"
336+
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/doxygen/${target}/Doxyfile"
337+
"${${target}_srcs}"
338+
COMMAND "${DOXYGEN_EXECUTABLE}"
339+
"Doxyfile"
340+
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doxygen/${target}"
341+
COMMENT "${target}: Generating docs"
342+
)
343+
344+
ADD_CUSTOM_TARGET(
345+
"${target}_doxygen" ALL
346+
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/doxygen/${target}/html/index.html"
347+
)
348+
349+
ADD_DEPENDENCIES("${target}_doxygen" doxygen-awesome-css)
350+
ADD_DEPENDENCIES("doc" "${target}_doxygen")
351+
352+
INSTALL(
353+
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doxygen/${target}/html/"
354+
DESTINATION "doc/${target}"
355+
)
356+
357+
INSTALL(
358+
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doxygen/res/"
359+
DESTINATION "doc/res"
360+
)
361+
362+
INSTALL(
363+
FILES "${CMAKE_CURRENT_SOURCE_DIR}/doc/index.html"
364+
DESTINATION "doc"
365+
)
366+
367+
ENDMACRO()
368+
369+
370+
# === Documentation
371+
IF (MFC_BUILD_DOC)
372+
373+
# === === Find Doxygen
374+
FIND_PACKAGE(Doxygen REQUIRED dot REQUIRED)
375+
376+
# === === Fetch CSS Theme
377+
ExternalProject_Add(doxygen-awesome-css
378+
PREFIX doxygen-awesome-css
379+
GIT_REPOSITORY "https://github.com/jothepro/doxygen-awesome-css"
380+
GIT_TAG "a5efba07a3d4fd6317d95657b3095b97e134b791"
381+
CONFIGURE_COMMAND ""
382+
BUILD_COMMAND ""
383+
INSTALL_COMMAND ""
384+
)
385+
386+
SET(theme_dirpath "${CMAKE_CURRENT_BINARY_DIR}/doxygen-awesome-css/src/doxygen-awesome-css/")
387+
388+
SET(DOXYGEN_HTML_EXTRA_STYLESHEET "\"${theme_dirpath}/doxygen-awesome.css\"")
389+
390+
# === === Generate Documentation
391+
GEN_DOCS(pre_process "MFC: Pre-Process")
392+
GEN_DOCS(simulation "MFC: Simulation")
393+
GEN_DOCS(post_process "MFC: Post-Process")
394+
395+
# === === Generate Landing Page
396+
GEN_DOCS(landing "MFC")
397+
398+
ENDIF()

0 commit comments

Comments
 (0)