Skip to content

Commit

Permalink
Fix ICU detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
jzmaddock committed Jun 9, 2016
1 parent 9059bfb commit e3228b6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
7 changes: 1 addition & 6 deletions build/Jamfile.v2
Expand Up @@ -115,11 +115,6 @@ if ! $(disable-icu)

}

actions regex_simple_run_action
{
$(>) > $(<)
}

rule regex-run-simple ( sources + : args * : input-files * : requirements * : target-name )
{
exe $(target-name)_exe : $(sources) : $(requirements) ;
Expand All @@ -129,7 +124,7 @@ rule regex-run-simple ( sources + : args * : input-files * : requirements * : ta
alias $(target-name) : $(target-name).output ;
}

regex-run-simple has_icu_test.cpp : : : $(ICU_OPTS) : has_icu ;
unit-test has_icu : has_icu_test.cpp : $(ICU_OPTS) ;
explicit has_icu ;

alias icu_options : : : : [ check-target-builds has_icu : $(ICU_OPTS) : ] ;
Expand Down
16 changes: 15 additions & 1 deletion build/has_icu_test.cpp
Expand Up @@ -21,6 +21,11 @@
#error "Mixing ICU with a static runtime doesn't work"
#endif

void print_error(UErrorCode err, const char* func)
{
std::cerr << "Error from function " << func << " with error: " << ::u_errorName(err) << std::endl;
}

int main()
{
// To detect possible binary mismatches between the installed ICU build, and whatever
Expand All @@ -31,8 +36,17 @@ int main()
UErrorCode err = U_ZERO_ERROR;
UChar32 c = ::u_charFromName(U_UNICODE_CHAR_NAME, "GREEK SMALL LETTER ALPHA", &err);
std::cout << (int)c << std::endl;
if(err > 0) return err;
if(err > 0)
{
print_error(err, "u_charFromName");
return err;
}
U_NAMESPACE_QUALIFIER Locale l;
boost::scoped_ptr<U_NAMESPACE_QUALIFIER Collator> p_col(U_NAMESPACE_QUALIFIER Collator::createInstance(l, err));
if(err > 0)
{
print_error(err, "Collator::createInstance");
return err;
}
return err > 0 ? err : 0;
}

0 comments on commit e3228b6

Please sign in to comment.