-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a25ed14
commit 5373060
Showing
7 changed files
with
1,808 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# srcext [in]: File extension of the source files | ||
# trgext [in]: File extension of the target files | ||
# srcfiles [in]: List of the source files | ||
# trgfiles [out]: Contains the list of the preprocessed files on exit | ||
# | ||
function(preprocess preproc preprocopts srcext trgext srcfiles trgfiles) | ||
|
||
set(_trgfiles) | ||
foreach(srcfile IN LISTS srcfiles) | ||
string(REGEX REPLACE "\\.${srcext}$" ".${trgext}" trgfile ${srcfile}) | ||
add_custom_command( | ||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${trgfile} | ||
COMMAND ${preproc} ${preprocopts} ${CMAKE_CURRENT_SOURCE_DIR}/${srcfile} ${CMAKE_CURRENT_BINARY_DIR}/${trgfile} | ||
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}) | ||
list(APPEND _trgfiles ${CMAKE_CURRENT_BINARY_DIR}/${trgfile}) | ||
endforeach() | ||
set(${trgfiles} ${_trgfiles} PARENT_SCOPE) | ||
|
||
endfunction() | ||
|
||
# Preprocesses fortran files with fypp. | ||
# | ||
# It assumes that source files have the ".fypp" extension. Target files will be | ||
# created with the extension ".f90". The FYPP variable must contain the path to | ||
# the fypp-preprocessor. | ||
# | ||
# Args: | ||
# fyppopts [in]: Options to pass to fypp. | ||
# fyppfiles [in]: Files to be processed by fypp | ||
# f90files [out]: List of created f90 files on exit | ||
# | ||
function (fypp_f90 fyppopts fyppfiles f90files) | ||
preprocess("${FYPP}" "${fyppopts}" "fypp" "f90" "${fyppfiles}" _f90files) | ||
set(${f90files} ${_f90files} PARENT_SCOPE) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.