@@ -9,6 +9,8 @@ module fpm
9
9
FPM_SCOPE_UNKNOWN, FPM_SCOPE_LIB, &
10
10
FPM_SCOPE_DEP, FPM_SCOPE_APP, FPM_SCOPE_TEST, &
11
11
FPM_TARGET_EXECUTABLE, FPM_TARGET_ARCHIVE
12
+ use fpm_compiler, only: add_compile_flag_defaults
13
+
12
14
13
15
use fpm_sources, only: add_executable_sources, add_sources_from_dir
14
16
use fpm_targets, only: targets_from_sources, resolve_module_dependencies, &
@@ -153,11 +155,17 @@ subroutine build_model(model, settings, package, error)
153
155
type (fpm_build_settings), intent (in ) :: settings
154
156
type (package_config_t), intent (in ) :: package
155
157
type (error_t), allocatable , intent (out ) :: error
158
+ type (string_t), allocatable :: package_list(:)
156
159
157
160
integer :: i
158
- type (string_t), allocatable :: package_list(:)
161
+
162
+ if (settings% verbose)then
163
+ write (* ,* )' <INFO>BUILD_NAME:' ,settings% build_name
164
+ write (* ,* )' <INFO>COMPILER: ' ,settings% compiler
165
+ endif
159
166
160
167
model% package_name = package% name
168
+
161
169
if (allocated (package% build% link)) then
162
170
model% link_libraries = package% build% link
163
171
else
@@ -167,25 +175,16 @@ subroutine build_model(model, settings, package, error)
167
175
allocate (package_list(1 ))
168
176
package_list(1 )% s = package% name
169
177
170
- ! #TODO: Choose flags and output directory based on cli settings & manifest inputs
171
- model% fortran_compiler = ' gfortran'
172
-
173
- if (settings% release)then
174
- model% output_directory = ' build/gfortran_release'
175
- model% fortran_compile_flags= ' &
176
- & -O3 &
177
- & -Wimplicit-interface &
178
- & -fPIC &
179
- & -fmax-errors=1 &
180
- & -ffast-math &
181
- & -funroll-loops ' // &
182
- & ' -J' // join_path(model% output_directory,model% package_name)
178
+ if (settings% compiler.eq. ' ' )then
179
+ model% fortran_compiler = ' gfortran'
183
180
else
184
- model% output_directory = ' build/gfortran_debug'
185
- model% fortran_compile_flags = ' -Wall -Wextra -Wimplicit-interface -fPIC -fmax-errors=1 -g ' // &
186
- ' -fbounds-check -fcheck-array-temporaries -fbacktrace ' // &
187
- ' -J' // join_path(model% output_directory,model% package_name)
181
+ model% fortran_compiler = settings% compiler
188
182
endif
183
+
184
+ model% output_directory = join_path(' build' ,basename(model% fortran_compiler)// ' _' // settings% build_name)
185
+
186
+ call add_compile_flag_defaults(settings% build_name, basename(model% fortran_compiler), model)
187
+
189
188
model% link_flags = ' '
190
189
191
190
! Add sources from executable directories
0 commit comments