brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · a33c70c Raw
54 lines · plain
1# Building libmlir-cpp.so fails if LLVM_ENABLE_PIC=Off2if (NOT LLVM_ENABLE_PIC)3  return()4endif()5 6# Building libmlir-cpp.so may not work on MSVC7if (MSVC)8  return()9endif()10 11get_property(mlir_libs GLOBAL PROPERTY MLIR_STATIC_LIBS)12get_property(mlir_llvm_link_components GLOBAL PROPERTY MLIR_LLVM_LINK_COMPONENTS)13list(REMOVE_DUPLICATES mlir_libs)14list(REMOVE_DUPLICATES mlir_llvm_link_components)15 16foreach (lib ${mlir_libs})17  if(XCODE)18    # Xcode doesn't support object libraries, so we have to trick it into19    # linking the static libraries instead.20    list(APPEND _DEPS "-force_load" ${lib})21  else()22    list(APPEND _OBJECTS $<TARGET_OBJECTS:obj.${lib}>)23  endif()24  # libClang needs this, but it causes problems for MLIR (probably25  # because we use public library dependencies within MLIR.)26  # list(APPEND _DEPS  $<TARGET_PROPERTY:${lib},LINK_LIBRARIES>)27endforeach ()28 29if(MLIR_LINK_MLIR_DYLIB)30  set(INSTALL_WITH_TOOLCHAIN INSTALL_WITH_TOOLCHAIN)31endif()32 33if(LLVM_BUILD_LLVM_DYLIB)34  add_mlir_library(35    MLIR36    SHARED37    EXCLUDE_FROM_LIBMLIR38    ${INSTALL_WITH_TOOLCHAIN}39    mlir-shlib.cpp40    ${_OBJECTS}41    LINK_LIBS42    ${_DEPS}43 44    LINK_COMPONENTS45    ${mlir_llvm_link_components}46  )47  target_link_libraries(MLIR PRIVATE ${LLVM_PTHREAD_LIB})48endif()49 50#message("Libraries included in libMLIR.so: ${mlir_libs}")51#message("LLVM Components included in libMLIR.so: ${mlir_llvm_link_components}")52 53mlir_check_all_link_libraries(MLIR)54