A high-performance implementation of KCL written in Rust that uses LLVM as the compiler backend.
Firstly, see KCLVM CONTRIBUTING to build KCLVM. Secondly, we need to download the Rust, SWIG, LLVM 12, and add the LLVM installation location to LLVM_SYS_120_PREFIX
and the $PATH
.
export LLVM_SYS_120_PREFIX=<your LLVM 12 install location>
export PATH=<your LLVM 12 install location>/bin:$PATH
To build everything, run:
make
After building, we can add the following command line parameters to use the KCL high-performance version:
kclvm_cli run main.k
To test, run:
make test
make -C .. sh-in-docker
make build
export PATH=$PATH:/root/kclvm/_build/dist/ubuntu/kclvm/bin
kcl ./samples/hello.k
cd kclvm && make test
You can choose any IDE you like for development, but we recommend a combination of VS Code and the rust-analyzer plugin.
- If you wanna start over, you
MUST
clean up all cached building files, such asLLVM build files
,kclvm/target
, etc. - If your updating-cargo-index is extremely slow, setup
~/.cargo/config
file.
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'ustc'
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"