@@ -85,7 +85,7 @@ module fpm_manifest_profile
85
85
character (len= :), allocatable :: compiler
86
86
87
87
! > Value repesenting OS
88
- integer :: os_type
88
+ integer :: os_type = OS_ALL
89
89
90
90
! > Fortran compiler flags
91
91
character (len= :), allocatable :: flags
@@ -103,7 +103,7 @@ module fpm_manifest_profile
103
103
type (file_scope_flag), allocatable :: file_scope_flags(:)
104
104
105
105
! > Is this profile one of the built-in ones?
106
- logical :: is_built_in
106
+ logical :: is_built_in = .false.
107
107
108
108
contains
109
109
@@ -234,7 +234,8 @@ subroutine match_os_type(os_name, os_type)
234
234
235
235
select case (os_name)
236
236
case (" linux" ); os_type = OS_LINUX
237
- case (" macos" ); os_type = OS_WINDOWS
237
+ case (" macos" ); os_type = OS_MACOS
238
+ case (" windows" ); os_type = OS_WINDOWS
238
239
case (" cygwin" ); os_type = OS_CYGWIN
239
240
case (" solaris" ); os_type = OS_SOLARIS
240
241
case (" freebsd" ); os_type = OS_FREEBSD
@@ -245,6 +246,22 @@ subroutine match_os_type(os_name, os_type)
245
246
246
247
end subroutine match_os_type
247
248
249
+ ! > Match lowercase string with name of OS to os_type enum
250
+ function os_type_name (os_type )
251
+
252
+ ! > Name of operating system
253
+ character (len= :), allocatable :: os_type_name
254
+
255
+ ! > Enum representing type of OS
256
+ integer , intent (in ) :: os_type
257
+
258
+ select case (os_type)
259
+ case (OS_ALL); os_type_name = " all"
260
+ case default ; os_type_name = lower(OS_NAME(os_type))
261
+ end select
262
+
263
+ end function os_type_name
264
+
248
265
subroutine validate_profile_table (profile_name , compiler_name , key_list , table , error , os_valid )
249
266
250
267
! > Name of profile
@@ -849,7 +866,7 @@ subroutine info(self, unit, verbosity)
849
866
write (unit, fmt) " - compiler" , self% compiler
850
867
end if
851
868
852
- write (unit, fmt) " - os" , self% os_type
869
+ write (unit, fmt) " - os" , os_type_name( self% os_type)
853
870
854
871
if (allocated (self% flags)) then
855
872
write (unit, fmt) " - compiler flags" , self% flags
@@ -1042,40 +1059,51 @@ logical function profile_same(this,that)
1042
1059
1043
1060
select type (other= >that)
1044
1061
type is (profile_config_t)
1062
+ print * , ' check name'
1045
1063
if (allocated (this% profile_name).neqv. allocated (other% profile_name)) return
1046
1064
if (allocated (this% profile_name)) then
1047
1065
if (.not. (this% profile_name== other% profile_name)) return
1048
1066
endif
1067
+ print * , ' check compiler'
1049
1068
if (allocated (this% compiler).neqv. allocated (other% compiler)) return
1050
1069
if (allocated (this% compiler)) then
1051
1070
if (.not. (this% compiler== other% compiler)) return
1052
1071
endif
1072
+ print * , ' check os'
1053
1073
if (this% os_type/= other% os_type) return
1074
+ print * , ' check flags'
1054
1075
if (allocated (this% flags).neqv. allocated (other% flags)) return
1055
1076
if (allocated (this% flags)) then
1056
1077
if (.not. (this% flags== other% flags)) return
1057
1078
endif
1079
+ print * , ' check cflags'
1058
1080
if (allocated (this% c_flags).neqv. allocated (other% c_flags)) return
1059
1081
if (allocated (this% c_flags)) then
1060
1082
if (.not. (this% c_flags== other% c_flags)) return
1061
1083
endif
1084
+ print * , ' check cxxflags'
1062
1085
if (allocated (this% cxx_flags).neqv. allocated (other% cxx_flags)) return
1063
1086
if (allocated (this% cxx_flags)) then
1064
1087
if (.not. (this% cxx_flags== other% cxx_flags)) return
1065
1088
endif
1089
+ print * , ' check link'
1066
1090
if (allocated (this% link_time_flags).neqv. allocated (other% link_time_flags)) return
1067
1091
if (allocated (this% link_time_flags)) then
1068
1092
if (.not. (this% link_time_flags== other% link_time_flags)) return
1069
1093
endif
1070
1094
1095
+ print * , ' check file scope'
1096
+
1071
1097
if (allocated (this% file_scope_flags).neqv. allocated (other% file_scope_flags)) return
1072
1098
if (allocated (this% file_scope_flags)) then
1073
1099
if (.not. size (this% file_scope_flags)==size (other% file_scope_flags)) return
1074
1100
do ii= 1 ,size (this% file_scope_flags)
1101
+ print * , ' check ii-th file scope: ' ,ii
1075
1102
if (.not. this% file_scope_flags(ii)==other% file_scope_flags(ii)) return
1076
1103
end do
1077
1104
endif
1078
1105
1106
+ print * , ' check builtin'
1079
1107
if (this% is_built_in.neqv. other% is_built_in) return
1080
1108
1081
1109
class default
@@ -1109,7 +1137,8 @@ subroutine profile_dump(self, table, error)
1109
1137
if (allocated (error)) return
1110
1138
call set_string(table, " compiler" , self% compiler, error)
1111
1139
if (allocated (error)) return
1112
- call set_string(table," os-type" ,OS_NAME(self% os_type), error, ' profile_config_t' )
1140
+ print * , ' save os-type = ' ,os_type_name(self% os_type)
1141
+ call set_string(table," os-type" ,os_type_name(self% os_type), error, ' profile_config_t' )
1113
1142
if (allocated (error)) return
1114
1143
call set_string(table, " flags" , self% flags, error)
1115
1144
if (allocated (error)) return
@@ -1169,8 +1198,52 @@ subroutine profile_load(self, table, error)
1169
1198
! > Error handling
1170
1199
type (error_t), allocatable , intent (out ) :: error
1171
1200
1172
- ! call get_value(table, "file-name", self%profile_name)
1173
- ! call get_value(table, "flags", self%flags)
1201
+ ! > Local variables
1202
+ character (len= :), allocatable :: flag
1203
+ integer :: ii, jj
1204
+ type (toml_table), pointer :: ptr_dep, ptr
1205
+ type (toml_key), allocatable :: keys(:),dep_keys(:)
1206
+
1207
+ call table% get_keys(keys)
1208
+
1209
+ call get_value(table, " profile-name" , self% profile_name)
1210
+ call get_value(table, " compiler" , self% compiler)
1211
+ call get_value(table," os-type" ,flag)
1212
+ print * , ' OS flag = ' ,flag
1213
+ call match_os_type(flag, self% os_type)
1214
+ call get_value(table, " flags" , self% flags)
1215
+ call get_value(table, " c-flags" , self% c_flags)
1216
+ call get_value(table, " cxx-flags" , self% cxx_flags)
1217
+ call get_value(table, " link-time-flags" , self% link_time_flags)
1218
+ call get_value(table, " is-built-in" , self% is_built_in, error, ' profile_config_t' )
1219
+ if (allocated (error)) return
1220
+
1221
+ if (allocated (self% file_scope_flags)) deallocate (self% file_scope_flags)
1222
+ sub_deps: do ii = 1 , size (keys)
1223
+
1224
+ select case (keys(ii)% key)
1225
+ case (" file-scope-flags" )
1226
+
1227
+ call get_value(table, keys(ii), ptr)
1228
+ if (.not. associated (ptr)) then
1229
+ call fatal_error(error,' profile_config_t: error retrieving file_scope_flags table' )
1230
+ return
1231
+ end if
1232
+
1233
+ ! > Read all packages
1234
+ call ptr% get_keys(dep_keys)
1235
+ allocate (self% file_scope_flags(size (dep_keys)))
1236
+
1237
+ do jj = 1 , size (dep_keys)
1238
+
1239
+ call get_value(ptr, dep_keys(jj), ptr_dep)
1240
+ call self% file_scope_flags(jj)% load_from_toml(ptr_dep, error)
1241
+ if (allocated (error)) return
1242
+
1243
+ end do
1244
+
1245
+ end select
1246
+ end do sub_deps
1174
1247
1175
1248
end subroutine profile_load
1176
1249
0 commit comments