Update build guide for cling (#15972)

This commit is contained in:
LiAuTraver 2024-07-11 14:30:10 +08:00 committed by jenkins
parent 3e59d62c9c
commit 3a9ada1138

View File

@ -7,7 +7,7 @@ The main repository is at [https://github.com/root-project/cling](https://github
Overview
--------
Cling is an interactive C++ interpreter, built on top of Clang and LLVM compiler
infrastructure. Cling realizes the [read-eval-print loop
infrastructure. Cling implements the [read-eval-print loop
(REPL)](http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop)
concept, in order to leverage rapid application development. Implemented as a
small extension to LLVM and Clang, the interpreter reuses their strengths such
@ -33,35 +33,38 @@ See our [release notes](docs/ReleaseNotes.md) to find what's new.
### Binaries
Our nightly binary snapshots can be found
[here](https://root.cern.ch/download/cling/).
Our nightly binary snapshots are currently unavailable.
### Building from Source
```sh
```bash
git clone https://github.com/root-project/llvm-project.git
cd llvm-project
git checkout cling-latest
cd ../
git clone <cling>
cd ..
git clone https://github.com/root-project/cling.git
mkdir cling-build && cd cling-build
cmake -DLLVM_EXTERNAL_PROJECTS=cling -DLLVM_EXTERNAL_CLING_SOURCE_DIR=../cling/ -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_TARGETS_TO_BUILD="host;nvptx" ../llvm-project/llvm
cmake -DLLVM_EXTERNAL_PROJECTS=cling -DLLVM_EXTERNAL_CLING_SOURCE_DIR=../cling/ -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_TARGETS_TO_BUILD="host;NVPTX" -DCMAKE_BUILD_TYPE=Release ../llvm-project/llvm
cmake --build . --target cling
```
See also the instructions [on the webpage](https://root.cern/cling/cling_build_instructions/).
Usage
-----
```c++
./cling '#include <stdio.h>' 'printf("Hello World!\n")'
Assuming we're in the build folder:
```bash
./bin/cling '#include <stdio.h>' 'printf("Hello World!\n")'
```
To get started run:
```bash
./cling --help
./bin/cling --help
```
or type
```
./cling
or
```bash
./bin/cling
[cling]$ .help
```