-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
89 lines (75 loc) · 2.86 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# TEB version 4.0.1 (https://github.com/teb-model/teb).
# Copyright 2018 D. Meyer. Licensed under CeCILL version 2.1.
cmake_minimum_required(VERSION 3.1)
project(TEB Fortran)
option(USE_REAL8 "Use real8 instead of real4" ON)
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Debug")
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type (default Debug)" FORCE)
endif()
if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wall -fimplicit-none")
set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -ffpe-trap=invalid,zero,overflow,underflow -fcheck=all")
if (USE_REAL8)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8")
endif()
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -implicitnone")
set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -traceback -fpe-all0 -check all")
if (USE_REAL8)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8")
endif()
else()
message(FATAL_ERROR "Only gfortran and ifort compilers supported")
endif()
# Fix for ranlib in MacOS - added -c flag so that ranlib produces the index
# entry for the global variables which are not initialised.
# See link below for details:
# http://forthescience.org/blog/2014/11/01/undefined-symbols-for-fortran-module-variables-in-static-library-on-osx-problem-and-solution/
if(APPLE)
set(CMAKE_Fortran_ARCHIVE_FINISH "<CMAKE_RANLIB> -c <TARGET>")
endif()
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod)
add_subdirectory(external)
set(src_driver
src/driver/abor1_sfx.F90
src/driver/add_forecast_to_date_surf.F90
src/driver/close_file.F90
src/driver/close_file_asc.F90
src/driver/driver.F90
src/driver/modd_arch.F90
src/driver/modd_forc_atm.F90
src/driver/modd_surf_conf.F90
src/driver/mode_char2real.F90
src/driver/modi_abor1_sfx.F90
src/driver/modi_close_file.F90
src/driver/modi_ol_alloc_atm.F90
src/driver/modi_ol_read_atm_ascii.F90
src/driver/modi_ol_read_atm.F90
src/driver/modi_ol_time_interp_atm.F90
src/driver/modi_open_close_bin_asc_forc.F90
src/driver/ol_alloc_atm.F90
src/driver/ol_read_atm.F90
src/driver/ol_read_atm_ascii.F90
src/driver/ol_time_interp_atm.F90
src/driver/open_close_bin_asc_forc.F90
src/driver/read_surf_atm.F90
src/driver/modd_wrf_teb_driver.F90
)
file(GLOB_RECURSE src_proxi_SVAT "src/proxi_SVAT/*")
file(GLOB_RECURSE src_solar "src/solar/*")
file(GLOB_RECURSE src_struct "src/struct/*")
file(GLOB_RECURSE src_teb "src/teb/*")
add_library(teb
${src_driver}
${src_proxi_SVAT}
${src_solar}
${src_struct}
${src_teb}
)
add_executable(driver src/driver/driver.F90)
target_link_libraries(driver teb)
target_link_libraries(teb minimaldx)
target_include_directories(teb
INTERFACE ${CMAKE_Fortran_MODULE_DIRECTORY}
)