3 # Specifies that all MLIR packages are co-located under the `mlir_standalone`
4 # top level package (the API has been embedded in a relocatable way).
5 # TODO: Add an upstream cmake param for this vs having a global here.
6 add_compile_definitions("MLIR_PYTHON_PACKAGE_PREFIX=mlir_standalone.")
9 ################################################################################
11 ################################################################################
13 declare_mlir_python_sources(StandalonePythonSources)
15 declare_mlir_dialect_python_bindings(
16 ADD_TO_PARENT StandalonePythonSources
17 ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir_standalone"
18 TD_FILE dialects/StandaloneOps.td
20 dialects/standalone.py
21 DIALECT_NAME standalone)
23 declare_mlir_python_extension(StandalonePythonSources.Extension
24 MODULE_NAME _standaloneDialects
25 ADD_TO_PARENT StandalonePythonSources
27 StandaloneExtension.cpp
32 ################################################################################
34 ################################################################################
36 add_mlir_python_common_capi_library(StandalonePythonCAPI
37 INSTALL_COMPONENT StandalonePythonModules
38 INSTALL_DESTINATION python_packages/standalone/mlir_standalone/_mlir_libs
39 OUTPUT_DIRECTORY "${MLIR_BINARY_DIR}/python_packages/standalone/mlir_standalone/_mlir_libs"
40 RELATIVE_INSTALL_ROOT "../../../.."
42 StandalonePythonSources
43 # TODO: Remove this in favor of showing fine grained registration once
45 MLIRPythonExtension.RegisterEverything
46 MLIRPythonSources.Core
49 ################################################################################
50 # Instantiation of all Python modules
51 ################################################################################
53 add_mlir_python_modules(StandalonePythonModules
54 ROOT_PREFIX "${MLIR_BINARY_DIR}/python_packages/standalone/mlir_standalone"
55 INSTALL_PREFIX "python_packages/standalone/mlir_standalone"
57 StandalonePythonSources
58 # TODO: Remove this in favor of showing fine grained registration once
60 MLIRPythonExtension.RegisterEverything