diff options
author | Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> | 2021-09-23 21:42:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-23 21:42:56 +0200 |
commit | dfeb17a3811054716828be47644ac98b146746de (patch) | |
tree | 7b927b16a5307ef145912e13f1ac33a58295ef6a /src/fpm.f90 | |
parent | 6bb5f6c49a22e8cf342e1c71262d155195d2c64a (diff) | |
download | fpm-dfeb17a3811054716828be47644ac98b146746de.tar.gz fpm-dfeb17a3811054716828be47644ac98b146746de.zip |
Allow setting, archiver, C compiler flags and linker flags from commandline (#549)
- Read Fortran compiler from FPM_FC or --compiler (deprecate FPM_COMPILER)
- Read Fortran compiler options from FPM_FFLAGS or --flag
- Read C compiler from FPM_CC or --c-compiler (deprecate FPM_C_COMPILER)
- Read C compiler options from FPM_CFLAGS or --c-flag
- Read archiver from FPM_AR or --archiver
- Read linker options from FPM_LDFLAGS or --link-flag
Diffstat (limited to 'src/fpm.f90')
-rw-r--r-- | src/fpm.f90 | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/fpm.f90 b/src/fpm.f90 index 1449dc2..d8381ae 100644 --- a/src/fpm.f90 +++ b/src/fpm.f90 @@ -39,7 +39,7 @@ subroutine build_model(model, settings, package, error) integer :: i, j type(package_config_t) :: dependency - character(len=:), allocatable :: manifest, lib_dir, flags + character(len=:), allocatable :: manifest, lib_dir, flags, cflags, ldflags logical :: duplicates_found = .false. type(string_t) :: include_dir @@ -60,8 +60,8 @@ subroutine build_model(model, settings, package, error) call filewrite(join_path("build", ".gitignore"),["*"]) end if - call new_compiler(model%compiler, settings%compiler) - call new_archiver(model%archiver) + call new_compiler(model%compiler, settings%compiler, settings%c_compiler) + call new_archiver(model%archiver, settings%archiver) if (settings%flag == '') then flags = model%compiler%get_default_flags(settings%profile == "release") @@ -73,7 +73,10 @@ subroutine build_model(model, settings, package, error) end select end if - write(build_name, '(z16.16)') fnv_1a(flags) + cflags = trim(settings%cflag) + ldflags = trim(settings%ldflag) + + write(build_name, '(z16.16)') fnv_1a(flags//cflags//ldflags) if (model%compiler%is_unknown()) then write(*, '(*(a:,1x))') & @@ -197,6 +200,8 @@ subroutine build_model(model, settings, package, error) write(*,*)'<INFO> COMPILER: ',model%compiler%fc write(*,*)'<INFO> C COMPILER: ',model%compiler%cc write(*,*)'<INFO> COMPILER OPTIONS: ', model%fortran_compile_flags + write(*,*)'<INFO> C COMPILER OPTIONS: ', model%c_compile_flags + write(*,*)'<INFO> LINKER OPTIONS: ', model%link_flags write(*,*)'<INFO> INCLUDE DIRECTORIES: [', string_cat(model%include_dirs,','),']' end if |