Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/capi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
RUSTFLAGS: '-Cinstrument-coverage -Clink-dead-code'
run: |
cd pineappl_capi
export PINEAPPL_C_INSTALL_PREFIX=/usr/local
cargo cinstall --verbose --prefix=/usr/local/ --libdir=/usr/local/lib
ldconfig

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --target=${{ matrix.target }}
cargo install --locked cargo-c
cd pineappl_capi
export PINEAPPL_C_INSTALL_PREFIX=$(pwd)/prefix
cargo cinstall --destdir=prefix --libdir=lib --library-type=cdylib --locked --prefix=/ --target=${{ matrix.target }} --verbose
cd prefix
tar czf ../../pineappl_capi-${{ matrix.target }}.tar.gz .
Expand Down Expand Up @@ -105,6 +106,7 @@ jobs:
- name: Compile library
run: |
cd pineappl_capi
export PINEAPPL_C_INSTALL_PREFIX=$(pwd)/prefix
cargo cinstall --destdir=prefix --libdir=lib --library-type=cdylib --locked --prefix=/ --target=${{ matrix.target }} --verbose
cd prefix
tar czf ../../pineappl_capi-${{ matrix.target }}.tar.gz .
Expand Down
1 change: 1 addition & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ If you want to build the CAPI from its sources instead, you first need to
3. Now install `pineappl_capi`, PineAPPL's C API:

cd pineappl_capi
export PINEAPPL_C_INSTALL_PREFIX=${prefix} # To copy the OOP C++ header
cargo cinstall --release --prefix=${prefix} --libdir=${prefix}/lib
cd ..

Expand Down
4 changes: 2 additions & 2 deletions examples/object-oriented-cpp/dyaa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <random>
#include <vector>

#include "PineAPPL.hpp"
#include "pineappl_capi.h"
#include <PineAPPL.hpp>
#include <pineappl_capi.h>

double int_photo(double s, double t, double u) {
double alpha0 = 1.0 / 137.03599911;
Expand Down
21 changes: 21 additions & 0 deletions pineappl_capi/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//! A build script to install the OOP C++ interface to `PineAPPL`.

use std::env;
use std::fs;
use std::path::PathBuf;

fn main() {
println!("cargo:rerun-if-changed=src/include/PineAPPL.hpp");

if let Ok(prefix) = env::var("PINEAPPL_C_INSTALL_PREFIX") {
let prefix_path = PathBuf::from(prefix);
let include_path = prefix_path.join("include").join("pineappl_capi");

fs::create_dir_all(&include_path).expect("Failed to create include directory.");

let source_header = PathBuf::from("src/include/PineAPPL.hpp");
let dest_header = include_path.join("PineAPPL.hpp");

fs::copy(&source_header, &dest_header).expect("Failed to copy header file.");
}
}