33
33
! >
34
34
! > Each of the subtables currently supports the following fields:
35
35
! >```toml
36
- ! >[profile .debug.gfortran.linux]
36
+ ! >[profiles .debug.gfortran.linux]
37
37
! > flags="-Wall -g -Og"
38
38
! > c-flags="-g O1"
39
+ ! > cxx-flags="-g O1"
39
40
! > link-time-flags="-xlinkopt"
40
41
! > files={"hello_world.f90"="-Wall -O3"}
41
42
! >```
@@ -84,6 +85,9 @@ module fpm_manifest_profile
84
85
! > C compiler flags
85
86
character (len= :), allocatable :: c_flags
86
87
88
+ ! > C++ compiler flags
89
+ character (len= :), allocatable :: cxx_flags
90
+
87
91
! > Link time compiler flags
88
92
character (len= :), allocatable :: link_time_flags
89
93
@@ -103,7 +107,8 @@ module fpm_manifest_profile
103
107
contains
104
108
105
109
! > Construct a new profile configuration from a TOML data structure
106
- function new_profile (profile_name , compiler , os_type , flags , c_flags , link_time_flags , file_scope_flags , is_built_in ) &
110
+ function new_profile (profile_name , compiler , os_type , flags , c_flags , cxx_flags , &
111
+ link_time_flags , file_scope_flags , is_built_in ) &
107
112
& result(profile)
108
113
109
114
! > Name of the profile
@@ -121,6 +126,9 @@ function new_profile(profile_name, compiler, os_type, flags, c_flags, link_time_
121
126
! > C compiler flags
122
127
character (len=* ), optional , intent (in ) :: c_flags
123
128
129
+ ! > C++ compiler flags
130
+ character (len=* ), optional , intent (in ) :: cxx_flags
131
+
124
132
! > Link time compiler flags
125
133
character (len=* ), optional , intent (in ) :: link_time_flags
126
134
@@ -145,6 +153,11 @@ function new_profile(profile_name, compiler, os_type, flags, c_flags, link_time_
145
153
else
146
154
profile% c_flags = " "
147
155
end if
156
+ if (present (cxx_flags)) then
157
+ profile% cxx_flags = cxx_flags
158
+ else
159
+ profile% cxx_flags = " "
160
+ end if
148
161
if (present (link_time_flags)) then
149
162
profile% link_time_flags = link_time_flags
150
163
else
@@ -239,7 +252,7 @@ subroutine validate_profile_table(profile_name, compiler_name, key_list, table,
239
252
! > Was called with valid operating system
240
253
logical , intent (in ) :: os_valid
241
254
242
- character (len= :), allocatable :: flags, c_flags, link_time_flags, key_name, file_name, file_flags, err_message
255
+ character (len= :), allocatable :: flags, c_flags, cxx_flags, link_time_flags, key_name, file_name, file_flags, err_message
243
256
type (toml_table), pointer :: files
244
257
type (toml_key), allocatable :: file_list(:)
245
258
integer :: ikey, ifile, stat
@@ -260,6 +273,12 @@ subroutine validate_profile_table(profile_name, compiler_name, key_list, table,
260
273
call syntax_error(error, " c-flags has to be a key-value pair" )
261
274
return
262
275
end if
276
+ else if (key_name.eq. ' cxx-flags' ) then
277
+ call get_value(table, ' cxx-flags' , cxx_flags, stat= stat)
278
+ if (stat /= toml_stat% success) then
279
+ call syntax_error(error, " cxx-flags has to be a key-value pair" )
280
+ return
281
+ end if
263
282
else if (key_name.eq. ' link-time-flags' ) then
264
283
call get_value(table, ' link-time-flags' , link_time_flags, stat= stat)
265
284
if (stat /= toml_stat% success) then
@@ -324,7 +343,7 @@ subroutine get_flags(profile_name, compiler_name, os_type, key_list, table, prof
324
343
! > Was called with valid operating system
325
344
logical , intent (in ) :: os_valid
326
345
327
- character (len= :), allocatable :: flags, c_flags, link_time_flags, key_name, file_name, file_flags, err_message
346
+ character (len= :), allocatable :: flags, c_flags, cxx_flags, link_time_flags, key_name, file_name, file_flags, err_message
328
347
type (toml_table), pointer :: files
329
348
type (toml_key), allocatable :: file_list(:)
330
349
type (file_scope_flag), allocatable :: file_scope_flags(:)
@@ -333,6 +352,7 @@ subroutine get_flags(profile_name, compiler_name, os_type, key_list, table, prof
333
352
334
353
call get_value(table, ' flags' , flags)
335
354
call get_value(table, ' c-flags' , c_flags)
355
+ call get_value(table, ' cxx-flags' , cxx_flags)
336
356
call get_value(table, ' link-time-flags' , link_time_flags)
337
357
call get_value(table, ' files' , files)
338
358
if (associated (files)) then
@@ -350,7 +370,7 @@ subroutine get_flags(profile_name, compiler_name, os_type, key_list, table, prof
350
370
end if
351
371
352
372
profiles(profindex) = new_profile(profile_name, compiler_name, os_type, &
353
- & flags, c_flags, link_time_flags, file_scope_flags)
373
+ & flags, c_flags, cxx_flags, link_time_flags, file_scope_flags)
354
374
profindex = profindex + 1
355
375
end subroutine get_flags
356
376
@@ -656,6 +676,8 @@ subroutine new_profiles(profiles, table, error)
656
676
& " " // profiles(iprof)% flags
657
677
profiles(profindex)% c_flags= profiles(profindex)% c_flags// &
658
678
& " " // profiles(iprof)% c_flags
679
+ profiles(profindex)% cxx_flags= profiles(profindex)% cxx_flags// &
680
+ & " " // profiles(iprof)% cxx_flags
659
681
profiles(profindex)% link_time_flags= profiles(profindex)% link_time_flags// &
660
682
& " " // profiles(iprof)% link_time_flags
661
683
end if
@@ -861,6 +883,7 @@ function info_profile(profile) result(s)
861
883
end select
862
884
if (allocated (profile% flags)) s = s // ' , flags="' // profile% flags // ' "'
863
885
if (allocated (profile% c_flags)) s = s // ' , c_flags="' // profile% c_flags // ' "'
886
+ if (allocated (profile% cxx_flags)) s = s // ' , cxx_flags="' // profile% cxx_flags // ' "'
864
887
if (allocated (profile% link_time_flags)) s = s // ' , link_time_flags="' // profile% link_time_flags // ' "'
865
888
if (allocated (profile% file_scope_flags)) then
866
889
do i= 1 ,size (profile% file_scope_flags)
0 commit comments