[Mlir-commits] [mlir] 66fc381 - [MLIR] Patch StandalonePlugin CMake for MacOS

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Apr 17 17:59:57 PDT 2023


Author: max
Date: 2023-04-17T19:59:08-05:00
New Revision: 66fc381af3b2eac71a8a4779e23b266841e21f23

URL: https://github.com/llvm/llvm-project/commit/66fc381af3b2eac71a8a4779e23b266841e21f23
DIFF: https://github.com/llvm/llvm-project/commit/66fc381af3b2eac71a8a4779e23b266841e21f23.diff

LOG: [MLIR] Patch StandalonePlugin CMake for MacOS

Differential Revision: https://reviews.llvm.org/D148058

Added: 
    

Modified: 
    mlir/examples/standalone/lib/Standalone/CMakeLists.txt
    mlir/examples/standalone/standalone-plugin/CMakeLists.txt
    mlir/examples/standalone/test/CMakeLists.txt
    mlir/examples/standalone/test/Standalone/standalone-pass-plugin.mlir
    mlir/examples/standalone/test/Standalone/standalone-plugin.mlir
    mlir/examples/standalone/test/lit.cfg.py
    mlir/examples/standalone/test/lit.site.cfg.py.in
    mlir/test/Examples/standalone/test.toy

Removed: 
    


################################################################################
diff  --git a/mlir/examples/standalone/lib/Standalone/CMakeLists.txt b/mlir/examples/standalone/lib/Standalone/CMakeLists.txt
index 0e2d043665c3c..0f1705a25c8c8 100644
--- a/mlir/examples/standalone/lib/Standalone/CMakeLists.txt
+++ b/mlir/examples/standalone/lib/Standalone/CMakeLists.txt
@@ -11,8 +11,8 @@ add_mlir_dialect_library(MLIRStandalone
         MLIRStandaloneOpsIncGen
         MLIRStandalonePassesIncGen
 
-	LINK_LIBS PUBLIC
-	MLIRIR
+        LINK_LIBS PUBLIC
+        MLIRIR
         MLIRInferTypeOpInterface
         MLIRFuncDialect
-	)
+        )

diff  --git a/mlir/examples/standalone/standalone-plugin/CMakeLists.txt b/mlir/examples/standalone/standalone-plugin/CMakeLists.txt
index 961a3ea2c906f..16ac0ccf74459 100644
--- a/mlir/examples/standalone/standalone-plugin/CMakeLists.txt
+++ b/mlir/examples/standalone/standalone-plugin/CMakeLists.txt
@@ -1,22 +1,18 @@
-get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
-get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
-set(LIBS
-        MLIRIR
-        MLIRPass
-        MLIRPluginsLib
-        MLIRStandalone
-        MLIRTransformUtils
-        )
-
-add_mlir_dialect_library(StandalonePlugin
-        SHARED
+add_llvm_library(StandalonePlugin
+        # BUILDTREE_ONLY is only for testing purposes
+        MODULE BUILDTREE_ONLY
         standalone-plugin.cpp
 
         DEPENDS
         MLIRStandalone
-        )
+        PLUGIN_TOOL
+        mlir-opt
 
-llvm_update_compile_flags(StandalonePlugin)
-target_link_libraries(StandalonePlugin PRIVATE ${LIBS})
-
-mlir_check_all_link_libraries(StandalonePlugin)
+        LINK_LIBS
+        MLIRStandalone
+        )
+target_include_directories(
+        StandalonePlugin
+        PRIVATE
+        "${STANDALONE_BINARY_DIR}/include"
+)

diff  --git a/mlir/examples/standalone/test/CMakeLists.txt b/mlir/examples/standalone/test/CMakeLists.txt
index d47ba932f5ad2..fdde159064287 100644
--- a/mlir/examples/standalone/test/CMakeLists.txt
+++ b/mlir/examples/standalone/test/CMakeLists.txt
@@ -14,6 +14,7 @@ set(STANDALONE_TEST_DEPENDS
         standalone-capi-test
         standalone-opt
         standalone-translate
+        StandalonePlugin
         )
 if(MLIR_ENABLE_BINDINGS_PYTHON)
   list(APPEND STANDALONE_TEST_DEPENDS StandalonePythonModules)

diff  --git a/mlir/examples/standalone/test/Standalone/standalone-pass-plugin.mlir b/mlir/examples/standalone/test/Standalone/standalone-pass-plugin.mlir
index 5af4b3d92e34e..1d652dc45830c 100644
--- a/mlir/examples/standalone/test/Standalone/standalone-pass-plugin.mlir
+++ b/mlir/examples/standalone/test/Standalone/standalone-pass-plugin.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt %s --load-pass-plugin=%standalone_libs/libStandalonePlugin.so --pass-pipeline="builtin.module(standalone-switch-bar-foo)" | FileCheck %s
+// RUN: mlir-opt %s --load-pass-plugin=%standalone_libs/StandalonePlugin%shlibext --pass-pipeline="builtin.module(standalone-switch-bar-foo)" | FileCheck %s
 
 module {
   // CHECK-LABEL: func @foo()

diff  --git a/mlir/examples/standalone/test/Standalone/standalone-plugin.mlir b/mlir/examples/standalone/test/Standalone/standalone-plugin.mlir
index 3f935db8910c2..468932b81a529 100644
--- a/mlir/examples/standalone/test/Standalone/standalone-plugin.mlir
+++ b/mlir/examples/standalone/test/Standalone/standalone-plugin.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt %s --load-dialect-plugin=%standalone_libs/libStandalonePlugin.so --pass-pipeline="builtin.module(standalone-switch-bar-foo)" | FileCheck %s
+// RUN: mlir-opt %s --load-dialect-plugin=%standalone_libs/StandalonePlugin%shlibext --pass-pipeline="builtin.module(standalone-switch-bar-foo)" | FileCheck %s
 
 module {
   // CHECK-LABEL: func @foo()

diff  --git a/mlir/examples/standalone/test/lit.cfg.py b/mlir/examples/standalone/test/lit.cfg.py
index 3e4ceee3865c3..601ac8f769f93 100644
--- a/mlir/examples/standalone/test/lit.cfg.py
+++ b/mlir/examples/standalone/test/lit.cfg.py
@@ -30,6 +30,7 @@
 config.test_exec_root = os.path.join(config.standalone_obj_root, 'test')
 
 config.substitutions.append(('%PATH%', config.environment['PATH']))
+config.substitutions.append(('%shlibext', config.llvm_shlib_ext))
 
 llvm_config.with_system_environment(
     ['HOME', 'INCLUDE', 'LIB', 'TMP', 'TEMP'])

diff  --git a/mlir/examples/standalone/test/lit.site.cfg.py.in b/mlir/examples/standalone/test/lit.site.cfg.py.in
index 9a81c6b48343c..eae93d0b122e3 100644
--- a/mlir/examples/standalone/test/lit.site.cfg.py.in
+++ b/mlir/examples/standalone/test/lit.site.cfg.py.in
@@ -4,6 +4,7 @@ config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@")
 config.mlir_obj_dir = "@MLIR_BINARY_DIR@"
 config.enable_bindings_python = @MLIR_ENABLE_BINDINGS_PYTHON@
 config.standalone_obj_root = "@STANDALONE_BINARY_DIR@"
+config.llvm_shlib_ext = "@SHLIBEXT@"
 
 import lit.llvm
 lit.llvm.initialize(lit_config, config)

diff  --git a/mlir/test/Examples/standalone/test.toy b/mlir/test/Examples/standalone/test.toy
index 08157297ba9f5..c91b3cf8a50f2 100644
--- a/mlir/test/Examples/standalone/test.toy
+++ b/mlir/test/Examples/standalone/test.toy
@@ -1,9 +1,9 @@
-# RUN: %cmake_exe %mlir_src_root/examples/standalone -G "%cmake_generator" \
+# RUN: "%cmake_exe" "%mlir_src_root/examples/standalone" -G "%cmake_generator" \
 # RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \
 # RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx -DMLIR_DIR=%mlir_cmake_dir \
 # RUN: -DLLVM_USE_LINKER=%llvm_use_linker \
 # RUN: -DPython3_EXECUTABLE=%python
-# RUN: %cmake_exe --build . --target check-standalone | tee %t | FileCheck %s
+# RUN: "%cmake_exe" --build . --target check-standalone | tee %t | FileCheck %s
 
 # Note: The number of checked tests is not important. The command will fail
 # if any fail.


        


More information about the Mlir-commits mailing list