项目作者: root-project

项目描述 :
The cling C++ interpreter
高级语言: C++
项目地址: git://github.com/root-project/cling.git
创建时间: 2016-01-07T14:45:35Z
项目社区:https://github.com/root-project/cling

开源协议:Other

下载


Cling - The Interactive C++ Interpreter

The main repository is at https://github.com/root-project/cling

Overview

Cling is an interactive C++ interpreter, built on top of Clang and LLVM compiler
infrastructure. Cling implements the read-eval-print loop
(REPL)

concept, in order to leverage rapid application development. Implemented as a
small extension to LLVM and Clang, the interpreter reuses their strengths such
as the praised concise and expressive compiler diagnostics.

See also cling’s web page.

Please note that some of the resources are rather old and most of the stated
limitations are outdated.

Installation

Release Notes

See our release notes to find what’s new.

Binaries

Our nightly binary snapshots are currently unavailable.

Building from Source

See also the instructions on the webpage.

Building Cling as a Standalone Project

If Clang and LLVM (cling-latest version) are not installed, you need to build them first:

  1. git clone https://github.com/root-project/llvm-project.git
  2. cd llvm-project
  3. git checkout cling-latest
  4. cd ..
  5. mkdir llvm-build && cd llvm-build
  6. cmake -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_TARGETS_TO_BUILD="host;NVPTX" -DCMAKE_BUILD_TYPE=Release ./llvm-project/llvm
  7. cmake --build .

Once Clang and LLVM (cling-latest version) are installed, you can build Cling. If they are already installed, you can skip the previous step and proceed with the following:

Note: Ensure you are outside the llvm-project and llvm-build directories before proceeding, as LLVM, Clang, and Cling do not allow building inside the source directory.

  1. git clone https://github.com/root-project/cling.git
  2. mkdir cling-build && cd cling-build
  3. cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="The root of your LLVM build directory" -DLLVM_DIR="The directory containing LLVM's CMake modules" ../cling
  4. cmake --build .

Example CMake command:

  1. cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=../llvm-build -DLLVM_DIR=../llvm-build/lib/cmake/llvm ../cling

If Clang and LLVM are not installed, you can build them together with Cling:

  1. git clone https://github.com/root-project/llvm-project.git
  2. cd llvm-project
  3. git checkout cling-latest
  4. cd ..
  5. git clone https://github.com/root-project/cling.git
  6. mkdir cling-build && cd cling-build
  7. 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
  8. cmake --build . --target clang cling

Jupyter notebooks

To enable support for cling in Jupyter notebooks, after building cling, run:

  1. cmake --build . --target libclingJupyter

Usage

Assuming we’re in the build folder.

If Cling is built as a standalone project, you need to specify the include directory for headers:

  1. ./bin/cling -I"../cling/include" '#include <stdio.h>' 'printf("Hello World!\n");'

If build Cling as part of LLVM:

  1. ./bin/cling '#include <stdio.h>' 'printf("Hello World!\n");'

To get started run:

  1. ./bin/cling --help

or

  1. ./bin/cling
  2. [cling]$ .help

Jupyter

Cling comes with a Jupyter kernel. After building cling,
install Jupyter and cling’s kernel by following the README.md in
tools/Jupyter. Make sure cling is in your PATH when you start jupyter!

Citing Cling

% Peer-Reviewed Publication % % 19th International Conference on Computing in High Energy and Nuclear Physics (CHEP) % 21-25 May, 2012, New York, USA % @inproceedings{Cling, author = {Vassilev,V. and Canal,Ph. and Naumann,A. and Moneta,L. and Russo,P.}, title = {{Cling} -- The New Interactive Interpreter for {ROOT} 6}}, journal = {Journal of Physics: Conference Series}, year = 2012, month = {dec}, volume = {396}, number = {5}, pages = {052071}, doi = {10.1088/1742-6596/396/5/052071}, url = {https://iopscience.iop.org/article/10.1088/1742-6596/396/5/052071/pdf}, publisher = {{IOP} Publishing} }

Developers’ Corner

Cling’s latest doxygen documentation

Contributions

Every contribution is considered a donation and its copyright and any other
related rights become exclusive ownership of the person who merged the code or
in any other case the main developers of the “Cling Project”.

We warmly welcome external contributions to the Cling! By providing code,
you agree to transfer your copyright on the code to the “Cling project”.
Of course you will be duly credited and your name will appear on the
contributors page, the release notes, and in the CREDITS file
shipped with every binary and source distribution. The copyright transfer is
necessary for us to be able to effectively defend the project in case of
litigation.

License

Please see our LICENSE.

Releases

Our release steps to follow when cutting a new release:

  1. Update release notes
  2. Remove ~dev suffix from VERSION
  3. Add a new entry in the news section of our website
  4. Commit the changes.
  5. git tag -a v0.x -m "Tagging release v0.x"
  6. Tag cling-patches of clang.git:
    git tag -a cling-v0.x -m "Tagging clang for cling v0.x"
  7. Create a draft release in github and copy the contents of the release notes.
  8. Wait for green builds.
  9. Upload binaries to github (Travis should do this automatically).
  10. Publish the tag and announce it on the mailing list.
  11. Increment the current version and append ~dev.