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 Overview
-------- --------
Cling is an interactive C++ interpreter, built on top of Clang and LLVM compiler 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) (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 concept, in order to leverage rapid application development. Implemented as a
small extension to LLVM and Clang, the interpreter reuses their strengths such 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 ### Binaries
Our nightly binary snapshots can be found Our nightly binary snapshots are currently unavailable.
[here](https://root.cern.ch/download/cling/).
### Building from Source ### Building from Source
```sh ```bash
git clone https://github.com/root-project/llvm-project.git git clone https://github.com/root-project/llvm-project.git
cd llvm-project cd llvm-project
git checkout cling-latest git checkout cling-latest
cd ../ cd ..
git clone <cling> git clone https://github.com/root-project/cling.git
mkdir cling-build && cd cling-build 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 Usage
----- -----
```c++ Assuming we're in the build folder:
./cling '#include <stdio.h>' 'printf("Hello World!\n")' ```bash
./bin/cling '#include <stdio.h>' 'printf("Hello World!\n")'
``` ```
To get started run: To get started run:
```bash ```bash
./cling --help ./bin/cling --help
``` ```
or type or
``` ```bash
./cling ./bin/cling
[cling]$ .help [cling]$ .help
``` ```