mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-15 23:39:19 +00:00
scons: added a check for icu support in boost locale
This commit is contained in:
parent
b7418a32e5
commit
e637c55d50
|
@ -374,6 +374,9 @@ if env["prereqs"]:
|
|||
conf.CheckBoost("locale") \
|
||||
and Info("Base prerequisites are met")) \
|
||||
or Warning("Base prerequisites are not met")
|
||||
if(have_server_prereqs and not env["host"]):
|
||||
conf.CheckBoostLocaleBackends(["icu", "winapi"]) \
|
||||
or Warning("Only icu and winapi backends of Boost Locale are supported. Bugs/crashes are very likely with other backends")
|
||||
|
||||
env = conf.Finish()
|
||||
|
||||
|
|
|
@ -181,4 +181,44 @@ def CheckBoostIostreamsBZip2(context):
|
|||
context.Result("no")
|
||||
return False
|
||||
|
||||
config_checks = { "CheckBoost" : CheckBoost, "CheckBoostIostreamsGZip" : CheckBoostIostreamsGZip, "CheckBoostIostreamsBZip2" : CheckBoostIostreamsBZip2 }
|
||||
def CheckBoostLocaleBackends(context, backends):
|
||||
env = context.env
|
||||
backup = env.Clone().Dictionary()
|
||||
|
||||
context.Message("Checking for available Boost Locale backends... ")
|
||||
test_program = """
|
||||
#include <boost/locale/localization_backend.hpp>
|
||||
#include <iostream>
|
||||
#include <assert.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
auto manager { boost::locale::localization_backend_manager::global() };
|
||||
auto backends { manager.get_all_backends() };
|
||||
assert(backends.size() >= 1);
|
||||
for(auto backend : backends) {
|
||||
std::cout << backend << std::endl;
|
||||
}
|
||||
}
|
||||
\n"""
|
||||
|
||||
if(env["PLATFORM"] != "win32"):
|
||||
env.Append(LIBS = ["icudata", "icui18n", "icuuc"])
|
||||
|
||||
res, output = context.TryRun(test_program, ".cpp")
|
||||
result = False
|
||||
found_backends = "no"
|
||||
if res:
|
||||
supported_backends = output.splitlines()
|
||||
result = bool(set(backends).intersection(supported_backends))
|
||||
found_backends = ",".join(supported_backends)
|
||||
|
||||
context.Result(found_backends)
|
||||
if result:
|
||||
return True
|
||||
else:
|
||||
env.Replace(**backup)
|
||||
|
||||
return False
|
||||
|
||||
config_checks = { "CheckBoost" : CheckBoost, "CheckBoostIostreamsGZip" : CheckBoostIostreamsGZip, "CheckBoostIostreamsBZip2" : CheckBoostIostreamsBZip2, "CheckBoostLocaleBackends" : CheckBoostLocaleBackends }
|
||||
|
|
Loading…
Reference in New Issue
Block a user