aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fpm_backend.f908
-rw-r--r--src/fpm_targets.f909
2 files changed, 12 insertions, 5 deletions
diff --git a/src/fpm_backend.f90 b/src/fpm_backend.f90
index 74cef61..be4c4c9 100644
--- a/src/fpm_backend.f90
+++ b/src/fpm_backend.f90
@@ -30,8 +30,8 @@ module fpm_backend
use fpm_environment, only: run
use fpm_filesystem, only: dirname, join_path, exists, mkdir
use fpm_model, only: fpm_model_t
-use fpm_targets, only: build_target_t, build_target_ptr, &
- FPM_TARGET_OBJECT, FPM_TARGET_ARCHIVE, FPM_TARGET_EXECUTABLE
+use fpm_targets, only: build_target_t, build_target_ptr, FPM_TARGET_OBJECT, &
+ FPM_TARGET_C_OBJECT, FPM_TARGET_ARCHIVE, FPM_TARGET_EXECUTABLE
use fpm_strings, only: string_cat
@@ -241,6 +241,10 @@ subroutine build_target(model,target)
call run(model%fortran_compiler//" -c " // target%source%file_name // target%compile_flags &
// " -o " // target%output_file)
+ case (FPM_TARGET_C_OBJECT)
+ call run(model%c_compiler//" -c " // target%source%file_name &
+ // " -o " // target%output_file)
+
case (FPM_TARGET_EXECUTABLE)
call run(model%fortran_compiler// " " // target%compile_flags &
diff --git a/src/fpm_targets.f90 b/src/fpm_targets.f90
index 02bb600..6d4d8f0 100644
--- a/src/fpm_targets.f90
+++ b/src/fpm_targets.f90
@@ -35,7 +35,8 @@ implicit none
private
public FPM_TARGET_UNKNOWN, FPM_TARGET_EXECUTABLE, &
- FPM_TARGET_ARCHIVE, FPM_TARGET_OBJECT
+ FPM_TARGET_ARCHIVE, FPM_TARGET_OBJECT, &
+ FPM_TARGET_C_OBJECT
public build_target_t, build_target_ptr
public targets_from_sources, resolve_module_dependencies
public resolve_target_linking, add_target, add_dependency
@@ -50,7 +51,8 @@ integer, parameter :: FPM_TARGET_EXECUTABLE = 1
integer, parameter :: FPM_TARGET_ARCHIVE = 2
!> Target type is compiled object
integer, parameter :: FPM_TARGET_OBJECT = 3
-
+!> Target type is c compiled object
+integer, parameter :: FPM_TARGET_C_OBJECT = 4
!> Wrapper type for constructing arrays of `[[build_target_t]]` pointers
type build_target_ptr
@@ -194,7 +196,8 @@ subroutine build_target_list(targets,model)
case (FPM_UNIT_MODULE,FPM_UNIT_SUBMODULE,FPM_UNIT_SUBPROGRAM,FPM_UNIT_CSOURCE)
call add_target(targets,source = sources(i), &
- type = FPM_TARGET_OBJECT,&
+ type = merge(FPM_TARGET_C_OBJECT,FPM_TARGET_OBJECT,&
+ sources(i)%unit_type==FPM_UNIT_CSOURCE), &
output_file = get_object_name(sources(i)))
if (with_lib .and. sources(i)%unit_scope == FPM_SCOPE_LIB) then