Skip to content

Commit 253190e

Browse files
committed
Updated README.md
1 parent 0e9a9bd commit 253190e

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ project(CepGenGrapeProcess)
33
enable_language(Fortran)
44

55
set(CEPGEN_PATH ${CEPGEN_PATH} $ENV{CEPGEN_PATH})
6+
if(NOT CEPGEN_PATH)
7+
set(CEPGEN_PATH /usr/local)
8+
endif()
69
if(NOT PROCESS_NAME)
710
set(PROCESS_NAME FortranProcess)
811
endif()
@@ -15,3 +18,8 @@ file(GLOB_RECURSE F77_SOURCES src/*.f)
1518
add_library(CepGen${PROCESS_NAME} SHARED ${SOURCES} ${F77_SOURCES})
1619
target_link_libraries(CepGen${PROCESS_NAME} PRIVATE ${CepGen_LIBRARIES})
1720
target_include_directories(CepGen${PROCESS_NAME} PRIVATE ${CepGen_INCLUDE_DIRS})
21+
22+
file(GLOB_RECURSE input_cards RELATIVE ${PROJECT_SOURCE_DIR} cards/*)
23+
foreach(_files ${input_cards})
24+
configure_file(${_files} ${_files} COPYONLY)
25+
endforeach()

README.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
11
# Fortran process for CepGen
22
This repository provides a simple skeletton of an implementation of a Fortran process in CepGen.
33

4-
Running `make` will build a shared library containing all requirements to define a process in CepGen's runtime environment.
4+
As for other CepGen-derived projects, the build system is [CMake](https://cmake.org/), and its "standard recipe".
55

6-
This `.so` or `.dll` library can then be imported through the `-a` argument of CepGen's main executable, or using the `cepgen::loadLibrary` statement in user-defined executables.
6+
If you are not using a precompiled version of CepGen (i.e. your version of CepGen is [built from sources](https://cepgen.hepforge.org/install)), the `CEPGEN_PATH` environment variable should be set to the base source directory:
77

8-
A working version of CepGen is obviously required on the building system.
9-
The default search paths for this installation are:
10-
* `/usr/local/lib64` for library objects (only the `CepGen` shared library is required), and
11-
* `/usr/local/include` for development headers.
8+
```bash
9+
export CEPGEN_PATH=/path/to/cepgen/sources
10+
```
1211

13-
These two search paths can be overriden by setting the `$(CEPGEN_LIBS_DIR)` and `$(CEPGEN_INCLUDE_DIR)` environment variables prior to running `make`.
12+
Then, the usual CMake build recipe can be used:
1413

15-
For instance, if a local source-build of CepGen is used, these two can take the value:
1614
```bash
17-
export CEPGEN_LIBS_DIR=<path/to/cepgen/sources>/build
18-
export CEPGEN_INCLUDE_DIR=<path/to/cepgen/sources>
15+
mkdir build
16+
cd build
17+
cmake ..
18+
make [-j]
1919
```
2020

21-
In this example, the `dummy_process` Fortran double-precision typed function is built from the `*.f` source files (here, only [dummy_process.f](dummy_process.f), and registered using the [ProcessesWrapper.cpp](ProcessesWrapper.cpp) file.
21+
The resulting object is a shared library containing all requirements to define a process in CepGen's runtime environment.
22+
By default, the library name is set to `CepGenFortranProcess`.
23+
However you can override it using the `PROCESS_NAME` CMake variable, i.e. adding the flag `-DPROCESS_NAME=MyProcessName` in the `cmake` command.
24+
25+
This `.so` or `.dll` library can then be imported through the `-a` argument of CepGen's main executable, or using the `cepgen::loadLibrary` statement in custom user-defined executables.
26+
27+
In this example, the `dummy_process` Fortran double-precision typed function is built from the `*.f` source files (here, only [dummy_process.f](src/dummy_process.f), and registered using the [ProcessesWrapper.cpp](ProcessesWrapper.cpp) file.
2228
This latter acts as a link between the CepGen runtime environment and this new process definition.
2329

2430
In this file, two functions are respectively declaring the main matrix element, and registering it into the runtime database:
25-
* `DECLARE_FORTRAN_FUNCTION( dummy_process )` takes the F77 name of the function as an argument ;
26-
* `REGISTER_FORTRAN_PROCESS( dummy, "A dummy Fortran process", dummy_process )` links this function to a new CepGen process named `dummy`, described with the second argument.
31+
* `DECLARE_FORTRAN_FUNCTION(dummy_process)` takes the F77 name of the function as an argument ;
32+
* `REGISTER_FORTRAN_PROCESS(dummy, "A dummy Fortran process", dummy_process)` links this function to a new CepGen process named `dummy`, described with the second argument.
2733

2834
Once compiled and linked into a shared library, it can be loaded into the CepGen runtime environment and added into the processes collection.
2935
For the latter, the main CepGen executable can be steered when providing an extra `-a` flag linking to this library, i.e.
3036
```bash
31-
$CEPGEN_PATH/bin/cepgen -a $PATH_TO/libCepGenUserProcess.so -i $PATH_TO/dummy_cfg.py
37+
$CEPGEN_PATH/bin/cepgen -a libCepGenFortranProcess.so -i cards/dummy_cfg.py
3238
```
39+
40+
All steering cards (conventionally, for backward compatibility, new ones should be following [the Python format](https://cepgen.hepforge.org/cards-python)) stored in the [cards/](cards) directory are copied into a new directory in the build directory, for simplicity.
File renamed without changes.

0 commit comments

Comments
 (0)