@@ -170,18 +170,18 @@ subroutine build_model(model, settings, package, error)
170
170
& -fmax-errors=1 &
171
171
& -ffast-math &
172
172
& -funroll-loops ' // &
173
- & ' -J' // join_path(model% output_directory,' lib ' )
173
+ & ' -J' // join_path(model% output_directory,model % package_name )
174
174
else
175
175
model% output_directory = ' build/gfortran_debug'
176
176
model% fortran_compile_flags = ' -Wall -Wextra -Wimplicit-interface -fPIC -fmax-errors=1 -g ' // &
177
177
' -fbounds-check -fcheck-array-temporaries -fbacktrace ' // &
178
- ' -J' // join_path(model% output_directory,' lib ' )
178
+ ' -J' // join_path(model% output_directory,model % package_name )
179
179
endif
180
180
model% link_flags = ' '
181
181
182
182
! Add sources from executable directories
183
183
if (is_dir(' app' ) .and. package% build_config% auto_executables) then
184
- call add_sources_from_dir(sources,' app' , FPM_SCOPE_APP, &
184
+ call add_sources_from_dir(model % sources,' app' , FPM_SCOPE_APP, &
185
185
with_executables= .true. , error= error)
186
186
187
187
if (allocated (error)) then
@@ -190,7 +190,7 @@ subroutine build_model(model, settings, package, error)
190
190
191
191
end if
192
192
if (is_dir(' test' ) .and. package% build_config% auto_tests) then
193
- call add_sources_from_dir(sources,' test' , FPM_SCOPE_TEST, &
193
+ call add_sources_from_dir(model % sources,' test' , FPM_SCOPE_TEST, &
194
194
with_executables= .true. , error= error)
195
195
196
196
if (allocated (error)) then
@@ -199,7 +199,7 @@ subroutine build_model(model, settings, package, error)
199
199
200
200
end if
201
201
if (allocated (package% executable)) then
202
- call add_executable_sources(sources, package% executable, FPM_SCOPE_APP, &
202
+ call add_executable_sources(model % sources, package% executable, FPM_SCOPE_APP, &
203
203
auto_discover= package% build_config% auto_executables, &
204
204
error= error)
205
205
@@ -209,7 +209,7 @@ subroutine build_model(model, settings, package, error)
209
209
210
210
end if
211
211
if (allocated (package% test)) then
212
- call add_executable_sources(sources, package% test, FPM_SCOPE_TEST, &
212
+ call add_executable_sources(model % sources, package% test, FPM_SCOPE_TEST, &
213
213
auto_discover= package% build_config% auto_tests, &
214
214
error= error)
215
215
@@ -220,25 +220,23 @@ subroutine build_model(model, settings, package, error)
220
220
endif
221
221
222
222
! Add library sources, including local dependencies
223
- call add_libsources_from_package(sources,package_list,package, &
223
+ call add_libsources_from_package(model % sources,package_list,package, &
224
224
package_root= ' .' ,dev_depends= .true. ,error= error)
225
225
if (allocated (error)) then
226
226
return
227
227
end if
228
228
229
+ call targets_from_sources(model,model% sources)
230
+
229
231
if (settings% list)then
230
- do i= 1 ,size (sources)
231
- write (stderr,' (*(g0,1x))' )' fpm::build<INFO>:file expected at' ,sources(i)% file_name, &
232
- & merge (' exists ' ,' does not exist' ,exists(sources(i)% file_name) )
232
+ do i= 1 ,size (model% targets)
233
+ write (stderr,* ) model% targets(i)% ptr% output_file
233
234
enddo
234
235
stop
235
- else
236
-
237
- call targets_from_sources(model,sources)
238
-
239
- call resolve_module_dependencies(model% targets,error)
240
236
endif
241
237
238
+ call resolve_module_dependencies(model% targets,error)
239
+
242
240
end subroutine build_model
243
241
244
242
0 commit comments