-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
executable file
·168 lines (145 loc) · 5 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
cmake_minimum_required (VERSION 3.15)
project(semba-fdtd Fortran)
enable_language (Fortran)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/mod)
message(STATUS ${CMAKE_Fortran_COMPILER_ID})
option(SEMBA_FDTD_ENABLE_MPI "Use MPI" OFF)
option(SEMBA_FDTD_ENABLE_HDF "Use HDF" ON)
option(SEMBA_FDTD_ENABLE_MTLN "Use MTLN" ON)
option(SEMBA_FDTD_ENABLE_SMBJSON "Use smbjson" ON)
option(SEMBA_FDTD_ENABLE_TEST "Compile tests" ON)
option(SEMBA_FDTD_EXECUTABLE "Compiles executable" ON)
option(SEMBA_FDTD_MAIN_LIB "Compiles main library" ON)
option(SEMBA_FDTD_COMPONENTS_LIB "Compiles components library" ON)
option(SEMBA_FDTD_OUTPUTS_LIB "Compiles outputs library" ON)
if(SEMBA_FDTD_ENABLE_SMBJSON)
add_definitions(-DCompileWithSMBJSON)
endif()
if (SEMBA_FDTD_ENABLE_MTLN)
add_definitions(-DCompileWithMTLN)
endif()
add_definitions(
-DCompileWithInt2
-DCompileWithReal4
-DCompileWithOpenMP
)
include("${CMAKE_CURRENT_SOURCE_DIR}/set_precompiled_libraries.cmake")
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-form -ffree-line-length-none -fdec -fcheck=bounds -fopenmp -fallow-argument-mismatch")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
add_definitions(-DCompileWithIncludeMpifh)
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
set(CMAKE_Fortran_FLAGS "-fpp")
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qopenmp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qopenmp")
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
if(CMAKE_Fortran_COMPILER_ID MATCHES "IntelLLVM")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qiopenmp")
else()
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qiopenmp /Wno-debug-option-simd")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qiopenmp")
endif()
endif()
else()
message(FATAL_ERROR "Unrecognized system name")
endif()
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -check all,nouninit -debug full -traceback")
endif()
endif()
add_subdirectory(external)
add_library(semba-types
"src_main_pub/nfde_types.F90"
"src_main_pub/fdetypes.F90"
"src_mtln/mtln_types.F90"
"src_wires_pub/wires_types.F90"
"src_main_pub/lumped_types.F90"
)
if(SEMBA_FDTD_ENABLE_SMBJSON)
add_subdirectory(src_json_parser)
if(PROJECT_IS_TOP_LEVEL)
set(SMBJSON_LIBRARIES smbjson)
else()
set(SMBJSON_LIBRARIES smbjson PARENT_SCOPE)
endif()
endif()
if (SEMBA_FDTD_ENABLE_MTLN)
set(NGSPICE_LIB ngspice)
add_definitions(-DCompileWithMTLN)
add_subdirectory(src_mtln)
if (PROJECT_IS_TOP_LEVEL)
set(MTLN_LIBRARIES mtlnsolver ngspice_interface)
else()
set(MTLN_LIBRARIES mtlnsolver ngspice_interface PARENT_SCOPE)
endif()
endif()
if (SEMBA_FDTD_ENABLE_TEST)
add_subdirectory(external/googletest/)
add_subdirectory(test)
endif()
if(SEMBA_FDTD_COMPONENTS_LIB)
add_library(semba-components
"src_main_pub/errorreport.F90"
"src_main_pub/anisotropic.F90"
"src_main_pub/borderscpml.F90"
"src_main_pub/bordersmur.F90"
"src_main_pub/bordersother.F90"
"src_main_pub/electricdispersive.F90"
"src_main_pub/magneticdispersive.F90"
"src_main_pub/nodalsources.F90"
"src_main_pub/planewaves.F90"
"src_main_pub/pml_bodies.F90"
"src_main_pub/maloney_nostoch.F90"
"src_main_pub/lumped.F90"
"src_main_pub/dmma_thin_slot.F90"
"src_main_pub/farfield.F90"
"src_wires_pub/wires.F90"
"src_wires_pub/wires_mtln.F90"
)
target_link_libraries(semba-components semba-types ${MTLN_LIBRARIES})
endif()
if(SEMBA_FDTD_OUTPUTS_LIB)
add_library(semba-outputs
"src_main_pub/mpicomm.F90"
"src_main_pub/observation.F90"
"src_main_pub/vtk.F90"
"src_main_pub/snapxdmf.F90"
"src_main_pub/xdmf.F90"
"src_main_pub/xdmf_h5.F90"
)
target_link_libraries(semba-outputs semba-components ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES})
endif()
if(SEMBA_FDTD_MAIN_LIB)
add_library(semba-main
"src_main_pub/calc_constants.F90"
"src_main_pub/nfde_rotate.F90"
"src_main_pub/EpsMuTimeScale.F90"
"src_main_pub/getargs.F90"
"src_main_pub/healer.F90"
"src_main_pub/preprocess_geom.F90"
"src_main_pub/storegeom.F90"
"src_main_pub/version.F90"
"src_main_pub/postprocess.F90"
"src_main_pub/interpreta_switches.F90"
"src_main_pub/resuming.F90"
"src_main_pub/timestepping.F90"
)
target_link_libraries(semba-main semba-outputs ${SMBJSON_LIBRARIES} ${MTLN_LIBRARIES})
endif()
if (SEMBA_FDTD_EXECUTABLE)
add_executable(semba-fdtd
"src_main_pub/semba_fdtd.F90"
)
target_link_libraries(semba-fdtd semba-main)
target_link_libraries(semba-fdtd ${MPI_Fortran_LIBRARIES})
endif()
include_directories(${CMAKE_BINARY_DIR}/mod)
include_directories(${HDF5_INCLUDE_DIRS})
include_directories(${FHASH_INCLUDES})