From 12dbe0f129cdbbb15e2704bfa392ddd88a4bd4d5 Mon Sep 17 00:00:00 2001 From: Anthony Islas Date: Wed, 28 Jun 2023 17:32:34 -0600 Subject: [PATCH] ungrib build --- ungrib/CMakeLists.txt | 96 ++++++++++++++++++++++++++++++++++++++++ ungrib/src/CMakeLists.txt | 64 +++++++++++++++++++++++++++ ungrib/src/ngl/CMakeLists.txt | 2 + ungrib/src/ngl/g2/CMakeLists.txt | 91 +++++++++++++++++++++++++++++++++++++ ungrib/src/ngl/w3/CMakeLists.txt | 92 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 345 insertions(+) create mode 100644 ungrib/CMakeLists.txt create mode 100644 ungrib/src/CMakeLists.txt create mode 100644 ungrib/src/ngl/CMakeLists.txt create mode 100644 ungrib/src/ngl/g2/CMakeLists.txt create mode 100644 ungrib/src/ngl/w3/CMakeLists.txt diff --git a/ungrib/CMakeLists.txt b/ungrib/CMakeLists.txt new file mode 100644 index 0000000..e6711e2 --- /dev/null +++ b/ungrib/CMakeLists.txt @@ -0,0 +1,96 @@ +add_executable( ungrib ) +add_executable( g1print ) +add_executable( g2print ) +add_library ( pgu ) + +add_subdirectory( src ) + +set_target_properties( + pgu + PROPERTIES + # Just dump everything in here + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/ungrib/ + Fortran_FORMAT FREE + ) + +set_target_properties( + ungrib + PROPERTIES + # Just dump everything in here + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/ungrib/ + Fortran_FORMAT FREE + ) + +set_target_properties( + g1print + PROPERTIES + # Just dump everything in here + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/ungrib/ + Fortran_FORMAT FREE + ) + +set_target_properties( + g2print + PROPERTIES + # Just dump everything in here + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/ungrib/ + Fortran_FORMAT FREE + ) + +# Control dependencies and linking +target_link_libraries( + ungrib + PRIVATE + w3 + g2 + pgu + Jasper::Jasper + PNG::PNG + ZLIB::ZLIB + ) + +target_link_libraries( + g1print + PRIVATE + pgu + ) + +target_link_libraries( + g2print + PRIVATE + w3 + g2 + Jasper::Jasper + PNG::PNG + ZLIB::ZLIB + pgu + ) + + +target_include_directories( + ungrib + PRIVATE + $ + $ + ) + + +target_include_directories( + g2print + PRIVATE + $ + $ + ) +# $<$:$> +# $<$:$> +# ${netCDF_INCLUDE_DIRS} + + +# Add these to the export targets +install( + TARGETS ungrib g1print g2print pgu + EXPORT ${EXPORT_NAME}Targets + RUNTIME DESTINATION bin/ + ARCHIVE DESTINATION lib/ + LIBRARY DESTINATION lib/ + ) diff --git a/ungrib/src/CMakeLists.txt b/ungrib/src/CMakeLists.txt new file mode 100644 index 0000000..6333bd8 --- /dev/null +++ b/ungrib/src/CMakeLists.txt @@ -0,0 +1,64 @@ +add_subdirectory( ngl ) + + +# Special cases, maybe one day these will get fixed +set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/rd_grib2.F + TARGET_DIRECTORY ungrib + PROPERTIES + Fortran_FORMAT FIXED + ) + +target_sources( + pgu + PRIVATE + build_hdate.F + geth_newdate.F + geth_idts.F + swap.F + table.F + module_stringutil.F + parse_table.F + gbytesys.F + gribcode.F + read_namelist.F + cio.c + module_debug.F + misc_definitions_module.F + ) + +target_sources( + ungrib + PRIVATE + debug_cio.c + module_stringutil.F + table.F + module_datarray.F + gridinfo.F + new_storage.F + filelist.F + ungrib.F + output.F + rrpr.F + rd_grib1.F + file_delete.F + datint.F + rd_grib2.F + ) + +target_sources( + g1print + PRIVATE + g1print.F + gribcode.F + module_debug.F + debug_cio.c + ) + +target_sources( + g2print + PRIVATE + filelist.F + gridinfo.F + g2print.F + ) diff --git a/ungrib/src/ngl/CMakeLists.txt b/ungrib/src/ngl/CMakeLists.txt new file mode 100644 index 0000000..de91c34 --- /dev/null +++ b/ungrib/src/ngl/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory( w3 ) +add_subdirectory( g2 ) \ No newline at end of file diff --git a/ungrib/src/ngl/g2/CMakeLists.txt b/ungrib/src/ngl/g2/CMakeLists.txt new file mode 100644 index 0000000..3dc642e --- /dev/null +++ b/ungrib/src/ngl/g2/CMakeLists.txt @@ -0,0 +1,91 @@ +get_filename_component( FOLDER_COMPILE_TARGET ${CMAKE_CURRENT_SOURCE_DIR} NAME ) + +add_library( ${FOLDER_COMPILE_TARGET} STATIC ) + +set_target_properties( + ${FOLDER_COMPILE_TARGET} + PROPERTIES + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${FOLDER_COMPILE_TARGET} + # Fortran_FORMAT FREE + ) + +target_compile_definitions( + ${FOLDER_COMPILE_TARGET} + PRIVATE + __64BIT__ + ) +# target_link_libraries( ${FOLDER_COMPILE_TARGET} +# PRIVATE +# ${netCDF_LIBRARIES} +# $<$:$> +# $<$:$> +# $ +# ) + +target_sources( + ${FOLDER_COMPILE_TARGET} + PRIVATE + gridtemplates.f + pdstemplates.f + drstemplates.f + gribmod.f + realloc.f + intmath.f + addfield.F + addgrid.f + addlocal.f + getfield.f + gb_info.f + gf_getfld.f + gf_free.f + gf_unpack1.f + gf_unpack2.f + gf_unpack3.f + gf_unpack4.f + gf_unpack5.f + gf_unpack6.f + gf_unpack7.F + gettemplates.f + getlocal.f + getdim.f + getpoly.f + gribcreate.f + gribend.f + gribinfo.f + mkieee.f + rdieee.f + simunpack.f + reduce.f + comunpack.f + specunpack.f + jpcunpack.F + dec_jpeg2000.c + pngunpack.F + dec_png.c + gbytesc.f + skgb.f + ixgb2.f + getidx.f + getg2i.f + getg2ir.f + getgb2s.f + getgb2r.f + getgb2l.f + getgb2.f + getgb2p.f + getgb2rp.f + putgb2.f + g2grids.f + gdt2gds.f + params.f + params_ecmwf.f + mova2i.c + ) + +install( + TARGETS ${FOLDER_COMPILE_TARGET} + EXPORT ${EXPORT_NAME}Targets + RUNTIME DESTINATION bin/ + ARCHIVE DESTINATION lib/ + LIBRARY DESTINATION lib/ + ) diff --git a/ungrib/src/ngl/w3/CMakeLists.txt b/ungrib/src/ngl/w3/CMakeLists.txt new file mode 100644 index 0000000..f5c8b18 --- /dev/null +++ b/ungrib/src/ngl/w3/CMakeLists.txt @@ -0,0 +1,92 @@ +get_filename_component( FOLDER_COMPILE_TARGET ${CMAKE_CURRENT_SOURCE_DIR} NAME ) + +add_library( ${FOLDER_COMPILE_TARGET} STATIC ) + +set_target_properties( + ${FOLDER_COMPILE_TARGET} + PROPERTIES + Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${FOLDER_COMPILE_TARGET} + # Fortran_FORMAT FREE + ) +target_sources( + ${FOLDER_COMPILE_TARGET} + PRIVATE + getgb.f + getgbmh.f + putgbex.f + w3fi73.f + getgb1r.f + getgbmp.f + putgbn.f + w3fi74.f + getgb1re.f + getgbp.f + r63w72.f + w3fi75.f + getgb1s.f + getgi.f + sbyte.f + w3fi76.f + getgbe.f + getgir.f + sbytes.f + w3fi82.f + getgbeh.f + idsdef.f + w3fi83.f + getgbem.f + iw3jdn.f + w3difdat.f + w3fs26.f + getgbemh.f + ixgb.f + w3doxdat.f + w3log.f + getgbemp.f + lengds.f + w3fi01.f + w3movdat.f + getgbens.f + pdsens.f + w3fi58.f + w3reddat.f + getgbep.f + pdseup.f + w3fi59.f + w3tagb.f + errmsg.f + getgbex.f + putgb.f + w3fi63.f + gbytes.f + getgbexm.f + putgbe.f + w3fi68.f + gbytes_char.f + getgbh.f + putgben.f + getbit.f + getgbm.f + putgbens.f + w3fi72.f + fparsei.f + fparser.f + instrument.f + start.f + summary.f + w3utcdat.f + w3fs21.f + w3locdat.f + w3fi71.f + baciof.f + bacio.v1.3.c + errexit.c + ) + +install( + TARGETS ${FOLDER_COMPILE_TARGET} + EXPORT ${EXPORT_NAME}Targets + RUNTIME DESTINATION bin/ + ARCHIVE DESTINATION lib/ + LIBRARY DESTINATION lib/ + ) -- 2.11.4.GIT