40 lines · plain
1# For upstream, we accumulate all libraries into the MLIR_CAPI_LIBS2# property via a custom wrapper function. This is then used to create an3# aggregate below.4set_property(GLOBAL APPEND PROPERTY MLIR_CAPI_LIBS)5function(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})8endfunction()9 10add_subdirectory(Debug)11add_subdirectory(Dialect)12add_subdirectory(Conversion)13add_subdirectory(Interfaces)14add_subdirectory(IR)15add_subdirectory(RegisterEverything)16add_subdirectory(Transforms)17add_subdirectory(Target)18 19if(MLIR_ENABLE_EXECUTION_ENGINE)20 add_subdirectory(ExecutionEngine)21endif()22 23# Build the optional CAPI dylib.24if(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-C28 SHARED29 EMBED_LIBS30 ${_capi_libraries}31 )32 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")33 target_link_options(MLIR-C PRIVATE "-Wl,-exclude-libs,ALL")34 else()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.")37 endif()38 endif()39endif()40