Michał Górny c30a7f4594
[flang] Fix standalone builds against installed MLIR (#126387)
1. Add a new `MLIR_DEPS` argument group to `flang_add_library()`, and
move MLIR-specific dependencies to that group. These dependencies are
added as usual in regular builds, and are skipped in standalone builds,
since MLIR targets are not visible there (and were already built and
installed).
2. Fix the value of `MLIR_MAIN_SRC_DIR` to refer to the current source
directory rather than the directory written into MLIR CMake files. The
latter refers to the directory used to build the MLIR package, and is no
longer valid.
3. Fix non-dylib friendly linking of `LLVMTargetParser` in `Optimizer`
unittests.

With these changes, I can successfully run Flang's regression tests.
2025-02-15 07:15:00 +00:00

42 lines
674 B
CMake

get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
add_flang_library(HLFIRTransforms
BufferizeHLFIR.cpp
ConvertToFIR.cpp
InlineElementals.cpp
InlineHLFIRAssign.cpp
LowerHLFIRIntrinsics.cpp
LowerHLFIROrderedAssignments.cpp
ScheduleOrderedAssignments.cpp
SimplifyHLFIRIntrinsics.cpp
OptimizedBufferization.cpp
DEPENDS
CUFAttrsIncGen
FIRDialect
HLFIROpsIncGen
LINK_LIBS
CUFAttrs
FIRAnalysis
FIRDialect
FIRBuilder
FIRDialectSupport
FIRSupport
FIRTransforms
FlangOpenMPTransforms
HLFIRDialect
LINK_COMPONENTS
AsmParser
AsmPrinter
Remarks
MLIR_DEPS
${dialect_libs}
MLIR_LIBS
MLIRIR
${dialect_libs}
)