From d604d1702edd788ec2ba61c8e9a14edd3ef9ea4a Mon Sep 17 00:00:00 2001 From: Volo Zyko Date: Wed, 9 Jun 2021 21:32:40 +0300 Subject: [PATCH] Fix ICU libs detection when ICU resources are in a separate directory --- build/Jamfile.v2 | 22 ++++++++++++++++++++++ build/has_icu_test.cpp | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index a74f9ed2..7b0ce938 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -114,6 +114,28 @@ if ! $(disable-icu) static:U_STATIC_IMPLEMENTATION=1 ; + if [ modules.peek : ICU_DATA_DIR ] + { + rule data-dir-options ( properties * ) + { + local result ; + local data_dir = [ modules.peek : ICU_DATA_DIR ] ; + if emscripten in $(properties) + { + result = ICU_DATA_DIR=\\\"/$(data_dir:BS)\\\" + "--embed-file $(data_dir)@/$(data_dir:BS)" + ; + } + else + { + result = ICU_DATA_DIR=\\\"$(data_dir)\\\" ; + } + return $(result) ; + } + + ICU_OPTS += @data-dir-options ; + } + } exe has_icu : has_icu_test.cpp : $(ICU_OPTS) ; diff --git a/build/has_icu_test.cpp b/build/has_icu_test.cpp index 31c964e7..36a919b4 100644 --- a/build/has_icu_test.cpp +++ b/build/has_icu_test.cpp @@ -28,6 +28,10 @@ void print_error(UErrorCode err, const char* func) int main() { +#ifdef ICU_DATA_DIR + ::u_setDataDirectory(ICU_DATA_DIR); +#endif + // To detect possible binary mismatches between the installed ICU build, and whatever // C++ std lib's we're using, we need to: // * Make sure we call ICU C++ API's