Skip to content

Commit cc46713

Browse files
authored
Merge pull request #105 from isuruf/cleanup
CMake: Cleanup depedency issues
2 parents d3355df + 4fd82ac commit cc46713

File tree

2 files changed

+19
-81
lines changed

2 files changed

+19
-81
lines changed

CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,10 @@ include_directories(BEFORE
361361
)
362362

363363
# Direct module files to build include directory
364-
set(FLANG_MODULE_DIRECTORY_SHARED ${CMAKE_CURRENT_BINARY_DIR}/include)
365-
# mod files in the following differs only by the timestamp. This is needed to
366-
# ensure that flang can be built parallelly. It is discarded after flang is built
367-
set(FLANG_MODULE_DIRECTORY_STATIC ${CMAKE_CURRENT_BINARY_DIR}/include-static)
364+
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include)
368365

369366
# Install Fortran module files
370-
install(DIRECTORY ${FLANG_MODULE_DIRECTORY_SHARED}/
367+
install(DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/
371368
DESTINATION include
372369
)
373370

runtime/flang/CMakeLists.txt

Lines changed: 17 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ SET(FTN_INTRINSICS
273273
wait3f.c
274274
)
275275

276-
SET(FTN_SUPPORT_COMMON
276+
SET(FTN_SUPPORT
277277
bcopy.c
278278
bcopys.c
279279
buffer.c
@@ -475,34 +475,14 @@ SET(FTN_SUPPORT_COMMON
475475
xfer.c
476476
init.c
477477
xfer_rpm1.c
478-
)
479-
480-
foreach(FTN_FILE ieee_arithmetic ieee_exceptions iso_c_bind)
481-
configure_file(${FTN_FILE}.F95 ${FTN_FILE}_static.F95 COPYONLY)
482-
endforeach()
483-
484-
SET(FTN_SUPPORT_SHARED
485478
ieee_arithmetic.F95
486479
ieee_exceptions.F95
487480
iso_c_bind.F95
488-
)
489-
490-
SET(FTN_SUPPORT_STATIC
491-
ieee_arithmetic_static.F95
492-
ieee_exceptions_static.F95
493-
iso_c_bind_static.F95
494-
)
495-
496-
SET(FTN_SUPPORT
497-
${FTN_SUPPORT_STATIC}
498-
${FTN_SUPPORT_SHARED}
499-
${FTN_SUPPORT_COMMON}
500-
)
481+
)
501482

502483
add_flang_library(flang_static
503484
${FTN_INTRINSICS}
504-
${FTN_SUPPORT_COMMON}
505-
${FTN_SUPPORT_STATIC}
485+
${FTN_SUPPORT}
506486
${SHARED_SOURCES}
507487
)
508488

@@ -512,81 +492,33 @@ else()
512492
set_property(TARGET flang_static PROPERTY OUTPUT_NAME flang)
513493
endif()
514494

515-
set_target_properties(flang_static PROPERTIES Fortran_MODULE_DIRECTORY ${FLANG_MODULE_DIRECTORY_STATIC})
516-
517-
if (NOT "${CMAKE_GENERATOR}" STREQUAL "Ninja")
518-
# State the module that the source is producing
519-
set_source_files_properties(
520-
iso_c_bind_static.F95
521-
PROPERTIES
522-
OBJECT_OUTPUTS ${FLANG_MODULE_DIRECTORY_STATIC}/iso_c_binding.mod
523-
)
524-
525-
# State a dependency on the module
526-
set_source_files_properties(
527-
ieee_arithmetic_static.F95
528-
ieee_exceptions_static.F95
529-
PROPERTIES
530-
OBJECT_DEPENDS ${FLANG_MODULE_DIRECTORY_STATIC}/iso_c_binding.mod
531-
)
532-
else()
533495
add_library(iso_c_bind OBJECT
534496
iso_c_bind.F95
535497
)
498+
536499
add_library(ieee_arithmetic OBJECT
537500
ieee_arithmetic.F95
538501
ieee_exceptions.F95
539502
)
540-
add_dependencies(iso_c_bind
541-
flang1
542-
flang2
543-
)
544-
add_dependencies(ieee_arithmetic
545-
iso_c_bind
546-
)
547-
add_dependencies(flang_static
548-
ieee_arithmetic
549-
)
550-
endif()
551503

552504
set(SHARED_LIBRARY TRUE)
553505

554506
add_flang_library(flang_shared
555507
${FTN_INTRINSICS}
556-
${FTN_SUPPORT_COMMON}
557-
${FTN_SUPPORT_SHARED}
508+
${FTN_SUPPORT}
558509
${SHARED_SOURCES}
559510
)
511+
560512
set_property(TARGET flang_shared PROPERTY OUTPUT_NAME flang)
561513
target_link_libraries(flang_shared flangrti_shared)
514+
562515
# Resolve symbols against libm and librt
563516
if (NOT MSVC)
564517
target_link_libraries(flang_shared rt m)
565518
else()
566519
set_target_properties(flang_shared PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
567520
endif()
568-
set_target_properties(flang_shared PROPERTIES Fortran_MODULE_DIRECTORY ${FLANG_MODULE_DIRECTORY_SHARED})
569521

570-
if (NOT "${CMAKE_GENERATOR}" STREQUAL "Ninja")
571-
# State the module that the source is producing
572-
set_source_files_properties(
573-
iso_c_bind.F95
574-
PROPERTIES
575-
OBJECT_OUTPUTS ${FLANG_MODULE_DIRECTORY_SHARED}/iso_c_binding.mod
576-
)
577-
578-
# State a dependency on the module
579-
set_source_files_properties(
580-
ieee_arithmetic.F95
581-
ieee_exceptions.F95
582-
PROPERTIES
583-
OBJECT_DEPENDS ${FLANG_MODULE_DIRECTORY_SHARED}/iso_c_binding.mod
584-
)
585-
else()
586-
add_dependencies(flang_shared
587-
ieee_arithmetic
588-
)
589-
endif()
590522
set(SHARED_LIBRARY FALSE)
591523

592524
set_property(
@@ -650,13 +582,22 @@ target_include_directories(flang_shared
650582
add_dependencies(flang_static
651583
flang1
652584
flang2
585+
ieee_arithmetic
653586
)
654587

655588
# Make sure the compiler is built before we bootstrap
656589
add_dependencies(flang_shared
590+
flang_static
591+
)
592+
593+
add_dependencies(iso_c_bind
657594
flang1
658595
flang2
659-
)
596+
)
597+
598+
add_dependencies(ieee_arithmetic
599+
iso_c_bind
600+
)
660601

661602
if (NOT MSVC)
662603
target_compile_options(flang_static PRIVATE -fPIC)

0 commit comments

Comments
 (0)