From 5250cb90406693163763a214af95f670e0e3a4e0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 5 Oct 2018 05:02:49 +0200 Subject: 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? --- src/PkgConfig.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/PkgConfig.cpp') 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 PkgConfig::validatePkgConfigPackageVersionExists(PackageListDependency *dependency) { @@ -34,7 +41,7 @@ namespace sibs Result 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 = 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 = 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 = exec(command.c_str()); if(execResult.isErr()) -- cgit v1.2.3