Skip to content

Commit 2159610

Browse files
committed
Update broken CMake due to FORD changes
- Still dynamically and efficiently compute ford outputs so proper dependency checking will prevent unnecessary rebuilds - Add some debugging to the travis-ci coverage push - fix some broken links in FORD documentation - tweak json-module.md so it plays nicer with CMake and ./build.sh - Only enable USE_UCS4 macro to FORD if actually building for unicode
1 parent 42f40a6 commit 2159610

File tree

6 files changed

+39
-20
lines changed

6 files changed

+39
-20
lines changed

.travis.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,14 @@ script:
8080

8181
after_success:
8282
- cd $TRAVIS_BUILD_DIR
83-
- |
84-
if [[ $CODE_COVERAGE == [yY]* ]]; then
85-
bash <(curl -s https://codecov.io/bash) -f json_fortran.F90.gcov jf_test_*.[fF]90.gcov
86-
fi
8783
- git config --global user.name "TRAVIS-CI-for-$(git --no-pager show -s --format='%cn' $TRAVIS_COMMIT)"
8884
- git config --global user.email "$(git --no-pager show -s --format='%ce' $TRAVIS_COMMIT)"
8985
#broken for now# - ./deploy.sh #handles updating documentation for master branch as well as tags
86+
- (yes | rm -r doc gh-pages) || true # wipe out doc dirs to avoid confusing codecov
87+
- |
88+
if [[ $CODE_COVERAGE == [yY]* ]]; then
89+
rm json_module-*unicode.F90.gcov || true
90+
mv json_module.F90.gcov src/
91+
mv jf_test*.[fF]90.gcov src/tests/
92+
bash <(curl -s https://codecov.io/bash) -v -X gcov
93+
fi

CMakeLists.txt

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,36 +146,49 @@ if ( NOT SKIP_DOC_GEN )
146146
find_program ( FORD ford )
147147
if ( FORD ) # Found
148148
file ( COPY "${CMAKE_SOURCE_DIR}/media" DESTINATION "${CMAKE_BINARY_DIR}/" )
149+
file ( GLOB_RECURSE PAGES_FILES "${CMAKE_SOURCE_DIR}/pages/*.*")
149150
set ( DOC_DIR "${CMAKE_BINARY_DIR}/doc" )
151+
set ( PAGES_DIR "${CMAKE_SOURCE_DIR}/pages" )
152+
set ( PROJ_DIR "${CMAKE_SOURCE_DIR}/src" )
150153
set ( FORD_PROJECT_FILE "${CMAKE_SOURCE_DIR}/json-fortran.md" )
154+
if ( ENABLE_UNICODE )
155+
set ( MACRO_FLAG "-m USE_UCS4" )
156+
else ()
157+
set ( MACRO_FLAG "" )
158+
endif ()
151159
# Dynamically generate the FORD outputs list
152160
message ( STATUS "Dynamically computing FORD output information..." )
153161
if ( NOT (DEFINED FORD_OUTPUTS_CACHED) )
154162
message ( STATUS "Running FORD to dynamically compute documentation outputs, this could take a while..." )
155163
execute_process ( COMMAND ${CMAKE_COMMAND} -E remove_directory ${DOC_DIR}
156164
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOC_DIR}
157-
COMMAND "${FORD}" -d "${CMAKE_SOURCE_DIR}/src" -o "${DOC_DIR}" "${FORD_PROJECT_FILE}" OUTPUT_QUIET )
165+
COMMAND "${FORD}" -q ${MACRO_FLAG} -d "${PROJ_DIR}" -o "${DOC_DIR}" -p "${PAGE_DIR}" "${FORD_PROJECT_FILE}" OUTPUT_QUIET )
166+
else ()
167+
message ( STATUS "Re-using cached FORD outputs, rather than regenerating them" )
158168
endif ()
159169
file ( GLOB_RECURSE FORD_OUTPUTS
160-
"${DOC_DIR}/*.html" )
170+
"${DOC_DIR}/*.*" )
161171
file ( GLOB_RECURSE FORD_CLEAN_OUTPUTS
162172
"${DOC_DIR}/*.*" )
163173
if ( (DEFINED FORD_OUTPUTS) AND ( NOT ( "${FORD_OUTPUTS}" STREQUAL "" ) ) )
174+
message ( STATUS "Caching FORD outputs" )
164175
set ( FORD_OUTPUTS_CACHED "${FORD_OUTPUTS}"
165-
CACHE INTERNAL "internal variable to attempt to prevent rebuilding FORD docs" FORCE )
176+
CACHE STRING "variable containing FORD outputs to prevent rebuilding FORD docs" FORCE )
166177
endif ()
167178
message ( STATUS "Done dynamically computing FORD outputs." )
168179

169-
foreach ( SRC_FILE ${JF_LIB_SRCS} ${JF_TEST_SRCS} )
170-
list ( APPEND FORD_DEPENDS "${SRC_FILE}" )
171-
endforeach ( SRC_FILE )
180+
foreach ( DOC_SRC_FILE ${JF_LIB_SRCS} ${JF_TEST_SRCS} ${CMAKE_SOURCE_DIR}/README.md
181+
${CMAKE_SOURCE_DIR}/CHANGELOG.md ${CMAKE_SOURCE_DIR}/CONTRIBUTING.md
182+
${CMAKE_SOURCE_DIR}/LICENSE ${CMAKE_SOURCE_DIR}/json-fortran.md ${PAGES_FILES} )
183+
list ( APPEND FORD_DEPENDS "${DOC_SRC_FILE}" )
184+
endforeach ()
172185
add_custom_command ( OUTPUT ${FORD_OUTPUTS_CACHED}
173-
COMMAND "${FORD}" -d "${CMAKE_SOURCE_DIR}/src" -o "${DOC_DIR}" "${FORD_PROJECT_FILE}"
186+
COMMAND "${FORD}" ${MACRO_FLAG} -d "${PROJ_DIR}" -o "${DOC_DIR}" -p "${CMAKE_SOURCE_DIR}/pages" "${FORD_PROJECT_FILE}"
174187
MAIN_DEPENDENCY "${FORD_PROJECT_FILE}"
175188
DEPENDS ${FORD_DEPENDS}
176189
COMMENT "Building HTML documentation for ${CMAKE_PROJECT_NAME} using FORD" )
177190
add_custom_target ( documentation ALL
178-
DEPENDS ${FORD_OUTPUTS} )
191+
DEPENDS ${FORD_OUTPUTS_CACHED} )
179192
set ( INSTALL_API_DOCUMENTATION TRUE
180193
CACHE BOOL "Install FORD generated documentation?" )
181194
if ( INSTALL_API_DOCUMENTATION )

build.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
set -e
6565

6666
FORDMD='json-fortran.md' # FORD options file for building documentation
67-
DOCDIR='./documentation/' # build directory for documentation
67+
DOCDIR='./doc/' # build directory for documentation
68+
PAGESDIR='./pages/' # Directory for FORD "pages"
6869
SRCDIR='./src/' # library source directory
6970
TESTDIR='./src/tests/' # unit test source directory
7071
INTROSPECDIR='./src/tests/introspection/' # pre compile configuration tests directory
@@ -330,7 +331,8 @@ echo ""
330331
if [[ $JF_SKIP_DOCS != [yY]* ]]; then
331332
if hash ford 2>/dev/null; then
332333
echo "Building documentation..."
333-
ford $FORDMD
334+
[[ $TRY_UNICODE = [yY]* ]] && MACRO_FLAG="-m USE_UCS4"
335+
ford $MACRO_FLAG -p $PAGESDIR $FORDMD
334336
else
335337
echo "FORD not found! Install using: sudo pip install ford"
336338
fi

json-fortran.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
page_dir: pages
21
project: json-fortran
32
favicon: ./media/json-fortran-32x32.png
43
project_dir: ./src
5-
macro: USE_UCS4
64
output_dir: ./doc
75
media_dir: ./media
86
project_github: https://github.com/jacobwilliams/json-fortran
@@ -39,7 +37,7 @@ The json-fortran source code and related files and documentation are distributed
3937
# Offficial Releases
4038

4139
Browse the documentation for a particular release
42-
[here](|url|releases/index.html) or download the latest official
40+
[here](|url|/page/releases/index.html) or download the latest official
4341
release
4442
[here](https://github.com/jacobwilliams/json-fortran/releases/tag/4.1.1).
4543

pages/development-resources/json_module.F90.gcov.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ title: Coverage Analysis
1010
The following report was automatically generated from
1111
[gcov](https://gcc.gnu.org/onlinedocs/gcc/Gcov.html) output by the
1212
[FoBiS.py](https://github.com/szaghi/FoBiS) Fortran build
13-
tool. [gccr.pl](|url|page/development-resources/gccr.pl) was used to
13+
tool. [gccr.pl](|url|/page/development-resources/gccr.pl) was used to
1414
merge [gcov](https://gcc.gnu.org/onlinedocs/gcc/Gcov.html) coverage
1515
reports, and can be obtained at <https://github.com/eel3/gccr>. If
1616
procedure coverage is at 100%, also have a look at the

pages/releases/index.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ title: Official Releases
55
# Official Releases
66

77
This is where to find the documentation corresponding to an official,
8-
tagged release.
8+
tagged release. If you are looking for the most current documentation
9+
of the `master` branch, please head back to the
10+
[main page](|url|/index.html).
911

1012
## Latest Stable Release
1113

@@ -19,7 +21,7 @@ tagged release.
1921
**Note:** There is currently no way to navigate back to the general/master
2022
documentation from the documentation for official releases other than
2123
using the browser's back button. Feel free to bookmark this page, or
22-
the [main project page](|url|index.html) for convenient navigation.
24+
the [main project page](|url|/index.html) for convenient navigation.
2325

2426
* [4.1.1](http://jacobwilliams.github.io/json-fortran/4.1.1/json_module_F90.html)
2527
([ROBODoc](https://github.com/gumpu/ROBODoc) generated documentation)

0 commit comments

Comments
 (0)