Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fprettify test #232

Draft
wants to merge 9 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Spack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- name: recipe-check
run: |
echo "If this jobs fails, look at the most recently output CMake option below and make sure that option appears in spack/package.py"
for opt in $(grep -ioP '^option\(\K(?!(ENABLE_DOCS|TEST_TIME_LIMIT))[^ ]+' $GITHUB_WORKSPACE/ip/CMakeLists.txt) ; do
for opt in $(grep -ioP '^option\(\K(?!(ENABLE_DOCS|TEST_TIME_LIMIT|F90_AUTOFORMAT))[^ ]+' $GITHUB_WORKSPACE/ip/CMakeLists.txt) ; do
echo "Checking for presence of '$opt' CMake option in package.py"
grep -cP "define.+\b${opt}\b" $GITHUB_WORKSPACE/ip/spack/package.py
done
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ install/

*.swp
.DS_Store

*.bkp
21 changes: 21 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ option(BUILD_D "Build the 8-byte real version of the library, libip_d.{a,so}" ON
option(BUILD_8 "Build the 8-byte integer & real version of the library, libip_8.{a,so}" OFF)
option(BUILD_DEPRECATED "Build deprecated spectral processing functions" OFF)
option(TEST_TIME_LIMIT "Set timeout for tests" OFF)
option(F90_AUTOFORMAT "Use fprettify to reformat source code" OFF)

# Figure whether user wants a _4, a _d, and/or _8.
if(BUILD_4)
Expand Down Expand Up @@ -83,3 +84,23 @@ if(ENABLE_DOCS)
set(abs_top_srcdir "${CMAKE_SOURCE_DIR}")
add_subdirectory(docs)
endif()

# Run 'fprettify' autoformatter directly on src/*.F90
if(F90_AUTOFORMAT)
find_program(FPRETTIFY_EXE fprettify REQUIRED)
execute_process(
COMMAND ${FPRETTIFY_EXE} --version
OUTPUT_VARIABLE FPRETTIFY_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT ${FPRETTIFY_VERSION} MATCHES "-emc$")
message(FATAL_ERROR "The EMC-modified version of fprettify is required")
endif()
message(STATUS "Creating 'fprettify' target to directly update src/*.F90")
add_custom_target(
fprettify
COMMAND ${FPRETTIFY_EXE} --case 1 1 1 1 1 --indent 4
--whitespace 0 --enable-replacements --bkup_suffix .bkp
"${CMAKE_SOURCE_DIR}/src/*.F90"
)
endif()
Loading
Loading