-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
76 lines (57 loc) · 2.84 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
# (C) Copyright 2022 .
#
# 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.
cmake_minimum_required( VERSION 3.12)
project( vector2tile VERSION 2022.10 LANGUAGES Fortran )
# ecbuild integration
find_package(ecbuild 3.3.2 REQUIRED)
include( ecbuild_system NO_POLICY_SCOPE )
ecbuild_declare_project()
list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include( vector2tile_compiler_flags )
################################################################################
# Dependencies
################################################################################
find_package(OpenMP COMPONENTS C Fortran)
find_package(MPI REQUIRED COMPONENTS C Fortran)
find_package(NetCDF REQUIRED COMPONENTS Fortran )
################################################################################
# Sources
################################################################################
set( VECTOR2TILE_LINKER_LANGUAGE Fortran )
list ( APPEND src_files
./namelist_mod.f90
./vector2tile_perturbation_mod.f90
./vector2tile_restart_mod.f90
)
ecbuild_add_library( TARGET vector2tile
SOURCES ${src_files}
INSTALL_HEADERS LISTED
LINKER_LANGUAGE ${VECTOR2TILE_LINKER_LANGUAGE}
)
target_link_libraries(vector2tile PUBLIC NetCDF::NetCDF_Fortran)
target_link_libraries(vector2tile PUBLIC MPI::MPI_Fortran)
target_link_libraries(vector2tile PUBLIC OpenMP::OpenMP_C OpenMP::OpenMP_Fortran)
# Fortran module output directory for build and install interfaces
set(MODULE_DIR module/${PROJECT_NAME}/${CMAKE_Fortran_COMPILER_ID}/${CMAKE_Fortran_COMPILER_VERSION})
set_target_properties(${PROJECT_NAME} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/${MODULE_DIR})
install(DIRECTORY ${CMAKE_BINARY_DIR}/${MODULE_DIR}/ DESTINATION ${MODULE_DIR})
target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/${MODULE_DIR}>
$<INSTALL_INTERFACE:${MODULE_DIR}>)
set( VECTOR2TILE_INCLUDE_DIRS ${CMAKE_Fortran_MODULE_DIRECTORY} )
set( VECTOR2TILE_LIBRARIES vector2tile )
# vector2tile_converter.exe executable
#-------------------------------------------------------------------------------
set ( exe_files vector2tile_driver.f90 )
ecbuild_add_executable( TARGET vector2tile_converter.exe
SOURCES ${exe_files}
LIBS vector2tile
LINKER_LANGUAGE ${VECTOR2TILE_LINKER_LANGUAGE}
)
################################################################################
# Finalise configuration
################################################################################
ecbuild_install_project( NAME vector2tile )
ecbuild_print_summary()