23 #ifndef CSL_LIBRARY_DEPENDENCY 24 #define CSL_LIBRARY_DEPENDENCY 39 static bool created =
false;
41 cmath.addInclude(
"cmath",
true);
49 static bool created =
false;
51 cmath.addInclude(
"complex",
true);
59 static bool created =
false;
61 csl.addInclude(
"csl",
true);
70 static bool created =
false;
72 marty.addInclude(
"marty",
true);
73 marty.addLib(
"-lmarty");
96 return name == other.name;
100 static std::vector<IncludeType> defaultInclude() {
104 static std::vector<std::string> defaultLib() {
110 std::vector<IncludeType>
const& getInclude()
const {
113 std::vector<std::string>
const& getLibrary()
const {
116 std::vector<Expr>
const& getParams()
const {
120 std::vector<IncludeType>& getInclude() {
123 std::vector<std::string>& getLibrary() {
126 std::vector<Expr>& getParams() {
130 void addInclude(std::string
const& t_include,
131 bool global =
false) {
137 for (
const auto& inc : include)
138 if (inc == t_include)
140 include.push_back(t_include);
143 void addLib(std::string
const& t_lib) {
144 for (
const auto& lib : library)
147 library.insert(library.begin(), t_lib);
150 void addParam(
Expr const& expr) {
151 for (
const auto& p : params)
154 params.push_back(expr);
157 void removeInclude(std::string
const& t_include) {
158 for (
auto iter = include.begin(); iter != include.end(); ++iter)
159 if (*iter == t_include) {
165 void removeLib(std::string
const& t_lib) {
166 for (
auto iter = library.begin(); iter != library.end(); ++iter)
167 if (*iter == t_lib) {
173 void removeParam(
Expr const& expr) {
174 for (
auto p = params.begin(); p != params.end(); ++p)
181 void printInclude(std::ostream& out)
const {
184 separator[0] = (inc.global) ?
'<' :
'\"';
185 separator[1] = (inc.global) ?
'>' :
'\"';
186 out <<
"#include " << separator[0] << inc.name << separator[1];
191 void printLib(std::ostream& out,
bool clang =
false)
const {
192 for (
const std::string& lib : library) {
193 if (!clang or lib !=
"-lgfortran")
198 bool containsInclude(std::string
const &includeType)
const 200 for (
const auto &i : include)
201 if (includeType == i.name)
206 bool containsLib(std::string
const &libType)
const 208 for (
const auto &l : library)
215 for (
const auto& inc : other.include)
217 for (
const auto& lib : other.library)
219 for (
const auto& p : other.params)
227 return newLib += other;
232 std::vector<IncludeType> include = defaultInclude();
234 std::vector<std::string> library = defaultLib();
236 std::vector<Expr> params;
240 #endif // ifndef CSL_LIBRARY_DEPENDENCY Namespace for csl library.
Definition: abreviation.h:34
Expr operator+(const Expr &a, const Expr &b)
Shortcut function that allows to use arithmetic operator + with Expr (== shared_ptr<Abstract>).
Definition: abstract.cpp:1298
Definition: librarydependency.h:33
Definition: librarydependency.h:79
Base classes for all exprs in the program.
Expression type/.
Definition: abstract.h:1573