summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Config')
-rw-r--r--Swiften/Config/.gitignore1
-rw-r--r--Swiften/Config/SConscript4
-rw-r--r--Swiften/Config/swiften-config.cpp21
3 files changed, 17 insertions, 9 deletions
diff --git a/Swiften/Config/.gitignore b/Swiften/Config/.gitignore
index 4514b26..2ae0953 100644
--- a/Swiften/Config/.gitignore
+++ b/Swiften/Config/.gitignore
@@ -1,2 +1,3 @@
swiften-config
swiften-config.h
+Paths.cpp
diff --git a/Swiften/Config/SConscript b/Swiften/Config/SConscript
index 933e4a3..357a5e6 100644
--- a/Swiften/Config/SConscript
+++ b/Swiften/Config/SConscript
@@ -27,11 +27,13 @@ libflags = replaceSwiftenPath(" ".join([swiften_env.subst("$_LIBDIRFLAGS"), swif
config_flags += cStringVariable(swiften_env, "LIBFLAGS", libflags)
config_env = env.Clone()
-config_env.MergeFlags(config_env["SWIFTEN_FLAGS"])
+# Create a local copy of Paths.cpp to avoid a Swiften dependency
+config_env.Install(".", "#/Swiften/Base/Paths.cpp")
config_env.MergeFlags(config_env["BOOST_FLAGS"])
config_env.MergeFlags(config_env["PLATFORM_FLAGS"])
config_env.WriteVal("swiften-config.h", config_env.Value(config_flags))
swiften_config = config_env.Program("swiften-config", [
+ "Paths.cpp",
"swiften-config.cpp"
])
diff --git a/Swiften/Config/swiften-config.cpp b/Swiften/Config/swiften-config.cpp
index d381faa..b3875cb 100644
--- a/Swiften/Config/swiften-config.cpp
+++ b/Swiften/Config/swiften-config.cpp
@@ -6,16 +6,15 @@
#include <iostream>
+#include <boost/algorithm/string.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/variables_map.hpp>
#include <boost/program_options.hpp>
#include <boost/version.hpp>
#include <string>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Base/Platform.h>
#include <Swiften/Base/Paths.h>
-#include <Swiften/Base/String.h>
#include "swiften-config.h"
@@ -72,28 +71,34 @@ int main(int argc, char* argv[]) {
// Detect whether we're running in-place or not
boost::filesystem::path executablePath = Paths::getExecutablePath();
- boost::filesystem::path topPath = executablePath / ".." / "..";
- bool inPlace = true;
+ boost::filesystem::path topSourcePath = executablePath / ".." / "..";
+ boost::filesystem::path topInstallPath = executablePath / "..";
+ bool inPlace = !boost::filesystem::exists(topInstallPath / "include" / "Swiften" / "Swiften.h");
// Replace "#" variables with the correct path
for(size_t i = 0; i < libs.size(); ++i) {
if (inPlace) {
std::string lib = libs[i];
- String::replaceAll(lib, '#', topPath.string());
+ boost::replace_all(lib, "#", topSourcePath.string());
libs[i] = lib;
}
else {
- // TODO
+ std::string lib = libs[i];
+ boost::replace_all(lib, "#", (topInstallPath / "lib").string());
+ boost::erase_all(lib, "/Swiften");
+ libs[i] = lib;
}
}
for(size_t i = 0; i < cflags.size(); ++i) {
if (inPlace) {
std::string cflag = cflags[i];
- String::replaceAll(cflag, '#', topPath.string());
+ boost::replace_all(cflag, "#", topSourcePath.string());
cflags[i] = cflag;
}
else {
- // TODO
+ std::string cflag = cflags[i];
+ boost::replace_all(cflag, "#", (topInstallPath / "include").string());
+ cflags[i] = cflag;
}
}