|
| 1 | +# ===- CMakeLists.txt - PyRTG sources -------------------------*- cmake -*-===// |
| 2 | +# |
| 3 | +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | +# See https://llvm.org/LICENSE.txt for license information. |
| 5 | +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | +# |
| 7 | +# ===----------------------------------------------------------------------===// |
| 8 | + |
| 9 | +include(AddMLIRPython) |
| 10 | + |
| 11 | +add_compile_definitions("MLIR_PYTHON_PACKAGE_PREFIX=pyrtg.circt.") |
| 12 | + |
| 13 | +declare_mlir_python_sources(PyRTGSources |
| 14 | + ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}" |
| 15 | + SOURCES |
| 16 | + pyrtg/__init__.py |
| 17 | + pyrtg/tests.py |
| 18 | + rtgtool/rtgtool.py |
| 19 | +) |
| 20 | + |
| 21 | +################################################################################ |
| 22 | +# Build composite binaries |
| 23 | +################################################################################ |
| 24 | + |
| 25 | +set(PYRTG_PYTHON_PACKAGE_DIR "${CIRCT_PYTHON_PACKAGES_DIR}/pyrtg/") |
| 26 | + |
| 27 | +# Bundle our own, self-contained CAPI library with all of our deps. |
| 28 | +add_mlir_python_common_capi_library(PyRTG_CIRCTPythonCAPI |
| 29 | + INSTALL_COMPONENT CIRCTBindingsPythonModules |
| 30 | + INSTALL_DESTINATION python_packages/pyrtg/circt/_mlir_libs |
| 31 | + OUTPUT_DIRECTORY "${PYRTG_PYTHON_PACKAGE_DIR}/pyrtg/circt/_mlir_libs" |
| 32 | + RELATIVE_INSTALL_ROOT "../../.." |
| 33 | + DECLARED_SOURCES |
| 34 | + MLIRPythonSources.Core |
| 35 | + CIRCTBindingsPythonExtension |
| 36 | +) |
| 37 | + |
| 38 | +add_mlir_python_modules(PyRTG_CIRCTPythonModules |
| 39 | + ROOT_PREFIX "${PYRTG_PYTHON_PACKAGE_DIR}/pyrtg/circt" |
| 40 | + INSTALL_PREFIX "python_packages/pyrtg/circt" |
| 41 | + DECLARED_SOURCES |
| 42 | + MLIRPythonSources.Core |
| 43 | + CIRCTBindingsPythonExtension |
| 44 | + CIRCTBindingsPythonSources |
| 45 | + COMMON_CAPI_LINK_LIBS |
| 46 | + PyRTG_CIRCTPythonCAPI |
| 47 | +) |
| 48 | + |
| 49 | +add_mlir_python_modules(PyRTG |
| 50 | + ROOT_PREFIX "${PYRTG_PYTHON_PACKAGE_DIR}/" |
| 51 | + INSTALL_PREFIX "python_packages/" |
| 52 | + DECLARED_SOURCES |
| 53 | + PyRTGSources |
| 54 | + COMMON_CAPI_LINK_LIBS |
| 55 | + PyRTG_CIRCTPythonCAPI |
| 56 | +) |
| 57 | + |
| 58 | +install(TARGETS PyRTG_CIRCTPythonCAPI |
| 59 | + DESTINATION python_packages/pyrtg/circt/_mlir_libs |
| 60 | + RUNTIME_DEPENDENCIES |
| 61 | + PRE_EXCLUDE_REGEXES ".*" |
| 62 | + PRE_INCLUDE_REGEXES ".*zlib.*" |
| 63 | + COMPONENT PyRTG |
| 64 | +) |
| 65 | +add_dependencies(PyRTG PyRTG_CIRCTPythonModules) |
| 66 | +add_dependencies(install-PyRTG install-PyRTG_CIRCTPythonModules) |
0 commit comments