Skip to content

Commit 1cf62c0

Browse files
committed
Cleanup for PR
1 parent 11bebfc commit 1cf62c0

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

fpm/src/fpm.f90

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,18 @@ subroutine build_model(model, settings, package, error)
170170
& -fmax-errors=1 &
171171
& -ffast-math &
172172
& -funroll-loops ' // &
173-
& '-J'//join_path(model%output_directory,'lib')
173+
& '-J'//join_path(model%output_directory,model%package_name)
174174
else
175175
model%output_directory = 'build/gfortran_debug'
176176
model%fortran_compile_flags = ' -Wall -Wextra -Wimplicit-interface -fPIC -fmax-errors=1 -g '// &
177177
'-fbounds-check -fcheck-array-temporaries -fbacktrace '// &
178-
'-J'//join_path(model%output_directory,'lib')
178+
'-J'//join_path(model%output_directory,model%package_name)
179179
endif
180180
model%link_flags = ''
181181

182182
! Add sources from executable directories
183183
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, &
185185
with_executables=.true., error=error)
186186

187187
if (allocated(error)) then
@@ -190,7 +190,7 @@ subroutine build_model(model, settings, package, error)
190190

191191
end if
192192
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, &
194194
with_executables=.true., error=error)
195195

196196
if (allocated(error)) then
@@ -199,7 +199,7 @@ subroutine build_model(model, settings, package, error)
199199

200200
end if
201201
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, &
203203
auto_discover=package%build_config%auto_executables, &
204204
error=error)
205205

@@ -209,7 +209,7 @@ subroutine build_model(model, settings, package, error)
209209

210210
end if
211211
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, &
213213
auto_discover=package%build_config%auto_tests, &
214214
error=error)
215215

@@ -220,25 +220,23 @@ subroutine build_model(model, settings, package, error)
220220
endif
221221

222222
! 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, &
224224
package_root='.',dev_depends=.true.,error=error)
225225
if (allocated(error)) then
226226
return
227227
end if
228228

229+
call targets_from_sources(model,model%sources)
230+
229231
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
233234
enddo
234235
stop
235-
else
236-
237-
call targets_from_sources(model,sources)
238-
239-
call resolve_module_dependencies(model%targets,error)
240236
endif
241237

238+
call resolve_module_dependencies(model%targets,error)
239+
242240
end subroutine build_model
243241

244242

fpm/src/fpm_backend.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ subroutine build_package(model)
2828
if (.not.exists(model%output_directory)) then
2929
call mkdir(model%output_directory)
3030
end if
31-
32-
if (.not.exists(join_path(model%output_directory,'lib'))) then
33-
call mkdir(join_path(model%output_directory,'lib'))
31+
if (.not.exists(join_path(model%output_directory,model%package_name))) then
32+
call mkdir(join_path(model%output_directory,model%package_name))
3433
end if
3534

3635
if (model%targets(1)%ptr%target_type == FPM_TARGET_ARCHIVE) then
37-
linking = ' -l'//model%package_name//" -L"//join_path(model%output_directory,'lib')
36+
linking = ' -l'//model%package_name//" -L"//&
37+
join_path(model%output_directory,model%package_name)
3838
else
3939
linking = " "
4040
end if

fpm/src/fpm_model.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ module fpm_model
7575
type :: fpm_model_t
7676
character(:), allocatable :: package_name
7777
! Name of package
78+
type(srcfile_t), allocatable :: sources(:)
79+
! Array of sources
7880
type(build_target_ptr), allocatable :: targets(:)
79-
! Array of sources with module-dependencies resolved
81+
! Array of targets with module-dependencies resolved
8082
character(:), allocatable :: fortran_compiler
8183
! Command line name to invoke fortran compiler
8284
character(:), allocatable :: fortran_compile_flags

fpm/src/fpm_targets.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ subroutine targets_from_sources(model,sources)
2020

2121
if (with_lib) call add_target(model%targets,type = FPM_TARGET_ARCHIVE,&
2222
output_file = join_path(model%output_directory,&
23-
'lib','lib'//model%package_name//'.a'))
23+
model%package_name,'lib'//model%package_name//'.a'))
2424

2525
do i=1,size(sources)
2626

@@ -98,7 +98,7 @@ function get_object_name(source) result(object_file)
9898
object_file = join_path(model%output_directory,'test',object_file)//'.o'
9999

100100
case default
101-
object_file = join_path(model%output_directory,'lib',object_file)//'.o'
101+
object_file = join_path(model%output_directory,model%package_name,object_file)//'.o'
102102

103103
end select
104104

0 commit comments

Comments
 (0)