Skip to content

Commit

Permalink
Merge pull request #19 from NOAA-EMC/feature/cleanup
Browse files Browse the repository at this point in the history
cleanup produtil cmake
  • Loading branch information
kgerheiser committed Aug 18, 2020
2 parents b6c35a0 + 627ff12 commit 8abf865
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 94 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
build/
install/

*.[aox]
*.mod
*.so
.DS_Store

*.swp
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

55 changes: 21 additions & 34 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,44 +1,31 @@
cmake_minimum_required(VERSION 3.15)
project(prod_util VERSION 1.1.1)
set(${PROJECT_NAME}_VERSION ${PROJECT_VERSION} CACHE INTERNAL "${PROJECT_NAME} version number")

enable_language (Fortran)
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE RELEASE CACHE STRING
"Choose the type of build, options are: PRODUCTION Debug Release."
FORCE)
endif()

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()
file(STRINGS "VERSION" pVersion)

STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RelWithDebInfo" BUILD_RELEASE)
if(NOT BUILD_RELEASE )
STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE)
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/")
project(
produtil
VERSION ${pVersion}
LANGUAGES C Fortran)

if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
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()
if(POLICY CMP0012)
cmake_policy(SET CMP0012 NEW)

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

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG true)
if (NOT TARGET w3nco_4)
find_package(w3nco_4 REQUIRED)
if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU)$")
message(WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}")
endif()

add_subdirectory(sorc/fsync_file.cd)
add_subdirectory(sorc/mdate.fd)
add_subdirectory(sorc/ndate.fd)
add_subdirectory(sorc/nhour.fd)
include(GNUInstallDirs)

find_package(w3nco REQUIRED)

add_subdirectory(sorc)
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.1.1
1 change: 0 additions & 1 deletion cmake
Submodule cmake deleted from 7f5b1b
4 changes: 4 additions & 0 deletions sorc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
add_subdirectory(fsync_file.cd)
add_subdirectory(mdate.fd)
add_subdirectory(ndate.fd)
add_subdirectory(nhour.fd)
7 changes: 2 additions & 5 deletions sorc/fsync_file.cd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
file(GLOB EXE_C_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
file(EXE_C_SRC fsync_file.c)

set(EXENAME fsync_file)
add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC})

install(TARGETS ${EXENAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)

RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
Empty file modified sorc/fsync_file.cd/fsync_file.c
100755 → 100644
Empty file.
3 changes: 0 additions & 3 deletions sorc/fsync_file.cd/makefile

This file was deleted.

14 changes: 3 additions & 11 deletions sorc/mdate.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
set(EXENAME mdate)

file(GLOB EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.f
${CMAKE_CURRENT_SOURCE_DIR}/*.f90
${CMAKE_CURRENT_SOURCE_DIR}/*.F)

add_executable(${EXENAME} ${EXE_SRC} )
target_link_libraries(${EXENAME} w3nco_4)
add_executable(${EXENAME} mdate.f)
target_link_libraries(${EXENAME} w3nco::w3nco_4)

install(TARGETS ${EXENAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)

RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
5 changes: 0 additions & 5 deletions sorc/mdate.fd/makefile

This file was deleted.

Empty file modified sorc/mdate.fd/mdate.f
100755 → 100644
Empty file.
15 changes: 3 additions & 12 deletions sorc/ndate.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@

file(GLOB EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.f
${CMAKE_CURRENT_SOURCE_DIR}/*.f90
${CMAKE_CURRENT_SOURCE_DIR}/*.F)

set(EXENAME ndate)

add_executable(${EXENAME} ${EXE_SRC})
target_link_libraries(${EXENAME} w3nco_4)
add_executable(${EXENAME} ndate.f)
target_link_libraries(${EXENAME} w3nco::w3nco_4)

install(TARGETS ${EXENAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)

RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
4 changes: 0 additions & 4 deletions sorc/ndate.fd/makefile

This file was deleted.

Empty file modified sorc/ndate.fd/ndate.f
100755 → 100644
Empty file.
15 changes: 3 additions & 12 deletions sorc/nhour.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@

file(GLOB EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.f
${CMAKE_CURRENT_SOURCE_DIR}/*.f90
${CMAKE_CURRENT_SOURCE_DIR}/*.F)

set(EXENAME nhour)

add_executable(${EXENAME} ${EXE_SRC})
target_link_libraries(${EXENAME} w3nco_4)
add_executable(${EXENAME} nhour.f)
target_link_libraries(${EXENAME} w3nco::w3nco_4)

install(TARGETS ${EXENAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)

RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
3 changes: 0 additions & 3 deletions sorc/nhour.fd/makefile

This file was deleted.

Empty file modified sorc/nhour.fd/nhour.f
100755 → 100644
Empty file.

0 comments on commit 8abf865

Please sign in to comment.