2014-06-01 21:05:26 +02:00
```
______ __ ____ _ __ ______
/ ____ / / / / _/ / | / / / ____ /
2014-08-03 21:05:42 -05:00
/ / / / / / / |/ / / / __
/ /___ / /___ _/ / / /| / / /_ / /
\____/ /_____/ /___/ /_/ |_/ \____/
2014-06-01 21:05:26 +02:00
```
2012-09-05 09:37:39 +00:00
2014-09-25 20:44:22 +02:00
2014-08-03 21:05:42 -05:00
##DESCRIPTION
2014-09-25 11:53:58 -07:00
Cling is an interactive C++ interpreter, built on top of Clang and LLVM compiler infrastructure. Cling realizes 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 as the praised concise and expressive compiler diagnostics.
2014-05-30 11:02:36 +02:00
2016-07-20 17:22:04 +02:00
See also the [cling web page ](https://cdn.rawgit.com/root-mirror/cling/master/www/index.html )
2014-08-03 21:05:42 -05:00
### Further information & demos
Please note that some of the resources are rather old and most of the stated limitations are outdated.
2016-07-22 11:17:40 +02:00
* [talks ](www/docs/talks )
2014-08-03 21:05:42 -05:00
* http://blog.coldflake.com/posts/2012-08-09-On-the-fly-C++.html
* http://solarianprogrammer.com/2012/08/14/cling-cpp-11-interpreter/
* https://www.youtube.com/watch?v=f9Xfh8pv3Fs
* https://www.youtube.com/watch?v=BrjV1ZgYbbA
* https://www.youtube.com/watch?v=wZZdDhf2wDw
* https://www.youtube.com/watch?v=eoIuqLNvzFs
2014-05-30 11:02:36 +02:00
2014-08-03 21:05:42 -05:00
##INSTALLATION
2016-07-05 23:41:18 +02:00
###Release Notes
See our [release notes ](docs/ReleaseNotes.md ) to find what's new.
2014-08-03 21:05:42 -05:00
###Binaries
2016-01-07 15:58:40 +01:00
We offer binary snapshots for download at https://root.cern.ch/download/cling/
2012-09-05 09:37:39 +00:00
2014-08-03 21:05:42 -05:00
###Source
2014-09-25 11:16:02 -04:00
CLING source depends on the [LLVM][1] and [CLANG][2] headers and libraries.
You will also need [CMake][3] >= 2.6.1 or GNU Make to build all of those
packages and [subversion][4] and [git][5] to get the source code.
2012-09-05 09:37:39 +00:00
2014-09-25 11:16:02 -04:00
[1]: http://llvm.org
[2]: http://clang.llvm.org
[3]: http://cmake.org
[4]: http://subversion.tigris.org
[5]: http://git-scm.com
2014-08-03 21:05:42 -05:00
####Building
2014-03-04 15:23:17 +01:00
Building LLVM and CLANG you must:
2014-08-03 21:05:42 -05:00
* Check out the sources:
2014-03-04 15:23:17 +01:00
```bash
git clone http://root.cern.ch/git/llvm.git src
cd src
git checkout cling-patches
cd tools
git clone http://root.cern.ch/git/cling.git
git clone http://root.cern.ch/git/clang.git
cd clang
git checkout cling-patches
```
2014-08-03 21:05:42 -05:00
* Configure, build and install them, either using CMake:
2014-03-04 15:23:17 +01:00
```bash
2016-03-29 14:50:34 +02:00
cd ../../../
2014-03-04 15:23:17 +01:00
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/some/install/dir \
2016-03-29 14:50:34 +02:00
-DLLVM_TARGETS_TO_BUILD=host \
2014-03-04 15:23:17 +01:00
-DCMAKE_BUILD_TYPE=Debug \
../src
make
make install
```
2014-08-03 21:05:42 -05:00
* or GNU Make (see ../src/configure --help for all options):
2012-09-05 09:37:39 +00:00
2014-03-04 15:23:17 +01:00
```bash
2016-03-29 14:50:34 +02:00
cd ../../../
2014-03-04 15:23:17 +01:00
mkdir build
cd build
../src/configure --prefix=/some/install/dir
make
make install
```
2014-08-16 15:37:20 +05:30
#####Cling Packaging Tool
Cling's tree has a user-friendly, command-line utility written in Python called
Cling Packaging Tool (CPT) which can build Cling from source and generate
installer bundles for a wide range of platforms.
If you have Cling's source cloned locally, you can find the tool in
```tools/packaging` `` directory. Alternatively, you can download the script
manually, or by using ```wget` ``:
```sh
2016-01-07 15:58:40 +01:00
wget https://raw.githubusercontent.com/root-mirror/cling/master/tools/packaging/cpt.py
2014-08-16 15:37:20 +05:30
chmod +x cpt.py
```
2016-07-21 10:45:15 +02:00
Full documentation of CPT can be found in [tools/packaging ](tree/master/tools/packaging ).
2012-09-05 09:37:39 +00:00
2014-08-03 21:05:42 -05:00
##USAGE
2016-04-09 11:27:14 +02:00
```c++
/some/install/dir/bin/cling '#include < stdio.h > ' 'printf("Hello World!\n")'`
```
To get started run:
```bash
/some/install/dir/bin/cling --help`
```
or type
```
/some/install/dir/bin/cling
[cling]$ .help`
```
2014-03-04 15:23:17 +01:00
2016-01-07 15:58:40 +01:00
## Jupyter
cling comes with a [Jupyter][6] kernel. After building cling, install Jupyter and run ```jupyter kernelspec install cling` ``. It requires a fairly new Jupyter. Make sure cling is in your PATH when you start jupyter!
2016-07-26 23:58:32 +02:00
See also the [tools/Jupyter ](tools/Jupyter ) subdirectory.
2016-04-09 11:27:14 +02:00
2016-01-07 15:58:40 +01:00
[6]: http://jupyter.org
##DEVELOPERS' CORNER
2014-09-25 11:16:02 -04:00
We have doxygen documentation of cling's code at: http://cling.web.cern.ch/cling/doxygen/
2016-01-07 15:58:40 +01:00
2014-08-03 21:05:42 -05:00
###CONTRIBUTIONS
Every contribution is very welcome. It is considered as a donation and its copyright and any other related
2014-09-25 11:16:02 -04:00
rights become exclusive ownership of the person who merged the code or in any other case the main developers.
2014-08-03 21:05:42 -05:00
In order for a contribution to be accepted it has to obey the previously
established rules for contribution acceptance in cling's work flow and rules.
2014-05-23 09:06:34 +02:00