Skip to content
Snippets Groups Projects
BUILD.gn 35.1 KiB
Newer Older
  configs += [ ":icu_code" ]

  public_configs = [ ":icu_config" ]

  if (is_win || icu_use_data_file) {
Jungshik Shin's avatar
Jungshik Shin committed
    sources += [ "source/stubdata/stubdata.cpp" ]
    defines += [ "U_ICUDATAENTRY_IN_COMMON" ]
  }

  if (is_fuchsia) {
    # Fuchsia puts its own libicuuc.so in /system/lib where we need to put our
    # .so when doing component builds, so we need to give this a different name.
    output_name = "icuuc_cr"
  }
if (is_android && enable_java_templates) {
Peter Kotwicz's avatar
Peter Kotwicz committed
  android_assets("icu_assets") {
    if (icu_use_data_file) {
      sources = [ "$root_out_dir/icudtl.dat" ]
      deps = [ ":icudata" ]
      disable_compression = true
    }
  }
}

# TODO(GYP): Gyp has considerations here for QNX and for the host toolchain
#  that have not been ported over.
if (is_android) {
  data_dir = "android"
} else if (is_ios) {
  data_dir = "ios"
  data_dir = "common"

if (current_cpu == "mips" || current_cpu == "mips64" ||
    host_byteorder == "big") {
  data_bundle_prefix = "icudtb"
} else {
  data_bundle_prefix = "icudtl"
}
data_bundle = "${data_bundle_prefix}.dat"
# TODO(GYP) support use_system_icu.
if (icu_use_data_file) {
  if (is_ios) {
      sources = [ "$data_dir/$data_bundle" ]
      outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
  } else {
    copy("icudata") {
      sources = [ "$data_dir/$data_bundle" ]
      outputs = [ "$root_out_dir/$data_bundle" ]
      data = [ "$root_out_dir/$data_bundle" ]
    }
  }
} else {
  if (is_win) {
    # On Windows the target DLL is pre-built so just use a copy rule.
    # data_bundle and data_dir have to be used to avoid 'unused variable'
    # error.
    data_bundle = "icudt.dll"
    data_dir = "windows"
    copy("icudata") {
      sources = [ "$data_dir/$data_bundle" ]
      outputs = [ "$root_out_dir/$data_bundle" ]
      data = outputs
    data_assembly = "$target_gen_dir/${data_bundle_prefix}_dat.S"
    action("make_data_assembly") {
      script = "scripts/make_data_assembly.py"
      inputs = [ "$data_dir/$data_bundle" ]
      outputs = [ "$data_assembly" ]
      args = [
        rebase_path(inputs[0], root_build_dir),
        rebase_path(data_assembly, root_build_dir),
      ]
      # TODO(GYP): Gyp has considerations here for QNX and for the host
      # toolchain that have not been ported over.
      if (is_mac || is_ios) {
        args += [ "--mac" ]
    }

    source_set("icudata") {
      sources = [ "$data_assembly" ]
      defines = [ "U_HIDE_DATA_SYMBOL" ]
      deps = [ ":make_data_assembly", ]