@@ -206,7 +206,6 @@ SET(FTN_INTRINSICS
206206 mod.c
207207 mvbits3f.c
208208 nargs3f.c
209- omp_lib.F95
210209 outstr3f.c
211210 packtimeqq3f.c
212211 perror3f.c
@@ -273,7 +272,7 @@ SET(FTN_INTRINSICS
273272 wait3f.c
274273 )
275274
276- SET (FTN_SUPPORT
275+ SET (FTN_SUPPORT_COMMON
277276 bcopy.c
278277 bcopys.c
279278 buffer.c
@@ -338,13 +337,8 @@ SET(FTN_SUPPORT
338337 descIntrins.c
339338 descFioUtil.c
340339 descRW.c
341- ieee_arithmetic.F95
342- ieee_exceptions.F95
343- ieee_features.F95
344340 initpar.c
345341 inquire.c
346- iso_c_bind.F95
347- iso_fortran_env.f90
348342 ldread.c
349343 ldwrite.c
350344 linux_dummy.c
@@ -480,18 +474,46 @@ SET(FTN_SUPPORT
480474 xfer_rpm1.c
481475 )
482476
483- add_library (iso_c_bind OBJECT
484- iso_c_bind.F95
485- )
477+ foreach (FTN_FILE ieee_arithmetic ieee_exceptions ieee_features iso_c_bind omp_lib)
478+ configure_file (${FTN_FILE} .F95 ${FTN_FILE} _static.F95 COPYONLY )
479+ endforeach ()
480+ configure_file (iso_fortran_env.f90 iso_fortran_env_static.f90 COPYONLY )
486481
487- add_library (ieee_arithmetic OBJECT
482+ SET (FTN_SUPPORT_SHARED
488483 ieee_arithmetic.F95
489484 ieee_exceptions.F95
485+ iso_c_bind.F95
486+ ieee_features.F95
487+ iso_fortran_env.f90
488+ )
489+
490+ SET (FTN_SUPPORT_STATIC
491+ ieee_arithmetic_static.F95
492+ ieee_exceptions_static.F95
493+ iso_c_bind_static.F95
494+ ieee_features_static.F95
495+ iso_fortran_env_static.f90
496+ )
497+
498+ SET (FTN_SUPPORT
499+ ${FTN_SUPPORT_STATIC}
500+ ${FTN_SUPPORT_SHARED}
501+ ${FTN_SUPPORT_COMMON}
502+ )
503+
504+ SET (FTN_INTRINSICS_STATIC
505+ omp_lib_static.F95
506+ )
507+
508+ SET (FTN_INTRINSICS_SHARED
509+ omp_lib_static.F95
490510)
491511
492512add_flang_library(flang_static
493513 ${FTN_INTRINSICS}
494- ${FTN_SUPPORT}
514+ ${FTN_INTRINSICS_STATIC}
515+ ${FTN_SUPPORT_COMMON}
516+ ${FTN_SUPPORT_STATIC}
495517 ${SHARED_SOURCES}
496518 )
497519
@@ -501,10 +523,30 @@ else()
501523 set_property (TARGET flang_static PROPERTY OUTPUT_NAME flang)
502524endif ()
503525
526+ set_target_properties (flang_static PROPERTIES Fortran_MODULE_DIRECTORY ${FLANG_MODULE_DIRECTORY_STATIC} )
527+
528+ # State the module that the source is producing
529+ set_source_files_properties (
530+ iso_c_bind_static.F95
531+ PROPERTIES
532+ OBJECT_OUTPUTS ${FLANG_MODULE_DIRECTORY_STATIC} /iso_c_binding.mod
533+ )
534+
535+ # State a dependency on the module
536+ set_source_files_properties (
537+ ieee_arithmetic_static.F95
538+ ieee_exceptions_static.F95
539+ PROPERTIES
540+ OBJECT_DEPENDS ${FLANG_MODULE_DIRECTORY_STATIC} /iso_c_binding.mod
541+ )
542+
504543set (SHARED_LIBRARY TRUE )
544+
505545add_flang_library(flang_shared
506546 ${FTN_INTRINSICS}
507- ${FTN_SUPPORT}
547+ ${FTN_INTRINSICS_SHARED}
548+ ${FTN_SUPPORT_COMMON}
549+ ${FTN_SUPPORT_SHARED}
508550 ${SHARED_SOURCES}
509551 )
510552set_property (TARGET flang_shared PROPERTY OUTPUT_NAME flang)
@@ -515,6 +557,22 @@ if (NOT MSVC)
515557else ()
516558 set_target_properties (flang_shared PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE )
517559endif ()
560+ set_target_properties (flang_shared PROPERTIES Fortran_MODULE_DIRECTORY ${FLANG_MODULE_DIRECTORY_SHARED} )
561+
562+ # State the module that the source is producing
563+ set_source_files_properties (
564+ iso_c_bind.F95
565+ PROPERTIES
566+ OBJECT_OUTPUTS ${FLANG_MODULE_DIRECTORY_SHARED} /iso_c_binding.mod
567+ )
568+
569+ # State a dependency on the module
570+ set_source_files_properties (
571+ ieee_arithmetic.F95
572+ ieee_exceptions.F95
573+ PROPERTIES
574+ OBJECT_DEPENDS ${FLANG_MODULE_DIRECTORY_SHARED} /iso_c_binding.mod
575+ )
518576
519577set (SHARED_LIBRARY FALSE )
520578
@@ -579,25 +637,14 @@ target_include_directories(flang_shared
579637add_dependencies (flang_static
580638 flang1
581639 flang2
582- ieee_arithmetic
583640 )
584641
585642# Make sure the compiler is built before we bootstrap
586643add_dependencies (flang_shared
587644 flang1
588645 flang2
589- ieee_arithmetic
590646 )
591647
592- add_dependencies (iso_c_bind
593- flang1
594- flang2
595- )
596-
597- add_dependencies (ieee_arithmetic
598- iso_c_bind
599- )
600-
601648if (NOT MSVC )
602649 target_compile_options (flang_static PRIVATE -fPIC)
603650 target_compile_options (flang_shared PRIVATE -fPIC)
0 commit comments