1 //===- MainModule.cpp - Main pybind module --------------------------------===// 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 <tuple> 10 11 #include <pybind11/pybind11.h> 12 13 #include "mlir/IR/MLIRContext.h" 14 15 using namespace mlir; 16 17 PYBIND11_MODULE(_mlir, m) { 18 m.doc() = "MLIR Python Native Extension"; 19 20 m.def("get_test_value", []() { 21 // This is just calling a method on the MLIRContext as a smoketest 22 // for linkage. 23 MLIRContext context; 24 return std::make_tuple(std::string("From the native module"), 25 context.isMultithreadingEnabled()); 26 }); 27 } 28