AmpGen
2.1
Toggle main menu visibility
Loading...
Searching...
No Matches
CompilerWrapper.h
Go to the documentation of this file.
1
#ifndef AMPGEN_COMPILERWRAPPER_H
2
#define AMPGEN_COMPILERWRAPPER_H
3
4
#include <stdlib.h>
5
#include <fstream>
6
#include <iostream>
7
#include <string>
8
#include <vector>
9
#include <map>
10
#include "
AmpGen/Property.h
"
11
#include "
AmpGen/Configurable.h
"
12
13
namespace
AmpGen
{
14
class
CompiledExpressionBase
;
15
std::string
get_cpp_version
();
16
17
class
CompilerWrapper
:
public
Configurable
<CompilerWrapper> {
18
public
:
19
explicit
CompilerWrapper
();
20
virtual
~CompilerWrapper
() =
default
;
21
void
generateSource
(
const
CompiledExpressionBase
&expression,
const
std::string &fname);
22
bool
compile
(
CompiledExpressionBase
&expression,
const
std::string &fname =
""
);
23
bool
compile
(std::vector<CompiledExpressionBase *> &expression,
const
std::string &fname =
""
,
24
const
std::map<std::string, std::string> &metadata_functions = {});
25
void
compileSource
(
const
std::string &fname,
const
std::string &oname);
26
void
preamble
(std::ostream &os)
const
;
27
void
addHeader
(
const
std::string &include) { m_includes.push_back(include); }
28
void
addPythonBindings
() { m_includePythonBindings =
true
; }
29
30
private
:
31
using
strings = std::vector<std::string>;
32
std::vector<std::string> m_includes = {
"complex"
,
"cmath"
,
"vector"
};
33
bool
m_includePythonBindings{
true
};
34
std::string m_cxx;
35
std::string generateFilename();
36
bool
isClang()
const
;
37
std::string m_extension{
"so"
};
38
Property<strings> m_compileFlags{
this
,
"CompilerWrapper::Flags"
, {
"-Ofast"
,
"--std="
+
get_cpp_version
()}};
39
Property<bool> m_forceRebuild{
this
,
"CompilerWrapper::ForceRebuild"
,
false
};
40
Property<bool> m_disable{
this
,
"CompilerWrapper::Disable"
,
false
};
41
};
42
}
// namespace AmpGen
43
#endif
Configurable.h
Property.h
AmpGen::CompiledExpressionBase
Base class for compiled expressions, i.e.
Definition
CompiledExpressionBase.h:30
AmpGen::CompilerWrapper::compile
bool compile(CompiledExpressionBase &expression, const std::string &fname="")
AmpGen::CompilerWrapper::compile
bool compile(std::vector< CompiledExpressionBase * > &expression, const std::string &fname="", const std::map< std::string, std::string > &metadata_functions={})
AmpGen::CompilerWrapper::compileSource
void compileSource(const std::string &fname, const std::string &oname)
AmpGen::CompilerWrapper::generateSource
void generateSource(const CompiledExpressionBase &expression, const std::string &fname)
AmpGen::CompilerWrapper::CompilerWrapper
CompilerWrapper()
AmpGen::CompilerWrapper::addHeader
void addHeader(const std::string &include)
Definition
CompilerWrapper.h:27
AmpGen::CompilerWrapper::preamble
void preamble(std::ostream &os) const
AmpGen::CompilerWrapper::addPythonBindings
void addPythonBindings()
Definition
CompilerWrapper.h:28
AmpGen::CompilerWrapper::~CompilerWrapper
virtual ~CompilerWrapper()=default
AmpGen::Configurable
Definition
Configurable.h:10
AmpGen
Definition
AddCPConjugate.h:2
AmpGen::get_cpp_version
std::string get_cpp_version()
AmpGen
CompilerWrapper.h
Generated on
for AmpGen by
1.17.0