-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
133 lines (96 loc) · 4.47 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# (C) Copyright 2017 UCAR.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
################################################################################
# MPAS
################################################################################
cmake_minimum_required( VERSION 3.3.2 FATAL_ERROR )
project( wrf-jedi C CXX Fortran )
set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH})
set( ECBUILD_DEFAULT_BUILD_TYPE Release )
set( ENABLE_OS_TESTS OFF CACHE BOOL "Disable OS tests" FORCE )
set( ENABLE_LARGE_FILE_SUPPORT OFF CACHE BOOL "Disable testing of large file support" FORCE )
set( ENABLE_MPI ON CACHE BOOL "Compile with MPI" )
include( ecbuild_system NO_POLICY_SCOPE )
ecbuild_requires_macro_version( 2.5 )
################################################################################
# Project
################################################################################
ecbuild_declare_project()
ecbuild_enable_fortran( REQUIRED )
ecbuild_add_cxx11_flags()
set( MPAS_LINKER_LANGUAGE CXX )
################################################################################
# Dependencies
################################################################################
# Boost
set( Boost_MINIMUM_VERSION "1.47" )
find_package( Boost ${Boost_MINIMUM_VERSION} REQUIRED
COMPONENTS unit_test_framework )
include_directories( ${Boost_INCLUDE_DIR} )
# MPI
ecbuild_add_option( FEATURE MPI DEFAULT ON
DESCRIPTION "Support for MPI distributed parallelism"
REQUIRED_PACKAGES "MPI COMPONENTS CXX Fortran" )
#if ( NOT ECKIT_HAVE_MPI )
# ecbuild_error("OOPS requested to build with MPI but eckit wasn't built with MPI: ECKIT_HAVE_MPI = ${ECKIT_HAVE_MPI}")
#endif()
#if( HAVE_MPI )
set( OOPS_MPI_C_LIBRARIES ${MPI_CXX_LIBRARIES} )
ecbuild_include_mpi()
link_libraries(${MPI_CXX_LIBRARIES} ${MPI_Fortran_LIBRARIES})
#endif()
#
find_package( LibXml2 REQUIRED )
include_directories( ${LIBXML2_INCLUDE_DIR} )
# OpenMP
ecbuild_add_option( FEATURE OMP
DESCRIPTION "Support for OpenMP threaded parallelism"
REQUIRED_PACKAGES "OMP COMPONENTS CXX Fortran" )
if( HAVE_OMP )
ecbuild_enable_omp()
else()
ecbuild_enable_ompstubs()
endif()
# oops
ecbuild_use_package( PROJECT oops VERSION 0.2.1 REQUIRED )
include_directories( ${OOPS_INCLUDE_DIRS} )
# ufo
ecbuild_use_package( PROJECT ufo )
include_directories( ${UFO_INCLUDE_DIRS} )
################################################################################
# Export package info
################################################################################
# list( APPEND WRF_TPLS ufo oops )
set( WRFJEDI_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_Fortran_MODULE_DIRECTORY} )
set( WRFJEDI_LIBRARIES wrf-jedi )
get_directory_property( WRFJEDI_DEFINITIONS COMPILE_DEFINITIONS )
foreach( _tpl ${WRFJEDI_TPLS} )
string( TOUPPER ${_tpl} TPL )
list( APPEND WRFJEDI_EXTRA_DEFINITIONS ${${TPL}_DEFINITIONS} ${${TPL}_TPL_DEFINITIONS} )
list( APPEND WRFJEDI_EXTRA_INCLUDE_DIRS ${${TPL}_INCLUDE_DIRS} ${${TPL}_TPL_INCLUDE_DIRS} )
list( APPEND WRFJEDI_EXTRA_LIBRARIES ${${TPL}_LIBRARIES} ${${TPL}_TPL_LIBRARIES} )
endforeach()
# set( WRF_MODEL_PATH $ENV{WRF_MODEL})
set( WRF_MODEL_PATH "/vagrant_data/code/WRFv4.0_JEDI")
#SET( Fortran_FLAGS_WRF "-O3 -ip -fp-model precise -w -ftz -align all -fno-alias -FR -convert big_endian")
#SET( Fortran_FLAGS_SIZE_WRF " -real-size 32 -i4 ")
#set_source_files_properties(${SRC_LIST} PROPERTIES COMPILE_FLAGS "${Fortran_FLAGS} ${Fortran_FLAGS_SIZE} ${CPP_FLAGS}")
################################################################################
# Sources
################################################################################
# include( wrf_compiler_flags )
include_directories( ${WRFJEDI_INCLUDE_DIRS}/model ${WRFJEDI_EXTRA_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/model )
add_subdirectory( model )
add_subdirectory( mains )
add_subdirectory( test )
################################################################################
# Finalise configuration
################################################################################
# prepares a tar.gz of the sources and/or binaries
ecbuild_install_project( NAME wrf-jedi )
# print the summary of the configuration
ecbuild_print_summary()