Files
clang-p2996/mlir/lib/CAPI/CMakeLists.txt
Stella Laurenzo cceb1bfcbb [mlir][CAPI] Introduce standard source layout for mlir-c dialect registration.
* Registers a small set of sample dialects.
* NFC with respect to existing C-API symbols but some headers have been moved down a level to the Dialect/ sub-directory.
* Adds an additional entry point per dialect that is needed for dynamic discovery/loading.
* See discussion: https://llvm.discourse.group/t/dialects-and-the-c-api/2306/16

Differential Revision: https://reviews.llvm.org/D94370
2021-01-11 12:35:49 -08:00

42 lines
1.2 KiB
CMake

add_subdirectory(IR)
add_subdirectory(Registration)
add_subdirectory(Dialect)
add_subdirectory(Transforms)
################################################################################
# libMLIRPublicAPI shared library/DLL.
################################################################################
get_property(public_api_libs GLOBAL PROPERTY MLIR_PUBLIC_C_API_LIBS)
foreach(lib ${public_api_libs})
if(XCODE)
# Xcode doesn't support object libraries, so we have to trick it into
# linking the static libraries instead.
list(APPEND _DEPS "-force_load" ${lib})
else()
list(APPEND _OBJECTS $<TARGET_OBJECTS:obj.${lib}>)
endif()
# Accumulate transitive deps of each exported lib into _DEPS.
list(APPEND _DEPS $<TARGET_PROPERTY:${lib},LINK_LIBRARIES>)
endforeach()
add_mlir_library(MLIRPublicAPI
SHARED
${_OBJECTS}
EXCLUDE_FROM_LIBMLIR
LINK_LIBS
# Dependency on the implementation shared library.
$<$<BOOL:${LLVM_BUILD_LLVM_DYLIB}>:MLIR>
${_DEPS}
)
target_link_options(
MLIRPublicAPI
PRIVATE
# On Linux, disable re-export of any static linked libraries that
# came through.
$<$<PLATFORM_ID:Linux>:LINKER:--exclude-libs,ALL>
)