-
Notifications
You must be signed in to change notification settings - Fork 169
/
CMakeLists.txt
173 lines (162 loc) · 4.88 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
169
170
171
172
173
#### Pre-process: .fpp -> .f90 via Fypp
# Create a list of the files to be preprocessed
set(fppFiles
stdlib_ascii.fypp
stdlib_bitsets.fypp
stdlib_bitsets_64.fypp
stdlib_bitsets_large.fypp
stdlib_codata_type.fypp
stdlib_constants.fypp
stdlib_hash_32bit.fypp
stdlib_hash_32bit_fnv.fypp
stdlib_hash_32bit_nm.fypp
stdlib_hash_32bit_water.fypp
stdlib_hash_64bit.fypp
stdlib_hash_64bit_fnv.fypp
stdlib_hash_64bit_pengy.fypp
stdlib_hash_64bit_spookyv2.fypp
stdlib_io.fypp
stdlib_io_npy.fypp
stdlib_io_npy_load.fypp
stdlib_io_npy_save.fypp
stdlib_kinds.fypp
stdlib_linalg.fypp
stdlib_linalg_diag.fypp
stdlib_linalg_least_squares.fypp
stdlib_linalg_outer_product.fypp
stdlib_linalg_kronecker.fypp
stdlib_linalg_cross_product.fypp
stdlib_linalg_eigenvalues.fypp
stdlib_linalg_solve.fypp
stdlib_linalg_determinant.fypp
stdlib_linalg_qr.fypp
stdlib_linalg_inverse.fypp
stdlib_linalg_norms.fypp
stdlib_linalg_state.fypp
stdlib_linalg_svd.fypp
stdlib_linalg_cholesky.fypp
stdlib_optval.fypp
stdlib_selection.fypp
stdlib_sorting.fypp
stdlib_sorting_ord_sort.fypp
stdlib_sorting_sort.fypp
stdlib_sorting_sort_index.fypp
stdlib_sparse_constants.fypp
stdlib_sparse_conversion.fypp
stdlib_sparse_kinds.fypp
stdlib_sparse_spmv.fypp
stdlib_specialfunctions_gamma.fypp
stdlib_stats.fypp
stdlib_stats_corr.fypp
stdlib_stats_cov.fypp
stdlib_stats_mean.fypp
stdlib_stats_median.fypp
stdlib_stats_moment.fypp
stdlib_stats_moment_all.fypp
stdlib_stats_moment_mask.fypp
stdlib_stats_moment_scalar.fypp
stdlib_stats_distribution_uniform.fypp
stdlib_stats_distribution_normal.fypp
stdlib_stats_distribution_exponential.fypp
stdlib_stats_var.fypp
stdlib_quadrature.fypp
stdlib_quadrature_trapz.fypp
stdlib_quadrature_simps.fypp
stdlib_random.fypp
stdlib_math.fypp
stdlib_math_linspace.fypp
stdlib_math_logspace.fypp
stdlib_math_arange.fypp
stdlib_math_is_close.fypp
stdlib_math_all_close.fypp
stdlib_math_diff.fypp
stdlib_math_meshgrid.fypp
stdlib_str2num.fypp
stdlib_string_type.fypp
stdlib_string_type_constructor.fypp
stdlib_strings_to_string.fypp
stdlib_strings.fypp
stdlib_version.fypp
)
# Preprocessed files to contain preprocessor directives -> .F90
set(cppFiles
stdlib_linalg_constants.fypp
stdlib_linalg_blas.fypp
stdlib_linalg_blas_aux.fypp
stdlib_linalg_blas_s.fypp
stdlib_linalg_blas_d.fypp
stdlib_linalg_blas_q.fypp
stdlib_linalg_blas_c.fypp
stdlib_linalg_blas_z.fypp
stdlib_linalg_blas_w.fypp
stdlib_linalg_lapack.fypp
stdlib_linalg_lapack_aux.fypp
stdlib_linalg_lapack_s.fypp
stdlib_linalg_lapack_d.fypp
stdlib_linalg_lapack_q.fypp
stdlib_linalg_lapack_c.fypp
stdlib_linalg_lapack_z.fypp
stdlib_linalg_lapack_w.fypp
)
fypp_f90("${fyppFlags}" "${fppFiles}" outFiles)
fypp_f90pp("${fyppFlags}" "${cppFiles}" outPreprocFiles)
set(SRC
stdlib_ansi.f90
stdlib_ansi_operator.f90
stdlib_ansi_to_string.f90
stdlib_array.f90
stdlib_codata.f90
stdlib_error.f90
stdlib_hashmap_wrappers.f90
stdlib_hashmaps.f90
stdlib_hashmap_chaining.f90
stdlib_hashmap_open.f90
stdlib_logger.f90
stdlib_sorting_radix_sort.f90
stdlib_system.F90
stdlib_sparse.f90
stdlib_specialfunctions.f90
stdlib_specialfunctions_legendre.f90
stdlib_quadrature_gauss.f90
stdlib_stringlist_type.f90
${outFiles}
${outPreprocFiles}
)
add_library(${PROJECT_NAME} ${SRC})
set_target_properties(
${PROJECT_NAME}
PROPERTIES
POSITION_INDEPENDENT_CODE ON
WINDOWS_EXPORT_ALL_SYMBOLS ON
)
if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 10.0)
target_compile_options(
${PROJECT_NAME}
PRIVATE
$<$<COMPILE_LANGUAGE:Fortran>:-fno-range-check>
)
endif()
set(LIB_MOD_DIR ${CMAKE_CURRENT_BINARY_DIR}/mod_files/)
# We need the module directory before we finish the configure stage since the
# build interface might resolve before the module directory is generated by CMake
if(NOT EXISTS "${LIB_MOD_DIR}")
make_directory("${LIB_MOD_DIR}")
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES
Fortran_MODULE_DIRECTORY ${LIB_MOD_DIR})
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${LIB_MOD_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_MODULEDIR}>
)
if(f18errorstop)
target_sources(${PROJECT_NAME} PRIVATE f18estop.f90)
else()
target_sources(${PROJECT_NAME} PRIVATE f08estop.f90)
endif()
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
install(DIRECTORY ${LIB_MOD_DIR} DESTINATION "${CMAKE_INSTALL_MODULEDIR}")