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

Merge feature/capgen into main 2021/08/12 #391

Merged
merged 172 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from 163 commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
de57a40
init my_co and use in run
cacraigucar Jun 6, 2018
f5bfebc
removed some unnecessary files from the build
fvitt Jun 12, 2018
f5bf5b1
Merge pull request #1 from fvitt/cac_devel
cacraigucar Jun 13, 2018
9090172
works but verbose
cacraigucar Jun 15, 2018
57cfbee
cleanup and still using scm
cacraigucar Jun 15, 2018
edf9c3a
one more commit
cacraigucar Jun 15, 2018
e8280c9
add MICM as model
cacraigucar Jun 18, 2018
d7a5e05
add scripts/ccpp_prebuild_config_MICM.py
cacraigucar Jun 18, 2018
09d17dd
simple1
cacraigucar Jun 22, 2018
34cd5aa
change from micm to ibox for driver code
cacraigucar Jun 26, 2018
697e8af
Added kinetics
cacraigucar Jul 6, 2018
313893e
Remove ccpp_physics and replace with MICM_chemistry
cacraigucar Jul 20, 2018
a2bf736
Merge branch 'xx2' into cac_devel
cacraigucar Jul 20, 2018
8846206
change type_def filenames
cacraigucar Jul 25, 2018
8bab3c4
remove mimc_type_def file
cacraigucar Jul 26, 2018
db2f9c7
additional script cleanup
cacraigucar Jul 26, 2018
a35bb09
renamed ibox_type_defs file to ibox_var_defs
cacraigucar Jul 26, 2018
cbed34b
updates to support Stacy's Object-Oriented code
cacraigucar Aug 2, 2018
faf5dee
Updated to MusicBox
cacraigucar Aug 3, 2018
4363810
Using MusicBox_host directory
cacraigucar Aug 3, 2018
e4cfe16
kinetics_module is now named "kinetics_module.F90"
fvitt Aug 23, 2018
5a2a20c
Merge pull request #2 from fvitt/kinetics
cacraigucar Aug 27, 2018
ddc2a32
Renamed the host model variable file
cacraigucar Aug 29, 2018
d4ed074
Adding Kessler
cacraigucar Aug 30, 2018
59c0091
Update to ccpp-framework V2
cacraigucar Aug 31, 2018
153c38e
Merge remote-tracking branch 'origin/cleanup_ccpp-frame006'
cacraigucar Aug 31, 2018
57933fc
Update to CCPP V2
cacraigucar Sep 10, 2018
68497e1
Add k_rateConst_terminator
cacraigucar Sep 14, 2018
e40ee27
Allow both 3component and terminator chemistry to be run
cacraigucar Sep 26, 2018
4fe54af
Using chemistry_driver as interface to CCPP
cacraigucar Oct 22, 2018
cfd4eee
Move json reading to MICM library
cacraigucar Oct 24, 2018
0bf217d
Bring in TUV
fvitt Nov 15, 2018
22b2c26
Merge pull request #3 from fvitt/tuv_ccpp-frame015
cacraigucar Nov 16, 2018
665d12d
Cleanup
cacraigucar Nov 19, 2018
5058dd2
add mass scheme code
fvitt Dec 5, 2018
93eb876
Merge pull request #4 from fvitt/mass_ccpp-frame017
cacraigucar Dec 6, 2018
ce2d500
Moved generated code and partial creation of user-defined
cacraigucar Dec 6, 2018
194ab0a
Generate caps for MOZART and Rosenbrock chem drivers; misc cleanup
fvitt Dec 13, 2018
e1de664
Merge pull request #5 from fvitt/ccpp-frame019_solver
cacraigucar Dec 14, 2018
7ac530b
Single script works for all MusicBox runs
cacraigucar Dec 14, 2018
40a6605
First pass at working ccpp_capgen using version 2 metadata
Aug 23, 2018
5a5b3fe
Working on restoring scalar ref code
Jun 3, 2019
2784eea
Fix parsing Fortran files with blank lines at top
Jun 3, 2019
0d7e1cd
Still working on array references as local names
Jun 3, 2019
efc7281
Fix checking of Fortran references
Jun 4, 2019
11629a5
Separate schemes for TUV photolysis
fvitt Jun 7, 2019
3671411
Add DDT use statements
Jun 8, 2019
82d2211
Merge pull request #6 from fvitt/tuv_refactor
cacraigucar Jun 14, 2019
63cf591
Generate unique names for group dummy arguments with duplicate local …
Jun 10, 2019
33d58fc
Allow comment at end of type def line
Jul 31, 2019
a82d17a
First pass at a tool to create a prototype metadata table from a Fort…
Aug 6, 2019
fe08262
Fix some python3 issues, also start work on size as a dimension
Aug 7, 2019
406c82d
Improved ccpp_fortran_to_metadata interface and dimension size check.
Aug 8, 2019
4beed39
Fix bug where errflg does not cause return
Aug 29, 2019
35ae517
Fix Fortran compare by fixing find_local_name
Aug 30, 2019
f539aed
Change vertical_level_x to vertical_interface_x
Aug 30, 2019
266937a
Improve intent error message
Sep 30, 2019
e541b84
- Add README.md with instructions on how to run ccpp_capgen.py and th…
Oct 10, 2019
796976a
- Add sample_files directory to hold test files
Oct 16, 2019
8952f05
- Addd new sample files and tests for
Oct 16, 2019
6a3ad18
Add instructions to get test coverage.
Oct 16, 2019
2cb82d8
Address Steve Goldhaber's comments:
Oct 28, 2019
5779731
Add failing test for missing 'intent'
Oct 28, 2019
8f3dfb2
Use title list without converting to string to avoid corruption
Oct 28, 2019
88a78df
Remove "/" and ".." from path names.
Oct 29, 2019
054f98d
Merge pull request #234 from JulieSchramm/feature/capgen
Oct 31, 2019
78593ad
Fix problem with intent mismatch when host is passing horizontal_loop…
Oct 3, 2019
0257381
Add use statements for DDTs passed as host model arguments.
Oct 10, 2019
31944d6
Fix missing intent test (improved but changed error message)
Oct 31, 2019
f07cc9d
Allow validate_xml_file to take path to schema location
Nov 3, 2019
549e1c1
Merge pull request #237 from gold2718/new_metadata_parser
Nov 4, 2019
759aa32
Add Metadata Table unit tests for:
Jan 22, 2020
be4c1a4
- Shortened sample test files by removing entries after the error
Jan 23, 2020
e54a136
- Add test for bad ccpp-arg-table header in first table
Jan 27, 2020
99b5e23
Add expected error message.
Jan 27, 2020
178906c
Merge pull request #253 from JulieSchramm/feature/capgen
Jan 28, 2020
bad3f9e
Fix and check full python 3 functionality.
Nov 4, 2019
c7f1d8c
Fix test exception message
Jan 29, 2020
c5534f4
Merge pull request #258 from gold2718/new_metadata_parser
Feb 5, 2020
815f089
Improvement in standard name documentation
Jan 30, 2020
86880f5
Start on datafile module
Feb 7, 2020
fa6fce0
Minor additions
Feb 7, 2020
f4cf769
small progress
Feb 8, 2020
eda2b1f
Restored capfiles.txt functionality, on to schemes and the rest
Feb 9, 2020
979d188
Fix issue with missing host-name and issue with capgen test
Feb 9, 2020
47ac41b
Updated SDF schema to allow for process_split, time_split, and subcol…
Feb 10, 2020
803ae9a
Add process keyword to scheme table header. Fix bugs
Feb 10, 2020
e671c02
Fix more cases of intent mismatch
Feb 11, 2020
0dceace
Working on adding schemes to datatable
Feb 11, 2020
ce380a9
Added schemes to datatable and process-list to reports
Feb 11, 2020
0808a98
Added module list report generator
Feb 11, 2020
b864e16
Merge pull request #265 from gold2718/capgen
Mar 13, 2020
0405c76
Removed standard names dictionary, moved to ESCOMP/CCPPStandardNames …
Mar 7, 2020
79847f9
Wrote tests for inspection routines which found errors in inspection …
Mar 28, 2020
2f36195
More interface test and improved python interface
Apr 2, 2020
8fc9afe
python2 fix and pylint improvements
Apr 2, 2020
70e2b1f
Merge pull request #273 from gold2718/capgen
Apr 2, 2020
175527a
Merge remote-tracking branch 'upstream/capgen' into enter_units
cacraigucar Apr 10, 2020
3fd210e
fix enter_units to be one word
cacraigucar Apr 10, 2020
67b90cc
remove extraneous files
cacraigucar Apr 10, 2020
7492b04
Merge pull request #31 from cacraigucar/enter_units
gold2718 Apr 10, 2020
9e0b8d6
Fix documentation
Apr 6, 2020
06675fd
Fix documentation
cacraigucar Apr 10, 2020
1574e3e
Fix documentation
Apr 6, 2020
42921c0
Fix typo in error message
Apr 17, 2020
612652f
Fix missing use statement and add regression test
Apr 17, 2020
d325efd
Fix missing use statement
Apr 17, 2020
1949d4b
Merge pull request #286 from gold2718/capgen
Apr 23, 2020
07580d7
Initial commit of unit testing for capgen parse_scheme_files function.
Jun 1, 2020
48e4713
Merge pull request #300 from JulieSchramm/feature/capgen
climbfuji Jun 2, 2020
9ca5299
Modifications to capgen unit tests to get the perfect rating:
Jun 8, 2020
722c4b6
Merge pull request #302 from JulieSchramm/feature/capgen
Jun 8, 2020
e3e6b20
- Test that a missing metadata header is correctly detected
Jun 16, 2020
d472520
- Add pylint command to README.md file
Jun 18, 2020
d6b1293
Merge pull request #304 from JulieSchramm/feature/capgen
climbfuji Jun 24, 2020
9e52e26
- Add test for correct detection of a variable that remains in the su…
Jul 23, 2020
2620368
Merge pull request #315 from JulieSchramm/feature/capgen
climbfuji Jul 24, 2020
d0e782d
Add 4 more pre-processor directive unit tests to test_metadata_scheme…
Aug 17, 2020
f56c96c
Fix arrayspec error message when Fortran has more items than metadata…
Apr 20, 2020
1124fce
Merge pull request #320 from JulieSchramm/feature/capgen
climbfuji Sep 10, 2020
79d333a
Merge pull request #321 from gold2718/capgen
climbfuji Sep 15, 2020
ff34ca3
Updates to test_metadata_scheme_file.py:
Sep 16, 2020
e7c07b3
Remove dependencies= from *.meta files in sample_scheme_files directory.
Sep 17, 2020
af28719
Merge pull request #323 from JulieSchramm/feature/capgen
climbfuji Oct 7, 2020
25eb54d
Update 20 tests in test_metadata_table.py and the coresponding *.meta…
Oct 12, 2020
a6cb08d
Merge pull request #331 from JulieSchramm/feature/capgen
climbfuji Oct 13, 2020
014edd6
Add more tests for ccpp-table-properties:
Oct 13, 2020
900203d
Set up failing test_dependencies_rel_path test that fails with
Oct 28, 2020
f4305a7
Correctly handle multiple instances of dependencies keyword in table …
climbfuji Oct 13, 2020
5da79a0
Adjust tests and error messages, some pylint improvements
Nov 2, 2020
d61afca
Merge pull request #334 from gold2718/capgen
Nov 11, 2020
7af7ed1
Merge branch 'feature/capgen' of https://github.com/NCAR/ccpp-framewo…
Nov 11, 2020
93c9d8e
Fix test to correctly detect all dependencies read in from 2 separate…
Nov 11, 2020
58f2cb9
Add test for missing units attribute.
Nov 11, 2020
91939e3
Rename two tests for clarity, modify test_metadata_table.py accordingly:
Nov 12, 2020
e895687
Merge pull request #335 from JulieSchramm/feature/capgen
climbfuji Nov 18, 2020
6fd9bdd
Added ability to handle directories and wildcards
Nov 13, 2020
667dd62
Only overwrite modified files
Nov 24, 2020
ea752e3
Merge pull request #339 from gold2718/capgen
Nov 24, 2020
f8acc34
Replace old .travis.yml with new version to run capgen unit tests.
Dec 3, 2020
765efbc
Fix path in pylint test
Dec 3, 2020
4d33670
Remove python versions 3.4 and 3.5 that return an error
Dec 3, 2020
8284e94
Add more developers to notification list for success/failure.
Dec 3, 2020
64e0814
Merge pull request #340 from JulieSchramm/feature/capgen
ligiabernardet Jan 21, 2021
322cade
Start on advected species implementation and test
Jan 29, 2021
2ddedbe
Merge pull request #347 from gold2718/capgen
Feb 2, 2021
dbb89fd
Implementation of metadata-based constituent interface to host models.
Feb 3, 2021
57c1b6a
Fixes for python 2 compatibility
Mar 17, 2021
4506718
Merge pull request #355 from gold2718/capgen
Mar 18, 2021
88c5616
python 2 support fix
Apr 4, 2021
363097a
Unit attribute cannot be empty
climbfuji May 20, 2021
fe0ba12
Add doc test for missing units attribute
climbfuji May 20, 2021
7660e1b
Remove @grantfirl and @llpcarson from CODEOWNERS for feature/capgen b…
climbfuji May 20, 2021
f3bcd08
Merge pull request #374 from gold2718/capgen
May 21, 2021
3d5e8b9
Merge branch 'feature/capgen' of https://github.com/ncar/ccpp-framewo…
climbfuji May 21, 2021
da8a725
Merge pull request #375 from climbfuji/do_not_allow_empty_units
climbfuji May 21, 2021
572ef3e
Changed ddt_type metadata keyword to just type.
Jul 14, 2021
ab99876
Fix typo in method doc string
Jul 30, 2021
da063f9
Merge pull request #383 from gold2718/capgen
Jul 30, 2021
010e47d
Merge branch 'feature/capgen' of https://github.com/NCAR/ccpp-framewo…
climbfuji Aug 12, 2021
0e1230e
Clean up, revert unintended changes
climbfuji Aug 12, 2021
7c8b9cc
More cleanup, move workarounds from capgen scripts to ccpp_prebuild s…
climbfuji Aug 12, 2021
24e6f72
Update .github/workflows/python.yaml and tests/test_metadata_parser.p…
climbfuji Aug 12, 2021
6d9ca4a
Fix parsing of dependencies
Aug 18, 2021
eb4f5be
Merge pull request #395 from gold2718/capgen
climbfuji Aug 18, 2021
e91b2a4
Merge branch 'feature/capgen' of https://github.com/NCAR/ccpp-framewo…
climbfuji Aug 18, 2021
53aa9dc
Update of scripts/metadata_table.py and scripts/parse_tools/parse_che…
climbfuji Aug 18, 2021
a307587
Remove another legacy block of code in scripts/metavar.py
climbfuji Aug 18, 2021
13ec708
Update example metadata table in documentation in scripts/metadata_ta…
climbfuji Aug 18, 2021
eebebe6
Update true/false logic and add active attribute in scripts/metavar.py
climbfuji Aug 18, 2021
47ec077
Merge pull request #396 from climbfuji/active_attribute_true_false_me…
climbfuji Aug 18, 2021
0e09eef
Merge branch 'feature/capgen' of https://github.com/NCAR/ccpp-framewo…
climbfuji Aug 18, 2021
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
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Summary of Issue:
### Expected behavior and actual behavior:
### Steps to reproduce the problem (should include model description file(s) or link to publi c repository):
### What is the changeset ID of the code, and the machine you are using:
### have you modified the code? If so, it must be committed and available for testing:
### Screen output or log file showing the error message and context:
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[ 50 character, one line summary ]

[ Description of the changes in this commit. It should be enough
information for someone not following this development to understand.
Lines should be wrapped at about 72 characters. ]

User interface changes?: [ No/Yes ]
[ If yes, describe what changed, and steps taken to ensure backward compatibilty ]

Fixes: [Github issue #s] And brief description of each issue.

Testing:
test removed:
unit tests:
system tests:
manual testing:

2 changes: 1 addition & 1 deletion .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ jobs:
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
run: |
export PYTHONPATH=$(pwd)/scripts
export PYTHONPATH=$(pwd)/scripts:$(pwd)/scripts/parse_tools
pytest
28 changes: 28 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
language: python

python:
- "2.7"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When do we get to drop Python 2 support?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use Python 2 anymore. I think this can be upgraded safely to Python 3 in a follow-up PR.

- "3.6"
- "3.7"

branches:
only:
- feature/capgen

install:
- pip install pylint

script:
- env PYTHONPATH=scripts:${PYTHONPATH} pylint --rcfile ./test/.pylintrc ./test/unit_tests/test_metadata_table.py
- env PYTHONPATH=scripts:${PYTHONPATH} pylint --rcfile ./test/.pylintrc ./test/unit_tests/test_metadata_scheme_file.py
- python test/unit_tests/test_metadata_table.py
- python test/unit_tests/test_metadata_scheme_file.py

notifications:
email:
recipients:
# - [email protected]
- [email protected]
# - [email protected]
on_success: always # default: change
on_failure: always # default: always
1 change: 1 addition & 0 deletions doc/HelloWorld/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
189 changes: 189 additions & 0 deletions doc/HelloWorld/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(HelloWorld)
ENABLE_LANGUAGE(Fortran)

include(CMakeForceCompiler)

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)

#-----------------------------------------------------------------------------
#
# Create list of SCHEME_FILES, HOST_FILES, and SUITE_FILES
# Paths should be relative to CMAKE_SOURCE_DIR (this file's directory)
#
#-----------------------------------------------------------------------------
SET(SCHEME_FILES "hello_scheme_files.txt")
FILE(STRINGS ${SCHEME_FILES} SCHEME_FILENAMES)
LIST(APPEND HOST_FILES "hello_world_mod")
LIST(APPEND SUITE_FILES "hello_world_suite.xml")
# HOST is the name of the executable we will build.
SET(HOST "${CMAKE_PROJECT_NAME}")
# HOST_PROGRAM is the name of the program source files (Fortran and metadata)
SET(HOST_PROGRAM "hello_world_host")

#-----------------------------------------------------------------------------
#
# Set where the CCPP Framework lives
#
#-----------------------------------------------------------------------------
get_filename_component(HELLO_ROOT "${CMAKE_SOURCE_DIR}" DIRECTORY)
get_filename_component(CCPP_ROOT "${HELLO_ROOT}" DIRECTORY)

#-----------------------------------------------------------------------------
##############################################################################
#
# End of project-specific input
#
##############################################################################
#-----------------------------------------------------------------------------

# By default, no verbose output
SET(VERBOSITY 0 CACHE STRING "Verbosity level of output (default: 0)")
# By default, generated caps go in ccpp subdir
SET(CCPP_CAP_FILES "${CMAKE_BINARY_DIR}/ccpp" CACHE
STRING "Location of CCPP-generated cap files")

SET(CCPP_FRAMEWORK ${CCPP_ROOT}/scripts)

# Use rpaths on MacOSX
set(CMAKE_MACOSX_RPATH 1)

#-----------------------------------------------------------------------------
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
#message(STATUS "Setting build type to 'Debug' as none was specified.")
#set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)

# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()

ADD_COMPILE_OPTIONS(-O0)

# CMake 3 version: ADD_EXECUTABLE(${HOST} ${HOST_PROGRAM}.F90)
if (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
# gfortran
# MESSAGE("gfortran being used.")
ADD_COMPILE_OPTIONS(-fcheck=all)
ADD_COMPILE_OPTIONS(-fbacktrace)
ADD_COMPILE_OPTIONS(-ffpe-trap=zero)
ADD_COMPILE_OPTIONS(-finit-real=nan)
ADD_COMPILE_OPTIONS(-ggdb)
ADD_COMPILE_OPTIONS(-ffree-line-length-none)
ADD_COMPILE_OPTIONS(-cpp)
elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
# ifort
# MESSAGE("ifort being used.")
#ADD_COMPILE_OPTIONS(-check all)
ADD_COMPILE_OPTIONS(-fpe0)
ADD_COMPILE_OPTIONS(-warn)
ADD_COMPILE_OPTIONS(-traceback)
ADD_COMPILE_OPTIONS(-debug extended)
ADD_COMPILE_OPTIONS(-fpp)
elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "PGI")
# pgf90
# MESSAGE("pgf90 being used.")
ADD_COMPILE_OPTIONS(-g)
ADD_COMPILE_OPTIONS(-Mipa=noconst)
ADD_COMPILE_OPTIONS(-traceback)
ADD_COMPILE_OPTIONS(-Mfree)
ADD_COMPILE_OPTIONS(-Mfptrap)
ADD_COMPILE_OPTIONS(-Mpreprocess)
else (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
message (FATAL_ERROR "This program has only been compiled with gfortran, pgf90 and ifort. If another compiler is needed, the appropriate flags must be added in ${CMAKE_SOURCE_DIR}/CMakeLists.txt")
endif (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")

#-----------------------------------------------------------------------------
# CMake Modules
# Set the CMake module path
list(APPEND CMAKE_MODULE_PATH "${CCPP_FRAMEWORK}/cmake")
#-----------------------------------------------------------------------------
# Set OpenMP flags for C/C++/Fortran
if (OPENMP)
include(detect_openmp)
detect_openmp()
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS}")
message(STATUS "Enable OpenMP support for C/C++/Fortran compiler")
else(OPENMP)
message (STATUS "Disable OpenMP support for C/C++/Fortran compiler")
endif()

# Create metadata and source file lists
FOREACH(FILE ${SCHEME_FILENAMES})
# add absolute pathnames to library list
string(REPLACE ".meta" ".F90" TEMP "${FILE}")
get_filename_component(ABS_PATH "${TEMP}" ABSOLUTE)
list(APPEND LIBRARY_LIST ${ABS_PATH})
# CMake 3 version: target_sources(${HOST} PUBLIC ${ABS_PATH})
ENDFOREACH(FILE)

FOREACH(FILE ${HOST_FILES})
LIST(APPEND HOST_METADATA "${FILE}.meta")
# add absolute pathnames to library list
get_filename_component(ABS_PATH "${FILE}.F90" ABSOLUTE)
LIST(APPEND HOST_SOURCE "${ABS_PATH}")
ENDFOREACH(FILE)
list(APPEND LIBRARY_LIST ${HOST_SOURCE})
# CMake 3 version: target_sources(${HOST} PUBLIC ${HOST_SOURCE})
string(REPLACE ";" ".meta," HOST_METADATA "${HOST_FILES}")
set(HOST_METADATA "${HOST_PROGRAM}.meta,${HOST_METADATA}.meta")

# Run ccpp_capgen
set(CAPGEN_CMD "${CCPP_FRAMEWORK}/ccpp_capgen.py")
list(APPEND CAPGEN_CMD "--host-files")
list(APPEND CAPGEN_CMD "${HOST_METADATA}")
list(APPEND CAPGEN_CMD "--scheme-files")
list(APPEND CAPGEN_CMD "${SCHEME_FILES}")
list(APPEND CAPGEN_CMD "--suites")
list(APPEND CAPGEN_CMD "${SUITE_FILES}")
list(APPEND CAPGEN_CMD "--output-root")
list(APPEND CAPGEN_CMD "${CCPP_CAP_FILES}")
list(APPEND CAPGEN_CMD "--host-name")
list(APPEND CAPGEN_CMD "${HOST}")
while (VERBOSITY GREATER 0)
list(APPEND CAPGEN_CMD "--verbose")
MATH(EXPR VERBOSITY "${VERBOSITY} - 1")
endwhile ()
string(REPLACE ";" " " CAPGEN_STRING "${CAPGEN_CMD}")
MESSAGE(STATUS "Running: ${CAPGEN_STRING}")
EXECUTE_PROCESS(COMMAND ${CAPGEN_CMD} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE CAPGEN_OUT ERROR_VARIABLE CAPGEN_OUT RESULT_VARIABLE RES)
MESSAGE(STATUS "${CAPGEN_OUT}")
if (RES EQUAL 0)
MESSAGE(STATUS "CCPP cap generation completed")
else(RES EQUAL 0)
MESSAGE(FATAL_ERROR "CCPP cap generation FAILED: result = ${RES}")
endif(RES EQUAL 0)

# Retrieve the list of files from datatable.xml and set to CCPP_CAPS
set(DTABLE_CMD "${CCPP_FRAMEWORK}/ccpp_datafile.py")
list(APPEND DTABLE_CMD "${CCPP_CAP_FILES}/datatable.xml")
list(APPEND DTABLE_CMD "--ccpp-files")
list(APPEND DTABLE_CMD "--separator=\\;")
string(REPLACE ";" " " DTABLE_STRING "${DTABLE_CMD}")
MESSAGE(STATUS "Running: ${DTABLE_STRING}")
EXECUTE_PROCESS(COMMAND ${DTABLE_CMD} OUTPUT_VARIABLE CCPP_CAPS
RESULT_VARIABLE RES
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE)
if (RES EQUAL 0)
MESSAGE(STATUS "CCPP cap files retrieved")
else(RES EQUAL 0)
MESSAGE(FATAL_ERROR "CCPP cap file retrieval FAILED: result = ${RES}")
endif(RES EQUAL 0)
FOREACH(FILE ${CCPP_CAPS})
list(APPEND LIBRARY_LIST ${FILE})
ENDFOREACH(FILE)
# CMake 3 version: target_sources(${HOST} PUBLIC ${CCPP_CAPS})
add_library(HELLOLIB OBJECT ${LIBRARY_LIST})
ADD_EXECUTABLE(${HOST} ${HOST_PROGRAM}.F90 $<TARGET_OBJECTS:HELLOLIB>)

INCLUDE_DIRECTORIES(${CCPP_CAP_FILES})

set_target_properties(${HOST} PROPERTIES
COMPILE_FLAGS "${CMAKE_Fortran_FLAGS}"
LINK_FLAGS "${CMAKE_Fortran_FLAGS}")
87 changes: 87 additions & 0 deletions doc/HelloWorld/Makefile.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#
# Makefile for HelloWorld example
#

FC = gfortran

# My dirs
BLDDIR := $(shell pwd -P)
MKFILE_PATH := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
ROOT = $(shell dirname $(shell dirname $(MKFILE_PATH)))
CAPGEN := $(ROOT)/scripts/ccpp_capgen.py
CAPGEN_ARGS := --host-files $(MKFILE_PATH)/hello_world_host.meta,$(MKFILE_PATH)/hello_world_mod.meta
CAPGEN_ARGS += --scheme-files $(MKFILE_PATH)/hello_scheme.meta,$(MKFILE_PATH)/temp_adjust.meta
CAPGEN_ARGS += --suites $(MKFILE_PATH)/hello_world_suite.xml
CAPGEN_ARGS += --generate-host-cap --host-name HelloWorld
#CAPGEN_ARGS += --verbose --verbose
SRCS_META := $(MKFILE_PATH)/hello_world_host.meta
SRCS_META += $(MKFILE_PATH)/hello_world_mod.meta
SRCS_META += $(MKFILE_PATH)/hello_scheme.meta
SRCS_META += $(MKFILE_PATH)/temp_adjust.meta
SRCS_XML := $(MKFILE_PATH)/hello_world_suite.xml

INCFLAG = -I
INCPATH += $(INCFLAG)$(BLDDIR) $(INCFLAG)$(MKFILE_PATH)
FCFLAGS += -g

# SOURCE FILES
SRCS_F90 = $(MKFILE_PATH)/hello_scheme.F90 $(MKFILE_PATH)/hello_world_host.F90
SRCS_F90 += $(MKFILE_PATH)/hello_world_mod.F90
SRCS_F90 += $(MKFILE_PATH)/temp_adjust.F90
OBJS_F90 = hello_scheme.o temp_adjust.o hello_world_mod.o hello_world_host.o

# Do we have generated CAP files?
$(eval CAPOBJS=$(shell if [ -f caplocal.txt ]; then cat caplocal.txt; fi))

.PHONY: all
all: HelloWorld

# Generate CCPP cap files
capfiles.txt: $(SRCS_META) $(SRCS_XML)
$(CAPGEN) $(CAPGEN_ARGS)

.PHONY: capobjs
capobjs: capfiles.txt
$(shell $(MKFILE_PATH)/mkcaplocal.sh $(BLDDIR)/capfiles.txt)
$(eval CAPOBJS=$(shell cat caplocal.txt))

# Human written
HelloWorld: capobjs $(CAPOBJS) $(OBJS_F90)
$(FC) $(FCFLAGS) -o $@ $(CAPOBJS) $(OBJS_F90)

hello_scheme.o: ccpp_kinds.o $(MKFILE_PATH)/hello_scheme.F90
$(FC) -c $(INCPATH) $(FCFLAGS) $(MKFILE_PATH)/hello_scheme.F90

temp_adjust.o: ccpp_kinds.o $(MKFILE_PATH)/temp_adjust.F90
$(FC) -c $(INCPATH) $(FCFLAGS) $(MKFILE_PATH)/temp_adjust.F90

hello_world_mod.o: ccpp_kinds.o $(MKFILE_PATH)/hello_world_mod.F90
$(FC) -c $(INCPATH) $(FCFLAGS) $(MKFILE_PATH)/hello_world_mod.F90

hello_world_host.o: HelloWorld_ccpp_cap.o ccpp_kinds.o
hello_world_host.o: $(MKFILE_PATH)/hello_world_host.F90
$(FC) -c $(INCPATH) $(FCFLAGS) $(MKFILE_PATH)/hello_world_host.F90

# CCPP generated
ccpp_kinds.F90: capobjs

HelloWorld_ccpp_cap.F90: capobjs

ccpp_hello_world_suite_cap.F90: capobjs

ccpp_kinds.o: ccpp_kinds.F90
$(FC) -c $(INCPATH) $(FCFLAGS) ccpp_kinds.F90

HelloWorld_ccpp_cap.o: ccpp_kinds.o
HelloWorld_ccpp_cap.o: hello_world_mod.o ccpp_hello_world_suite_cap.o
HelloWorld_ccpp_cap.o: HelloWorld_ccpp_cap.F90
$(FC) -c $(INCPATH) $(FCFLAGS) HelloWorld_ccpp_cap.F90

ccpp_hello_world_suite_cap.o: ccpp_kinds.o ccpp_hello_world_suite_cap.F90
$(FC) -c $(INCPATH) $(FCFLAGS) ccpp_hello_world_suite_cap.F90

.PHONY: clean
clean:
rm -f $(shell if [ -f capfiles.txt ]; then cat capfiles.txt; fi)
rm -f *.o *.mod HelloWorld capfiles.txt caplocal.txt
rm -rf HelloWorld.dSYM
Loading