diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-10-05 05:02:49 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:39:33 +0200 |
commit | 5250cb90406693163763a214af95f670e0e3a4e0 (patch) | |
tree | 7025c762d4f53aebfdc140d615306f558fa9b69a /src/PkgConfig.cpp | |
parent | 3059b1cb8d701cf23f3e04a8a8fdcfcaa6a397fb (diff) |
Add cross compilation (mingw-w64 x86_64)
Currently only cross compiling from linux64 to win64 works.
Need to test cross compilation more, currently the cross compilation
uses same profile as GCC, is that correct?
Diffstat (limited to 'src/PkgConfig.cpp')
-rw-r--r-- | src/PkgConfig.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/PkgConfig.cpp b/src/PkgConfig.cpp index faed146..9efc238 100644 --- a/src/PkgConfig.cpp +++ b/src/PkgConfig.cpp @@ -4,12 +4,14 @@ using namespace std; +static sibs::FileString pkgConfigPath = "pkg-config"; + // TODO: Do not use pkg-config program. The same functionality can easily be achieved // by reading files in /usr/share/pkgconfig // Or is there no downside to calling pkg-config program? namespace sibs { - string trimRight(const string &input) + static string trimRight(const string &input) { for(int i = input.size() - 1; i >= 0; --i) { @@ -18,6 +20,11 @@ namespace sibs } return ""; } + + void PkgConfig::setPkgConfigPath(const FileString &path) + { + pkgConfigPath = path; + } Result<bool> PkgConfig::validatePkgConfigPackageVersionExists(PackageListDependency *dependency) { @@ -34,7 +41,7 @@ namespace sibs Result<bool> PkgConfig::validatePackageExists(const string &name) { - FileString command = TINYDIR_STRING("pkg-config --exists '"); + FileString command = pkgConfigPath + TINYDIR_STRING(" --exists '"); command += toFileString(name); command += TINYDIR_STRING("'"); Result<ExecResult> execResult = exec(command.c_str()); @@ -68,7 +75,7 @@ namespace sibs // Use --modversion instead and check if the version returned is newer or equal to dependency version. // This way we can output installed version vs expected dependency version - FileString command = TINYDIR_STRING("pkg-config '--atleast-version="); + FileString command = pkgConfigPath + TINYDIR_STRING(" '--atleast-version="); command += toFileString(version); command += TINYDIR_STRING("' '"); command += toFileString(name); @@ -111,7 +118,7 @@ namespace sibs args += "'"; } - FileString command = TINYDIR_STRING("pkg-config --libs"); + FileString command = pkgConfigPath + TINYDIR_STRING(" --libs"); command += toFileString(args); Result<ExecResult> execResult = exec(command.c_str()); if(execResult.isErr()) @@ -154,7 +161,7 @@ namespace sibs args += "'"; } - FileString command = TINYDIR_STRING("pkg-config --cflags"); + FileString command = pkgConfigPath + TINYDIR_STRING(" --cflags"); command += toFileString(args); Result<ExecResult> execResult = exec(command.c_str()); if(execResult.isErr()) |