Skip to content

Commit

Permalink
Merge pull request #1274 from jgsogo/feat/boost-icu
Browse files Browse the repository at this point in the history
[boost] Optionally use ICU
  • Loading branch information
danimtb authored Apr 23, 2020
2 parents b35a466 + 67086e2 commit b013b05
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion recipes/boost/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class BoostConan(ConanFile):
"segmented_stacks": [True, False],
"debug_level": [i for i in range(1, 14)],
"pch": [True, False],
"extra_b2_flags": "ANY" # custom b2 flags
"extra_b2_flags": "ANY", # custom b2 flags
"i18n_backend": ["iconv", "icu", None],
}
options.update({"without_%s" % libname: [True, False] for libname in lib_list})

Expand All @@ -80,6 +81,7 @@ class BoostConan(ConanFile):
"debug_level": 2,
'pch': True,
'extra_b2_flags': 'None',
"i18n_backend": 'iconv',
}

for libname in lib_list:
Expand Down Expand Up @@ -119,6 +121,10 @@ def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
if not self.options.i18n_backend and not self.options.without_locale:
raise ConanInvalidConfiguration("Boost 'locale' library requires a i18n_backend, either 'icu' or 'iconv'")

def build_requirements(self):
self.build_requires("b2/4.2.0")

Expand All @@ -132,6 +138,8 @@ def requirements(self):
self.requires("xz_utils/5.2.4")
if self.options.zstd:
self.requires("zstd/1.4.3")
if self.options.i18n_backend == 'icu':
self.requires("icu/64.2")

def package_id(self):
if self.options.header_only:
Expand Down Expand Up @@ -539,6 +547,15 @@ def _build_flags(self):
flags.append("-sNO_LZMA=%s" % ("0" if self.options.lzma else "1"))
flags.append("-sNO_ZSTD=%s" % ("0" if self.options.zstd else "1"))

if self.options.i18n_backend == 'icu':
flags.append("-sICU_PATH={}".format(self.deps_cpp_info["icu"].rootpath))
flags.append("boost.locale.iconv=off boost.locale.icu=on")
elif self.options.i18n_backend == 'iconv':
flags.append("boost.locale.iconv=on boost.locale.icu=off")
else:
flags.append("boost.locale.iconv=off boost.locale.icu=off")
flags.append("--disable-icu --disable-iconvv")

def add_defines(option, library):
if option:
for define in self.deps_cpp_info[library].defines:
Expand Down

0 comments on commit b013b05

Please sign in to comment.