[flang] Use the Flang cmake-functions to add targets.

Summary: It also removes the cycle-dependency between FortranSemantics and FortranEvaluate.

Reviewers: #flang, jdoerfert, sscalpone

Reviewed By: #flang, sscalpone

Subscribers: DavidTruby, schweitz, tskeith, mgorny, aartbik, llvm-commits

Tags: #flang, #llvm

Differential Revision: https://reviews.llvm.org/D78215
This commit is contained in:
Mehdi Chinoune 2020-04-16 13:34:17 +01:00 committed by David Truby
parent 30d5946db9
commit 2d6b9dbfef
13 changed files with 38 additions and 98 deletions

View file

@ -109,7 +109,6 @@ macro(add_flang_tool name)
endif()
add_flang_executable(${name} ${ARGN})
add_dependencies(${name} flang-resource-headers)
if (FLANG_BUILD_TOOLS)
set(export_to_flangtargets)

View file

@ -1,15 +1,10 @@
add_library(FortranCommon
add_flang_library(FortranCommon
Fortran.cpp
Fortran-features.cpp
default-kinds.cpp
idioms.cpp
)
target_compile_features(FortranCommon PUBLIC cxx_std_17)
install (TARGETS FortranCommon
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
LINK_COMPONENTS
Support
)

View file

@ -1,13 +1,5 @@
add_library(FortranDecimal
add_flang_library(FortranDecimal
binary-to-decimal.cpp
decimal-to-binary.cpp
)
target_compile_features(FortranDecimal PUBLIC cxx_std_17)
install (TARGETS FortranDecimal
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

View file

@ -1,5 +1,5 @@
add_library(FortranEvaluate
add_flang_library(FortranEvaluate
call.cpp
characteristics.cpp
check-expression.cpp
@ -25,23 +25,13 @@ add_library(FortranEvaluate
tools.cpp
type.cpp
variable.cpp
)
target_compile_features(FortranEvaluate PUBLIC cxx_std_17)
target_link_libraries(FortranEvaluate
LINK_LIBS
FortranCommon
FortranDecimal
FortranSemantics
FortranParser
)
install (TARGETS FortranEvaluate
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
if (LIBPGMATH_DIR)
# If pgmath library is found, it can be used for constant folding.
find_library(LIBPGMATH pgmath PATHS ${LIBPGMATH_DIR})

View file

@ -1,13 +1,7 @@
add_library(FortranLower
add_flang_library(FortranLower
PFTBuilder.cpp
)
target_link_libraries(FortranLower
LLVMSupport
)
install (TARGETS FortranLower
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
LINK_COMPONENTS
Support
)

View file

@ -1,13 +1,14 @@
add_llvm_library(FIRDialect
add_flang_library(FIRDialect
FIRAttr.cpp
FIRDialect.cpp
FIROps.cpp
FIRType.cpp
)
add_dependencies(FIRDialect FIROpsIncGen)
DEPENDS
FIROpsIncGen
target_link_libraries(FIRDialect
LINK_LIBS
FIRSupport
MLIRTargetLLVMIR
MLIRTargetLLVMIRModuleTranslation
MLIREDSC
@ -16,12 +17,9 @@ target_link_libraries(FIRDialect
MLIRSupport
MLIRStandardToLLVM
MLIRTransforms
LLVMAsmParser
LLVMAsmPrinter
LLVMRemarks
)
install (TARGETS FIRDialect
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
LINK_COMPONENTS
AsmParser
AsmPrinter
Remarks
)

View file

@ -1,10 +1,8 @@
add_llvm_library(FIRSupport
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
add_flang_library(FIRSupport
KindMapping.cpp
)
target_link_libraries(FIRSupport FIRDialect)
install (TARGETS FIRSupport
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
LINK_LIBS
${dialect_libs}
)

View file

@ -1,5 +1,5 @@
add_library(FortranParser
add_flang_library(FortranParser
Fortran-parsers.cpp
char-buffer.cpp
char-block.cpp
@ -23,17 +23,10 @@ add_library(FortranParser
tools.cpp
unparse.cpp
user-state.cpp
)
target_compile_features(FortranParser PRIVATE cxx_std_17)
target_link_libraries(FortranParser
LINK_LIBS
FortranCommon
LLVMSupport
)
install (TARGETS FortranParser
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
LINK_COMPONENTS
Support
)

View file

@ -1,5 +1,5 @@
add_library(FortranSemantics
add_flang_library(FortranSemantics
assignment.cpp
attr.cpp
canonicalize-do.cpp
@ -35,18 +35,11 @@ add_library(FortranSemantics
tools.cpp
type.cpp
unparse-with-symbols.cpp
)
target_compile_features(FortranSemantics PUBLIC cxx_std_17)
target_link_libraries(FortranSemantics
LINK_LIBS
FortranCommon
FortranEvaluate
LLVMSupport
)
install (TARGETS FortranSemantics
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
LINK_COMPONENTS
Support
)

View file

@ -26,7 +26,7 @@ endif()
configure_file(config.h.cmake config.h)
add_library(FortranRuntime
add_flang_library(FortranRuntime
ISO_Fortran_binding.cpp
allocatable.cpp
buffer.cpp
@ -53,12 +53,7 @@ add_library(FortranRuntime
type-code.cpp
unit.cpp
unit-map.cpp
)
target_include_directories(FortranRuntime
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(FortranRuntime
LINK_LIBS
FortranDecimal
)

View file

@ -1,13 +1,9 @@
add_llvm_tool(f18-parse-demo
add_flang_tool(f18-parse-demo
f18-parse-demo.cpp
stub-evaluate.cpp
)
set_property(TARGET f18-parse-demo PROPERTY CXX_STANDARD 17)
target_compile_features(f18-parse-demo PRIVATE cxx_std_17)
)
target_link_libraries(f18-parse-demo
PRIVATE
FortranParser
)
#install(TARGETS f18-parse-demo DESTINATION bin)

View file

@ -1,9 +1,7 @@
add_llvm_tool(f18
add_flang_tool(f18
dump.cpp
f18.cpp
)
set_property(TARGET f18 PROPERTY CXX_STANDARD 17)
target_compile_features(f18 PRIVATE cxx_std_17)
target_link_libraries(f18
PRIVATE

View file

@ -19,6 +19,5 @@ set(LIBS
MLIRVectorToLLVM
)
add_llvm_tool(tco tco.cpp)
llvm_update_compile_flags(tco)
add_flang_tool(tco tco.cpp)
target_link_libraries(tco PRIVATE ${LIBS})