1 # For upstream, we accumulate all libraries into the MLIR_CAPI_LIBS
2 # property via a custom wrapper function. This is then used to create an
4 set_property(GLOBAL APPEND PROPERTY MLIR_CAPI_LIBS)
5 function(add_mlir_upstream_c_api_library name)
6 add_mlir_public_c_api_library(${name} ${ARGN})
7 set_property(GLOBAL APPEND PROPERTY MLIR_CAPI_LIBS ${name})
10 add_subdirectory(Debug)
11 add_subdirectory(Dialect)
12 add_subdirectory(Conversion)
13 add_subdirectory(Interfaces)
15 add_subdirectory(RegisterEverything)
16 add_subdirectory(Transforms)
17 add_subdirectory(Target)
19 if(MLIR_ENABLE_EXECUTION_ENGINE)
20 add_subdirectory(ExecutionEngine)
23 # Build the optional CAPI dylib.
24 if(MLIR_BUILD_MLIR_C_DYLIB)
25 message(STATUS "Building MLIR-C dylib")
26 get_property(_capi_libraries GLOBAL PROPERTY MLIR_CAPI_LIBS)
27 add_mlir_aggregate(MLIR-C
32 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
33 target_link_options(MLIR-C PRIVATE "-Wl,-exclude-libs,ALL")
35 if(NOT CMAKE_C_VISIBILITY_PRESET STREQUAL "hidden" OR NOT CMAKE_CXX_VISIBILITY_PRESET STREQUAL "hidden")
36 message(STATUS "MLIR-C on this platform exports all symbols. Recommend building with CMAKE_(C|CXX)_VISIBILITY_PRESET=hidden or implement filtering support.")