forked from geoschem/geos-chem
-
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
Liam Bindle
committed
Jan 8, 2019
1 parent
2957ef5
commit b086090
Showing
17 changed files
with
920 additions
and
920 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
cmake_minimum_required(VERSION 3.0.2) | ||
project(GEOS_Chem VERSION 12.0.0 LANGUAGES Fortran) | ||
|
||
# Add our module path and include our helpers | ||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeScripts) | ||
include(GC-Helpers) | ||
|
||
# Define the base target (which will store the build configuration properties) | ||
add_library(BaseTarget INTERFACE) | ||
|
||
# Put all mod files in mod subdirectory | ||
set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/mod) | ||
target_include_directories(BaseTarget | ||
INTERFACE ${PROJECT_BINARY_DIR}/mod | ||
) | ||
|
||
# Get the run directory and implementation type | ||
include(GC-GetRunDir) # sets RUNDIR and IMPL | ||
|
||
if("${IMPL}" STREQUAL "Classic") | ||
include(GC-ConfigureClassicBuild) | ||
elseif("${IMPL}" STREQUAL "GCHP") | ||
add_subdirectory(GCHP) | ||
endif() | ||
|
||
# Add subdirectories | ||
add_subdirectory(KPP) | ||
add_subdirectory(Headers) | ||
add_subdirectory(GeosUtil) | ||
add_subdirectory(NcdfUtil) | ||
add_subdirectory(History) | ||
add_subdirectory(HEMCO) | ||
add_subdirectory(ISOROPIA) | ||
add_subdirectory(GeosRad) | ||
add_subdirectory(GeosCore) | ||
|
||
cmake_minimum_required(VERSION 3.0.2) | ||
project(GEOS_Chem VERSION 12.0.0 LANGUAGES Fortran) | ||
|
||
# Add our module path and include our helpers | ||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeScripts) | ||
include(GC-Helpers) | ||
|
||
# Define the base target (which will store the build configuration properties) | ||
add_library(BaseTarget INTERFACE) | ||
|
||
# Put all mod files in mod subdirectory | ||
set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/mod) | ||
target_include_directories(BaseTarget | ||
INTERFACE ${PROJECT_BINARY_DIR}/mod | ||
) | ||
|
||
# Get the run directory and implementation type | ||
include(GC-GetRunDir) # sets RUNDIR and IMPL | ||
|
||
if("${IMPL}" STREQUAL "Classic") | ||
include(GC-ConfigureClassicBuild) | ||
elseif("${IMPL}" STREQUAL "GCHP") | ||
add_subdirectory(GCHP) | ||
endif() | ||
|
||
# Add subdirectories | ||
add_subdirectory(KPP) | ||
add_subdirectory(Headers) | ||
add_subdirectory(GeosUtil) | ||
add_subdirectory(NcdfUtil) | ||
add_subdirectory(History) | ||
add_subdirectory(HEMCO) | ||
add_subdirectory(ISOROPIA) | ||
add_subdirectory(GeosRad) | ||
add_subdirectory(GeosCore) | ||
|
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 |
---|---|---|
@@ -1,122 +1,122 @@ | ||
# Copied from: https://github.com/Kitware/VTK/blob/master/CMake/FindNetCDF.cmake | ||
# At commit: b103500b50aeb70647e6847bd8bdef72db4d5482 | ||
# | ||
# - Find NetCDF | ||
# Find the native NetCDF includes and library | ||
# | ||
# NETCDF_INCLUDE_DIR - user modifiable choice of where netcdf headers are | ||
# NETCDF_LIBRARY - user modifiable choice of where netcdf libraries are | ||
# | ||
# Your package can require certain interfaces to be FOUND by setting these | ||
# | ||
# NETCDF_CXX - require the C++ interface and link the C++ library | ||
# NETCDF_F77 - require the F77 interface and link the fortran library | ||
# NETCDF_F90 - require the F90 interface and link the fortran library | ||
# | ||
# Or equivalently by calling FindNetCDF with a COMPONENTS argument containing one or | ||
# more of "CXX;F77;F90". | ||
# | ||
# When interfaces are requested the user has access to interface specific hints: | ||
# | ||
# NETCDF_${LANG}_INCLUDE_DIR - where to search for interface header files | ||
# NETCDF_${LANG}_LIBRARY - where to search for interface libraries | ||
# | ||
# This module returns these variables for the rest of the project to use. | ||
# | ||
# NETCDF_FOUND - True if NetCDF found including required interfaces (see below) | ||
# NETCDF_LIBRARIES - All netcdf related libraries. | ||
# NETCDF_INCLUDE_DIRS - All directories to include. | ||
# NETCDF_HAS_INTERFACES - Whether requested interfaces were found or not. | ||
# NETCDF_${LANG}_INCLUDE_DIRS/NETCDF_${LANG}_LIBRARIES - C/C++/F70/F90 only interface | ||
# | ||
# Normal usage would be: | ||
# set (NETCDF_F90 "YES") | ||
# find_package (NetCDF REQUIRED) | ||
# target_link_libraries (uses_everthing ${NETCDF_LIBRARIES}) | ||
# target_link_libraries (only_uses_f90 ${NETCDF_F90_LIBRARIES}) | ||
|
||
#search starting from user editable cache var | ||
if (NETCDF_INCLUDE_DIR AND NETCDF_LIBRARY) | ||
# Already in cache, be silent | ||
set (NETCDF_FIND_QUIETLY TRUE) | ||
endif () | ||
|
||
set(USE_DEFAULT_PATHS "NO_DEFAULT_PATH") | ||
if(NETCDF_USE_DEFAULT_PATHS) | ||
set(USE_DEFAULT_PATHS "") | ||
endif() | ||
|
||
find_path (NETCDF_INCLUDE_DIR netcdf.h | ||
PATHS "${NETCDF_DIR}/include") | ||
mark_as_advanced (NETCDF_INCLUDE_DIR) | ||
set (NETCDF_C_INCLUDE_DIRS ${NETCDF_INCLUDE_DIR}) | ||
|
||
find_library (NETCDF_LIBRARY NAMES netcdf | ||
PATHS "${NETCDF_DIR}/lib" | ||
HINTS "${NETCDF_INCLUDE_DIR}/../lib") | ||
mark_as_advanced (NETCDF_LIBRARY) | ||
|
||
set (NETCDF_C_LIBRARIES ${NETCDF_LIBRARY}) | ||
|
||
#start finding requested language components | ||
set (NetCDF_libs "") | ||
set (NetCDF_includes "${NETCDF_INCLUDE_DIR}") | ||
|
||
get_filename_component (NetCDF_lib_dirs "${NETCDF_LIBRARY}" PATH) | ||
set (NETCDF_HAS_INTERFACES "YES") # will be set to NO if we're missing any interfaces | ||
|
||
macro (NetCDF_check_interface lang header libs) | ||
if (NETCDF_${lang}) | ||
#search starting from user modifiable cache var | ||
find_path (NETCDF_${lang}_INCLUDE_DIR NAMES ${header} | ||
HINTS "${NETCDF_INCLUDE_DIR}" | ||
HINTS "${NETCDF_${lang}_ROOT}/include" | ||
${USE_DEFAULT_PATHS}) | ||
|
||
find_library (NETCDF_${lang}_LIBRARY NAMES ${libs} | ||
HINTS "${NetCDF_lib_dirs}" | ||
HINTS "${NETCDF_${lang}_ROOT}/lib" | ||
${USE_DEFAULT_PATHS}) | ||
|
||
mark_as_advanced (NETCDF_${lang}_INCLUDE_DIR NETCDF_${lang}_LIBRARY) | ||
|
||
#export to internal varS that rest of project can use directly | ||
set (NETCDF_${lang}_LIBRARIES ${NETCDF_${lang}_LIBRARY}) | ||
set (NETCDF_${lang}_INCLUDE_DIRS ${NETCDF_${lang}_INCLUDE_DIR}) | ||
|
||
if (NETCDF_${lang}_INCLUDE_DIR AND NETCDF_${lang}_LIBRARY) | ||
list (APPEND NetCDF_libs ${NETCDF_${lang}_LIBRARY}) | ||
list (APPEND NetCDF_includes ${NETCDF_${lang}_INCLUDE_DIR}) | ||
else () | ||
set (NETCDF_HAS_INTERFACES "NO") | ||
message (STATUS "Failed to find NetCDF interface for ${lang}") | ||
endif () | ||
endif () | ||
endmacro () | ||
|
||
list (FIND NetCDF_FIND_COMPONENTS "CXX" _nextcomp) | ||
if (_nextcomp GREATER -1) | ||
set (NETCDF_CXX 1) | ||
endif () | ||
list (FIND NetCDF_FIND_COMPONENTS "F77" _nextcomp) | ||
if (_nextcomp GREATER -1) | ||
set (NETCDF_F77 1) | ||
endif () | ||
list (FIND NetCDF_FIND_COMPONENTS "F90" _nextcomp) | ||
if (_nextcomp GREATER -1) | ||
set (NETCDF_F90 1) | ||
endif () | ||
NetCDF_check_interface (CXX netcdfcpp.h netcdf_c++) | ||
NetCDF_check_interface (F77 netcdf.inc netcdff) | ||
NetCDF_check_interface (F90 netcdf.mod netcdff) | ||
|
||
#export accumulated results to internal varS that rest of project can depend on | ||
list (APPEND NetCDF_libs "${NETCDF_C_LIBRARIES}") | ||
set (NETCDF_LIBRARIES ${NetCDF_libs}) | ||
set (NETCDF_INCLUDE_DIRS ${NetCDF_includes}) | ||
|
||
# handle the QUIETLY and REQUIRED arguments and set NETCDF_FOUND to TRUE if | ||
# all listed variables are TRUE | ||
include (FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args (NetCDF | ||
DEFAULT_MSG NETCDF_LIBRARIES NETCDF_INCLUDE_DIRS NETCDF_HAS_INTERFACES) | ||
# Copied from: https://github.com/Kitware/VTK/blob/master/CMake/FindNetCDF.cmake | ||
# At commit: b103500b50aeb70647e6847bd8bdef72db4d5482 | ||
# | ||
# - Find NetCDF | ||
# Find the native NetCDF includes and library | ||
# | ||
# NETCDF_INCLUDE_DIR - user modifiable choice of where netcdf headers are | ||
# NETCDF_LIBRARY - user modifiable choice of where netcdf libraries are | ||
# | ||
# Your package can require certain interfaces to be FOUND by setting these | ||
# | ||
# NETCDF_CXX - require the C++ interface and link the C++ library | ||
# NETCDF_F77 - require the F77 interface and link the fortran library | ||
# NETCDF_F90 - require the F90 interface and link the fortran library | ||
# | ||
# Or equivalently by calling FindNetCDF with a COMPONENTS argument containing one or | ||
# more of "CXX;F77;F90". | ||
# | ||
# When interfaces are requested the user has access to interface specific hints: | ||
# | ||
# NETCDF_${LANG}_INCLUDE_DIR - where to search for interface header files | ||
# NETCDF_${LANG}_LIBRARY - where to search for interface libraries | ||
# | ||
# This module returns these variables for the rest of the project to use. | ||
# | ||
# NETCDF_FOUND - True if NetCDF found including required interfaces (see below) | ||
# NETCDF_LIBRARIES - All netcdf related libraries. | ||
# NETCDF_INCLUDE_DIRS - All directories to include. | ||
# NETCDF_HAS_INTERFACES - Whether requested interfaces were found or not. | ||
# NETCDF_${LANG}_INCLUDE_DIRS/NETCDF_${LANG}_LIBRARIES - C/C++/F70/F90 only interface | ||
# | ||
# Normal usage would be: | ||
# set (NETCDF_F90 "YES") | ||
# find_package (NetCDF REQUIRED) | ||
# target_link_libraries (uses_everthing ${NETCDF_LIBRARIES}) | ||
# target_link_libraries (only_uses_f90 ${NETCDF_F90_LIBRARIES}) | ||
|
||
#search starting from user editable cache var | ||
if (NETCDF_INCLUDE_DIR AND NETCDF_LIBRARY) | ||
# Already in cache, be silent | ||
set (NETCDF_FIND_QUIETLY TRUE) | ||
endif () | ||
|
||
set(USE_DEFAULT_PATHS "NO_DEFAULT_PATH") | ||
if(NETCDF_USE_DEFAULT_PATHS) | ||
set(USE_DEFAULT_PATHS "") | ||
endif() | ||
|
||
find_path (NETCDF_INCLUDE_DIR netcdf.h | ||
PATHS "${NETCDF_DIR}/include") | ||
mark_as_advanced (NETCDF_INCLUDE_DIR) | ||
set (NETCDF_C_INCLUDE_DIRS ${NETCDF_INCLUDE_DIR}) | ||
|
||
find_library (NETCDF_LIBRARY NAMES netcdf | ||
PATHS "${NETCDF_DIR}/lib" | ||
HINTS "${NETCDF_INCLUDE_DIR}/../lib") | ||
mark_as_advanced (NETCDF_LIBRARY) | ||
|
||
set (NETCDF_C_LIBRARIES ${NETCDF_LIBRARY}) | ||
|
||
#start finding requested language components | ||
set (NetCDF_libs "") | ||
set (NetCDF_includes "${NETCDF_INCLUDE_DIR}") | ||
|
||
get_filename_component (NetCDF_lib_dirs "${NETCDF_LIBRARY}" PATH) | ||
set (NETCDF_HAS_INTERFACES "YES") # will be set to NO if we're missing any interfaces | ||
|
||
macro (NetCDF_check_interface lang header libs) | ||
if (NETCDF_${lang}) | ||
#search starting from user modifiable cache var | ||
find_path (NETCDF_${lang}_INCLUDE_DIR NAMES ${header} | ||
HINTS "${NETCDF_INCLUDE_DIR}" | ||
HINTS "${NETCDF_${lang}_ROOT}/include" | ||
${USE_DEFAULT_PATHS}) | ||
|
||
find_library (NETCDF_${lang}_LIBRARY NAMES ${libs} | ||
HINTS "${NetCDF_lib_dirs}" | ||
HINTS "${NETCDF_${lang}_ROOT}/lib" | ||
${USE_DEFAULT_PATHS}) | ||
|
||
mark_as_advanced (NETCDF_${lang}_INCLUDE_DIR NETCDF_${lang}_LIBRARY) | ||
|
||
#export to internal varS that rest of project can use directly | ||
set (NETCDF_${lang}_LIBRARIES ${NETCDF_${lang}_LIBRARY}) | ||
set (NETCDF_${lang}_INCLUDE_DIRS ${NETCDF_${lang}_INCLUDE_DIR}) | ||
|
||
if (NETCDF_${lang}_INCLUDE_DIR AND NETCDF_${lang}_LIBRARY) | ||
list (APPEND NetCDF_libs ${NETCDF_${lang}_LIBRARY}) | ||
list (APPEND NetCDF_includes ${NETCDF_${lang}_INCLUDE_DIR}) | ||
else () | ||
set (NETCDF_HAS_INTERFACES "NO") | ||
message (STATUS "Failed to find NetCDF interface for ${lang}") | ||
endif () | ||
endif () | ||
endmacro () | ||
|
||
list (FIND NetCDF_FIND_COMPONENTS "CXX" _nextcomp) | ||
if (_nextcomp GREATER -1) | ||
set (NETCDF_CXX 1) | ||
endif () | ||
list (FIND NetCDF_FIND_COMPONENTS "F77" _nextcomp) | ||
if (_nextcomp GREATER -1) | ||
set (NETCDF_F77 1) | ||
endif () | ||
list (FIND NetCDF_FIND_COMPONENTS "F90" _nextcomp) | ||
if (_nextcomp GREATER -1) | ||
set (NETCDF_F90 1) | ||
endif () | ||
NetCDF_check_interface (CXX netcdfcpp.h netcdf_c++) | ||
NetCDF_check_interface (F77 netcdf.inc netcdff) | ||
NetCDF_check_interface (F90 netcdf.mod netcdff) | ||
|
||
#export accumulated results to internal varS that rest of project can depend on | ||
list (APPEND NetCDF_libs "${NETCDF_C_LIBRARIES}") | ||
set (NETCDF_LIBRARIES ${NetCDF_libs}) | ||
set (NETCDF_INCLUDE_DIRS ${NetCDF_includes}) | ||
|
||
# handle the QUIETLY and REQUIRED arguments and set NETCDF_FOUND to TRUE if | ||
# all listed variables are TRUE | ||
include (FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args (NetCDF | ||
DEFAULT_MSG NETCDF_LIBRARIES NETCDF_INCLUDE_DIRS NETCDF_HAS_INTERFACES) |
Oops, something went wrong.