diff options
-rwxr-xr-x | ci/run_tests.bat | 3 | ||||
-rwxr-xr-x | ci/run_tests.sh | 1 | ||||
-rw-r--r-- | example_packages/with_examples/app/demo-prog.f90 | 3 | ||||
-rw-r--r-- | fpm/fpm.toml | 2 | ||||
-rw-r--r-- | fpm/src/fpm_command_line.f90 | 2 | ||||
-rw-r--r-- | fpm/src/fpm_targets.f90 | 42 |
6 files changed, 26 insertions, 27 deletions
diff --git a/ci/run_tests.bat b/ci/run_tests.bat index ef4a1f2..ae57da6 100755 --- a/ci/run_tests.bat +++ b/ci/run_tests.bat @@ -122,6 +122,9 @@ del /q /f build %fpm_path% build if errorlevel 1 exit 1 +.\build\gfortran_debug\example\demo-prog +if errorlevel 1 exit 1 + .\build\gfortran_debug\app\demo-prog if errorlevel 1 exit 1 diff --git a/ci/run_tests.sh b/ci/run_tests.sh index 8229d54..f1c4dff 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -60,6 +60,7 @@ cd ../hello_complex_2 cd ../with_examples "${f_fpm_path}" build +./build/gfortran_debug/example/demo-prog ./build/gfortran_debug/app/demo-prog cd ../auto_discovery_off diff --git a/example_packages/with_examples/app/demo-prog.f90 b/example_packages/with_examples/app/demo-prog.f90 new file mode 100644 index 0000000..f26e898 --- /dev/null +++ b/example_packages/with_examples/app/demo-prog.f90 @@ -0,0 +1,3 @@ +program demo + write(*, '(a)') "This is a simple program" +end program demo diff --git a/fpm/fpm.toml b/fpm/fpm.toml index 3179d2d..48f5b00 100644 --- a/fpm/fpm.toml +++ b/fpm/fpm.toml @@ -1,5 +1,5 @@ name = "fpm" -version = "0.1.2" +version = "0.1.3" license = "MIT" author = "fpm maintainers" maintainer = "" diff --git a/fpm/src/fpm_command_line.f90 b/fpm/src/fpm_command_line.f90 index 20932b5..a733fc2 100644 --- a/fpm/src/fpm_command_line.f90 +++ b/fpm/src/fpm_command_line.f90 @@ -126,7 +126,7 @@ contains case default ; os_type = "OS Type: UNKNOWN" end select version_text = [character(len=80) :: & - & 'Version: 0.1.2, alpha', & + & 'Version: 0.1.3, alpha', & & 'Program: fpm(1)', & & 'Description: A Fortran package manager and build system', & & 'Home Page: https://github.com/fortran-lang/fpm', & diff --git a/fpm/src/fpm_targets.f90 b/fpm/src/fpm_targets.f90 index fb5a8ac..34f437f 100644 --- a/fpm/src/fpm_targets.f90 +++ b/fpm/src/fpm_targets.f90 @@ -62,7 +62,7 @@ subroutine targets_from_sources(model,sources) type(srcfile_t), intent(in) :: sources(:) integer :: i - character(:), allocatable :: xsuffix + character(:), allocatable :: xsuffix, exe_dir type(build_target_t), pointer :: dep logical :: with_lib @@ -99,18 +99,24 @@ subroutine targets_from_sources(model,sources) source = sources(i) & ) - if (any(sources(i)%unit_scope == [FPM_SCOPE_APP, FPM_SCOPE_EXAMPLE])) then - call add_target(model%targets,type = FPM_TARGET_EXECUTABLE,& - link_libraries = sources(i)%link_libraries, & - output_file = join_path(model%output_directory,'app', & - sources(i)%exe_name//xsuffix)) + if (sources(i)%unit_scope == FPM_SCOPE_APP) then + + exe_dir = 'app' + + else if (sources(i)%unit_scope == FPM_SCOPE_EXAMPLE) then + + exe_dir = 'example' + else - call add_target(model%targets,type = FPM_TARGET_EXECUTABLE,& + + exe_dir = 'test' + + end if + + call add_target(model%targets,type = FPM_TARGET_EXECUTABLE,& link_libraries = sources(i)%link_libraries, & - output_file = join_path(model%output_directory,'test', & + output_file = join_path(model%output_directory,exe_dir, & sources(i)%exe_name//xsuffix)) - - end if ! Executable depends on object call add_dependency(model%targets(size(model%targets))%ptr, model%targets(size(model%targets)-1)%ptr) @@ -139,9 +145,6 @@ subroutine targets_from_sources(model,sources) object_file = canon_path(source%file_name) - ! Ignore first directory level - object_file = object_file(index(object_file,filesep)+1:) - ! Convert any remaining directory separators to underscores i = index(object_file,filesep) do while(i > 0) @@ -149,18 +152,7 @@ subroutine targets_from_sources(model,sources) i = index(object_file,filesep) end do - select case(source%unit_scope) - - case (FPM_SCOPE_APP, FPM_SCOPE_EXAMPLE) - object_file = join_path(model%output_directory,'app',object_file)//'.o' - - case (FPM_SCOPE_TEST) - object_file = join_path(model%output_directory,'test',object_file)//'.o' - - case default - object_file = join_path(model%output_directory,model%package_name,object_file)//'.o' - - end select + object_file = join_path(model%output_directory,model%package_name,object_file)//'.o' end function get_object_name |