MLIR toy, changed some code and how to rebuild

i have changed some code in ops.td and Dialect.cpp and MLIRGen.cpp from llvm-project/mlir/examples/toy/Ch2. now i want to build the changed code to produce an executable file to test my added code whether right or not. i have seen the standalone directory, i can build it to produce the executable file.Can i just build the Ch2 directory just like standalone, if can, what should i do , i changed a little in the Ch2/CMakelist.txt, but it outputs error like “Unknown CMake command add_toy_chapter”, if can’t, should i rebuild the whole mlir?

You can rebuild only the binary for chapter 2 with ninja toy-ch2, in general you can also build any file in the build directory by specifying its path, ninja bin/mlir-opt for example.

Note that in your case I don’t expect a difference if you rebuild the whole project: ninja tracks dependencies and nothing depends on Toy, so it should only rebuild toy-ch2 anyway

1 Like

thanks a lot, it really worked. In the next, if i want to build a dialect, should i copy the configuration files in the standalone(Most are CMakeLists.txt) and change some path or name to build the new dialect?