forked from openframeworks/projectGenerator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibraryBinary.cpp
More file actions
37 lines (29 loc) · 1.17 KB
/
LibraryBinary.cpp
File metadata and controls
37 lines (29 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "LibraryBinary.h"
#include "ofFileUtils.h"
#include <algorithm>
const std::vector<std::string> LibraryBinary::archs { "x86", "Win32", "x64", "armv7", "ARM64", "ARM64EC" };
const std::vector<std::string> LibraryBinary::targets{ "Debug", "Release" };
LibraryBinary::LibraryBinary(fs::path p):path(p){
findArch(path);
findTarget(path);
}
std::string findStringsInPath(const std::vector<std::string> & strings, const std::filesystem::path & path){
for (const auto& part : path) {
std::string p = ofPathToString(part);
if (std::find(strings.begin(), strings.end(), p) != strings.end()) {
return p;
}
}
return "";
}
void LibraryBinary::findArch(const std::filesystem::path & path){
this->arch = findStringsInPath(LibraryBinary::archs, path);
}
void LibraryBinary::findTarget(const std::filesystem::path & path){
this->target = findStringsInPath(LibraryBinary::targets, path);
}
bool LibraryBinary::isValidFor(const std::string& _arch, const std::string& _target){
bool targetOK = (_target.empty() || (_target == this->target));
bool archOK = (_arch.empty() || (_arch == this->arch));
return targetOK && archOK;
}