Skip to content

Commit

Permalink
Merge pull request #8 from ubiquiti/bitcode-fix
Browse files Browse the repository at this point in the history
bitcode fix
  • Loading branch information
Gavriloaie Eugen-Andrei authored Jan 14, 2021
2 parents c504d28 + c8a1407 commit a1b68fc
Showing 1 changed file with 46 additions and 40 deletions.
86 changes: 46 additions & 40 deletions config/ios/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -24,49 +24,48 @@ declare_args() {
enable_ios_bitcode = false
}

# CPU architecture.
if (current_cpu == "x64") {
triplet_cpu = "x86_64"
} else if (current_cpu == "x86") {
triplet_cpu = "i386"
} else if (current_cpu == "arm" || current_cpu == "armv7") {
triplet_cpu = "armv7"
} else if (current_cpu == "arm64") {
triplet_cpu = "arm64"
} else {
assert(false, "unsupported cpu: $current_cpu")
}

# Environment.
if (ios_device_name == "macosx") {
target_environment = "catalyst"
}
if (target_environment == "simulator") {
triplet_environment = "-simulator"
} else if (target_environment == "device") {
triplet_environment = ""
} else if (target_environment == "catalyst") {
triplet_environment = "-macabi"
} else {
assert(false, "unsupported environment: $target_environment")
}

# OS.
triplet_os = ""
if ((ios_device_name == "iphone") || (ios_device_name == "macosx")) {
triplet_os = "apple-ios"
} else if (ios_device_name == "appletv") {
triplet_os = "apple-tvos"
} else {
assert(false, "unsupported device: $ios_device_name")
}

# This is included by reference in the //build/config/compiler config that
# is applied to all targets. It is here to separate out the logic.
config("compiler") {
# These flags are shared between the C compiler and linker.
common_flags = []

# CPU architecture.
if (current_cpu == "x64") {
triplet_cpu = "x86_64"
} else if (current_cpu == "x86") {
triplet_cpu = "i386"
} else if (current_cpu == "arm" || current_cpu == "armv7") {
triplet_cpu = "armv7"
} else if (current_cpu == "arm64") {
triplet_cpu = "arm64"
} else {
assert(false, "unsupported cpu: $current_cpu")
}

# Environment.
if (ios_device_name == "macosx") {
target_environment = "catalyst"
}
if (target_environment == "simulator") {
triplet_environment = "-simulator"
} else if (target_environment == "device") {
triplet_environment = ""
} else if (target_environment == "catalyst") {
triplet_environment = "-macabi"
} else {
assert(false, "unsupported environment: $target_environment")
}

# OS.
triplet_os = ""
if ((ios_device_name == "iphone") || (ios_device_name == "macosx")) {
triplet_os = "apple-ios"
} else if (ios_device_name == "appletv") {
triplet_os = "apple-tvos"
} else {
assert(false, "unsupported device: $ios_device_name")
}

common_flags = []

# Set target.
common_flags = [
Expand Down Expand Up @@ -127,7 +126,14 @@ config("runtime_library") {
]
}

if (use_xcode_clang && enable_ios_bitcode && target_environment == "device") {
# print("use_xcode_clang: ${use_xcode_clang}")
# print("enable_ios_bitcode: ${enable_ios_bitcode}")
# print("target_environment: ${target_environment}")

if (use_xcode_clang
&& enable_ios_bitcode
&& ((target_environment == "device") || (target_environment == "catalyst"))
) {
if (is_debug) {
common_flags += [ "-fembed-bitcode-marker" ]
} else {
Expand Down

0 comments on commit a1b68fc

Please sign in to comment.