HI,
I created a an out-of-tree project named “custom” in the examples folder. The directory structure is same as of standalone.
The directory structure and files i added are :
Built the project as :
mkdir build && cd build
cmake -G Ninja .. -DMLIR_DIR=$PREFIX/lib/cmake/mlir -DLLVM_EXTERNAL_LIT=$BUILD_DIR/bin/llvm-lit
cmake --build .
The error is :
/home/sudip/Research/opensource/llvm-project/mlir/examples/custom/lib/Custom/CustomDialect.cpp: In member function ‘void mlir::custom::CustomDialect::initialize()’:
/home/sudip/Research/opensource/llvm-project/mlir/examples/custom/lib/Custom/CustomDialect.cpp:22:3: error: parse error in template argument list
22 | addOperations<
In file included from /home/sudip/Research/opensource/llvm-project/mlir/include/mlir/IR/MLIRContext.h:13,
from /home/sudip/Research/opensource/llvm-project/mlir/include/mlir/IR/DialectRegistry.h:16,
from /home/sudip/Research/opensource/llvm-project/mlir/include/mlir/IR/Dialect.h:16,
from /home/sudip/Research/opensource/llvm-project/mlir/examples/custom/include/Custom/CustomDialect.h:12,
from /home/sudip/Research/opensource/llvm-project/mlir/examples/custom/lib/Custom/CustomDialect.cpp:9:
/home/sudip/Research/opensource/llvm-project/mlir/include/mlir/Support/TypeID.h:264:18: error: expected ‘;’ before ‘{’ token
264 | namespace mlir { \
| ^
/home/sudip/Research/opensource/llvm-project/mlir/examples/custom/build/include/Custom/CustomOpsDialect.cpp.inc:9:1: note: in expansion of macro ‘MLIR_DEFINE_EXPLICIT_TYPE_ID’
9 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::custom::CustomDialec
The file “CustomDialect.cpp” is :
#include "Custom/CustomDialect.h"
#include "Custom/CustomOps.h"
using namespace mlir;
using namespace mlir::custom;
#include "Custom/CustomOpsDialect.cpp.inc"
//===----------------------------------------------------------------------===//
// Standalone dialect.
//===----------------------------------------------------------------------===//
void CustomDialect::initialize() {
addOperations<
#define GET_OP_LIST
#include "Custom/CustomOpsDialect.cpp.inc"
>();
}
Any idea on the same? created the same CMakeLists with required changes as per the dialect name.