1 Star 0 Fork 0

董理/hntp-grid-db

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CMakeLists.txt 3.75 KB
一键复制 编辑 原始数据 按行查看 历史
董理 提交于 2022-06-24 16:06 +08:00 . Add more write codes
cmake_minimum_required(VERSION 3.0)
project(grid_db LANGUAGES C Fortran)
if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-none -ffpe-trap=invalid,zero,overflow")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O0 -fcheck=all -g -fbacktrace")
else ()
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Ofast")
endif ()
# FIXME: OpenMP causes sigmentation faults.
# set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fopenmp")
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -no-wrap-margin -O0 -check bounds -g -traceback")
else ()
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -no-wrap-margin -O3")
endif ()
endif ()
include(FindPkgConfig)
# ------------------------------------------------------------------------------
# NETCDF
if (DEFINED ENV{NETCDF} AND (NOT DEFINED ENV{NETCDF_ROOT}))
set(ENV{NETCDF_ROOT} $ENV{NETCDF})
endif ()
if (DEFINED ENV{NETCDF_ROOT})
include_directories("$ENV{NETCDF_ROOT}/include")
link_directories("$ENV{NETCDF_ROOT}/lib")
else ()
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_search_module(NETCDF netcdf)
if (NETCDF_FOUND)
include_directories(${NETCDF_INCLUDEDIR})
link_directories(${NETCDF_LIBDIR})
else ()
message(FATAL_ERROR "Pkg-config could not find netcdf library!")
endif ()
else ()
message(FATAL_ERROR "Unable to find pkg-config library!")
endif ()
endif ()
# ------------------------------------------------------------------------------
# MONGO
pkg_check_modules(MONGOC libmongoc-1.0)
if (MONGOC_FOUND)
include_directories(${MONGOC_INCLUDE_DIRS})
link_directories(${MONGOC_LIBRARY_DIRS})
else ()
message(FATAL_ERROR "No MONGOC is found! Build without it.")
endif ()
add_subdirectory(lib/container)
add_subdirectory(lib/string)
add_subdirectory(lib/flogger)
set(sources
src/mongoc_const.h
src/mongoc_data.h
src/mongoc_common.c
src/mongof_common_mod.F90
src/utils_mod.F90
)
add_executable(write_tp_10km_grid.exe ${sources} src/write_tp_2km_grid.c src/write_tp_10km_grid.F90)
target_link_libraries(write_tp_10km_grid.exe netcdff ${MONGOC_LIBRARIES} fortran_string flogger)
add_executable(write_tp_10km_climate.exe ${sources} src/write_tp_2km_yearly.c src/write_tp_10km_climate.F90)
target_link_libraries(write_tp_10km_climate.exe netcdff ${MONGOC_LIBRARIES} fortran_string flogger)
add_executable(write_tp_2km_grid.exe ${sources} src/write_tp_2km_grid.c src/write_tp_2km_grid.F90)
target_link_libraries(write_tp_2km_grid.exe netcdff ${MONGOC_LIBRARIES} fortran_string flogger)
add_executable(write_tp_2km_config.exe ${sources} src/write_tp_2km_config.c src/write_tp_2km_config.F90)
target_link_libraries(write_tp_2km_config.exe netcdff ${MONGOC_LIBRARIES} fortran_string flogger)
add_executable(write_tp_2km_yearly.exe ${sources} src/write_tp_2km_yearly.c src/write_tp_2km_yearly.F90)
target_link_libraries(write_tp_2km_yearly.exe netcdff ${MONGOC_LIBRARIES} fortran_string flogger)
add_executable(write_tp_2km_monthly.exe ${sources} src/write_tp_2km_yearly.c src/write_tp_2km_monthly.F90)
target_link_libraries(write_tp_2km_monthly.exe netcdff ${MONGOC_LIBRARIES} fortran_string flogger)
add_executable(write_tp_2km_ymonthly.exe ${sources} src/write_tp_2km_ymonthly.c src/write_tp_2km_ymonthly.F90)
target_link_libraries(write_tp_2km_ymonthly.exe netcdff ${MONGOC_LIBRARIES} fortran_string flogger)
add_executable(write_tp_2km_annual_mean.exe ${sources} src/write_tp_2km_yearly.c src/write_tp_2km_annual_mean.F90)
target_link_libraries(write_tp_2km_annual_mean.exe netcdff ${MONGOC_LIBRARIES} fortran_string flogger)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dongli85/hntp-grid-db.git
[email protected]:dongli85/hntp-grid-db.git
dongli85
hntp-grid-db
hntp-grid-db
master

搜索帮助