Skip to content

Commit

Permalink
Feature/update targets (#20)
Browse files Browse the repository at this point in the history
* Merge release/public-v1 into develop

* Update CMake to use new targets
  • Loading branch information
kgerheiser authored Jun 18, 2020
1 parent 00c8f86 commit e7c39a8
Show file tree
Hide file tree
Showing 630 changed files with 252 additions and 101,808 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
build/
install/

*.[ao]
*.mod
*.so
*.swp
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

81 changes: 21 additions & 60 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,75 +1,36 @@
cmake_minimum_required(VERSION 3.15)
project(grib_util VERSION 1.1.1)
set(${PROJECT_NAME}_VERSION ${PROJECT_VERSION} CACHE INTERNAL "${PROJECT_NAME} version number")
enable_language (Fortran)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG true)
file(STRINGS "VERSION" pVersion)

if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE RELEASE CACHE STRING
"Choose the type of build, options are: PRODUCTION Debug Release."
FORCE)
endif()
project(grib_util VERSION ${pVersion} LANGUAGES C Fortran)

if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(IntelComp true )
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU*" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang*")
set(GNUComp true )
elseif(CMAKE_CXX_COMPILER_ID MATCHES "pgc*")
set(PGIComp true )
endif()
option(OPENMP "use OpenMP threading" OFF)

STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RelWithDebInfo" BUILD_RELEASE)
if(NOT BUILD_RELEASE )
STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE)
if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$")
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_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()
STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION)
STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "DEBUG" BUILD_DEBUG)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Intel|GNU|Clang|AppleClang)$")
message(WARNING "Compiler not officially supported: ${CMAKE_C_COMPILER_ID}")
endif()
if(POLICY CMP0012)
cmake_policy(SET CMP0012 NEW)

if(OPENMP)
find_package(OpenMP REQUIRED COMPONENTS Fortran)
endif()

find_package(OpenMP)
find_package(LAPACK)
find_package(Jasper REQUIRED)
find_package(PNG REQUIRED)
find_package(ZLIB REQUIRED)

#Prefer config files, and if not available use the regular FindXXX file
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG true)
if(NOT TARGET w3nco_4)
find_package(W3NCO REQUIRED)
endif()

if(NOT TARGET g2_4)
find_package(G2 REQUIRED)
endif()

if(NOT TARGET bacio_4)
find_package(BACIO REQUIRED)
endif()

if(NOT TARGET ip_4)
find_package(IP REQUIRED)
endif()

if (NOT TARGET sp_4)
find_package(SP REQUIRED)
endif()
find_package(w3nco CONFIG REQUIRED)
find_package(g2 CONFIG REQUIRED)
find_package(bacio CONFIG REQUIRED)
find_package(ip CONFIG REQUIRED)
find_package(sp CONFIG REQUIRED)

add_subdirectory(sorc/cnvgrib.fd)
add_subdirectory(sorc/copygb.fd)
add_subdirectory(sorc/copygb2.fd)
add_subdirectory(sorc/grb2index.fd)
add_subdirectory(sorc/degrib2.fd)
add_subdirectory(sorc/grib2grib.fd)
add_subdirectory(sorc/grbindex.fd)
add_subdirectory(sorc/tocgrib.fd)
add_subdirectory(sorc/tocgrib2.fd)
add_subdirectory(sorc/tocgrib2super.fd)
add_subdirectory(sorc/wgrib.cd)
add_subdirectory(sorc)
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# NCEP Grib related utilities

A collection of NCEP grib related utilities

Code Manager : Boi Vuong

### Prerequisites

Compilers: GNU | Intel | Clang | AppleClang | PGI


### Installing

```
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/path/to/install /path/to/NCEPLIBS-grib_util
make -j4
make install
```


### Version
1.2.0


### Authors

* **[NCEP/EMC](mailto:NCEP.List.EMC.nceplibs.Developers@noaa.gov)**
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.2.0
1 change: 0 additions & 1 deletion cmake
Submodule cmake deleted from 7f5b1b
11 changes: 11 additions & 0 deletions sorc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
add_subdirectory(cnvgrib.fd)
add_subdirectory(copygb.fd)
add_subdirectory(copygb2.fd)
add_subdirectory(grb2index.fd)
add_subdirectory(degrib2.fd)
add_subdirectory(grib2grib.fd)
add_subdirectory(grbindex.fd)
add_subdirectory(tocgrib.fd)
add_subdirectory(tocgrib2.fd)
add_subdirectory(tocgrib2super.fd)
add_subdirectory(wgrib.cd)
Binary file removed sorc/cnvgrib.fd/.CHANGES.swp
Binary file not shown.
63 changes: 29 additions & 34 deletions sorc/cnvgrib.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,33 @@

if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) )
if(IntelComp)
set(fortran_flags "-O3" "-g")
elseif(GNUComp)
set(fortran_flags "-O3" "-g")
else()
message("unknown compiler!")
exit()
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
set(CMAKE_Fortran_FLAGS "-g")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
set(CMAKE_Fortran_FLAGS "-g")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3")
endif()

set(exe_name cnvgrib)

file(GLOB fortran_src
${CMAKE_CURRENT_SOURCE_DIR}/*.f
${CMAKE_CURRENT_SOURCE_DIR}/*.f90
${CMAKE_CURRENT_SOURCE_DIR}/*.F)
set(fortran_src
cnv12.f
cnv22.f
gds2gdt.f
makepdsens.f
pds2pdtens.f
putgbexn.f
cnv21.f
cnvgrib.f
gdt2gds.f
makepds.f
pds2pdt.f
setbit.f)

set(exe_name cnvgrib)
add_executable(${exe_name} ${fortran_src})

target_compile_options(${exe_name} PRIVATE ${fortran_flags})

set(module_dir "${CMAKE_CURRENT_BINARY_DIR}/include_8")
set_target_properties(${exe_name} PROPERTIES
Fortran_MODULE_DIRECTORY "${module_dir}")

target_include_directories(${exe_name} PUBLIC ${module_dir})

target_link_libraries(${exe_name} g2_4 bacio_4 w3nco_4
${JASPER_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARY})

install(TARGETS ${exe_name}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(DIRECTORY ${module_dir} DESTINATION include_8)

target_link_libraries(${exe_name} PRIVATE
g2::g2_4
bacio::bacio_4
w3nco::w3nco_4
${JASPER_LIBRARIES}
PNG::PNG
${ZLIB_LIBRARY})

install(TARGETS ${exe_name} RUNTIME DESTINATION bin)
16 changes: 0 additions & 16 deletions sorc/cnvgrib.fd/compile_cnvgrib_theia.sh

This file was deleted.

37 changes: 0 additions & 37 deletions sorc/cnvgrib.fd/compile_cnvgrib_wcoss.log

This file was deleted.

31 changes: 0 additions & 31 deletions sorc/cnvgrib.fd/compile_cnvgrib_wcoss.sh

This file was deleted.

55 changes: 0 additions & 55 deletions sorc/cnvgrib.fd/makefile

This file was deleted.

Loading

0 comments on commit e7c39a8

Please sign in to comment.