Back to home page

EIC code displayed by LXR

 
 

    


Warning, /jana2/docs/install.md is written in an unsupported language. File is not indexed.

0001 
0002 
0003 ### Building JANA
0004 
0005 First, set your `$JANA_HOME` environment variable. This is where the executables, libraries, headers, and plugins
0006 get installed. (It is also where we will clone the source). CMake will install to `$JANA_HOME` if it is set (it
0007 will install to `${CMAKE_BINARY_DIR}/install` if not). Be aware that although CMake usually defaults
0008 `CMAKE_INSTALL_PREFIX` to `/usr/local`, we have disabled this because we rarely want this in practice, and we
0009 don't want the build system picking up outdated headers and libraries we installed to `/usr/local` by accident.
0010 If you want to set `JANA_HOME=/usr/local`, you are free to do so, but you must do so deliberately.
0011 
0012 Next, set your build directory. This is where CMake's caches, logs, intermediate build artifacts, etc go. The convention
0013 is to name it `build` and put it in the project's root directory. If you are using CLion, it will automatically create 
0014 a `cmake-build-debug` directory which works just fine. 
0015 
0016 Finally, you can cd into your build directory and build and install everything the usual CMake way.
0017 
0018 ```bash
0019 export JANA_VERSION=v2.0.5                    # Convenient to set this once for specific release
0020 export JANA_HOME=${PWD}/JANA${JANA_VERSION}   # Set full path to install dir
0021 
0022 git clone https://github.com/JeffersonLab/JANA2 --branch ${JANA_VERSION} ${JANA_HOME}  # Get JANA2
0023 
0024 mkdir build                                   # Set build dir
0025 cd build
0026 cmake3 ${JANA_HOME}  # Generate makefiles     # Generate makefiles
0027 make -j8 install                              # Build (using 8 threads) and install
0028 
0029 source ${JANA_HOME}/bin/jana-this.sh          # Set PATH (and other envars)
0030 jana -Pplugins=JTest                          # Run JTest plugin to verify successful install
0031 ```
0032 
0033 Note: If you want to use a compiler other than the default one on your system, it is not enough to modify your
0034 `$PATH`, as CMake ignores this by design. You either need to set the `CXX` environment variable or the 
0035 `CMAKE_CXX_COMPILER` CMake variable.
0036 
0037 By default, JANA will look for plugins under `$JANA_HOME/plugins`. For your plugins to propagate here, you have to `install`
0038 them. If you don't want to do that, you can also set the environment variable `$JANA_PLUGIN_PATH` to point to the build
0039 directory of your project. JANA will report where exactly it went looking for your plugins and what happened when it tried
0040 to load them if you set the JANA config `jana:debug_plugin_loading=1`.
0041 
0042 ```bash
0043 jana -Pplugins=JTest -Pjana:debug_plugin_loading=1
0044 ```
0045 
0046 ### Using JANA in a CMake project
0047 
0048 To use JANA in a CMake project, simply add `$JANA_HOME/lib/cmake/JANA` to your `CMAKE_PREFIX_PATH`,
0049 or alternatively, set the CMake variable `JANA_DIR=$JANA_HOME/lib/cmake/JANA`.
0050 
0051 ### Using JANA in a non-CMake project
0052 
0053 To use JANA in a non-CMake project:
0054 1. Source `$JANA_HOME/bin/jana-this.sh` to set the environment variables needed for JANA's dependencies
0055 2. Use `$JANA_HOME/bin/jana-config --cflags` to obtain JANA's compiler flags
0056 3. Use `$JANA_HOME/bin/jana_config --libs` to obtain JANA's linker flags
0057 
0058 
0059 ### Using non standard system compiler
0060 
0061 CMake by design won't use `$PATH` to find the compiler. You either need to set the `CXX` environment variable or 
0062 the `CMAKE_CXX_COMPILER` CMake variable. 
0063 
0064 Another option is use <a href="https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html" target="_blank">CMakePresets.json</a>,
0065 a file that has to be placed in CMake root directory and that may contain additional options.