diff options
author | Daniel Bratell <bratell@opera.com> | 2018-10-31 11:39:12 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2018-10-31 11:39:12 +0000 |
commit | dde5ce526c84143fb931a5191dd4623ae6d197d6 (patch) | |
tree | 76e162743aa5c55c8d4818dcc8807c8f03c7c0d0 /BUILD.gn | |
parent | c44fb7248079cc3d5563b14b3f758aee60d6b415 (diff) | |
download | zlib-dde5ce526c84143fb931a5191dd4623ae6d197d6.tar.gz |
[zlib] Make build system pass gn check
There are some circular include dependencies in the zlib
build system because some parts are extracted into their
own targets. To make gn check understand that, those targets
need to be added to the allow_circular_includes_from list.
Bug: 898837
Change-Id: Ic94c5f5ac88e10792b458f4d734c4ad0487023c2
Reviewed-on: https://chromium-review.googlesource.com/c/1299135
Reviewed-by: Chris Blume <cblume@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Original-Commit-Position: refs/heads/master@{#604210}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: f2f7bfe61121c05d9a510b949931e395dce40608
Diffstat (limited to 'BUILD.gn')
-rw-r--r-- | BUILD.gn | 121 |
1 files changed, 52 insertions, 69 deletions
@@ -10,22 +10,30 @@ config("zlib_config") { include_dirs = [ "." ] } +use_arm_neon_optimizations = false +if (current_cpu == "arm" || current_cpu == "arm64") { + if (arm_use_neon) { + use_arm_neon_optimizations = true + } +} + +use_x86_x64_optimizations = + (current_cpu == "x86" || current_cpu == "x64") && !is_ios + config("zlib_adler32_simd_config") { - if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) { + if (use_x86_x64_optimizations) { defines = [ "ADLER32_SIMD_SSSE3" ] } - if (current_cpu == "arm" || current_cpu == "arm64") { - if (arm_use_neon) { - defines = [ "ADLER32_SIMD_NEON" ] - } + if (use_arm_neon_optimizations) { + defines = [ "ADLER32_SIMD_NEON" ] } } source_set("zlib_adler32_simd") { visibility = [ ":*" ] - if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) { + if (use_x86_x64_optimizations) { sources = [ "adler32_simd.c", "adler32_simd.h", @@ -36,26 +44,23 @@ source_set("zlib_adler32_simd") { } } - if (current_cpu == "arm" || current_cpu == "arm64") { - if (arm_use_neon) { - sources = [ - "adler32_simd.c", - "adler32_simd.h", - ] - - if (!is_debug) { - # Use optimize_speed (-O3) to output the _smallest_ code. - configs -= [ "//build/config/compiler:default_optimization" ] - configs += [ "//build/config/compiler:optimize_speed" ] - } + if (use_arm_neon_optimizations) { + sources = [ + "adler32_simd.c", + "adler32_simd.h", + ] + if (!is_debug) { + # Use optimize_speed (-O3) to output the _smallest_ code. + configs -= [ "//build/config/compiler:default_optimization" ] + configs += [ "//build/config/compiler:optimize_speed" ] } } public_configs = [ ":zlib_adler32_simd_config" ] } -config("zlib_arm_crc32_config") { - if (current_cpu == "arm" || current_cpu == "arm64") { +if (use_arm_neon_optimizations) { + config("zlib_arm_crc32_config") { # Restrictions: # - Disabled for iPhones, as described in DDI0487C_a_armv8_arm: # "All implementations of the ARMv8.1 architecture are required to @@ -72,9 +77,7 @@ config("zlib_arm_crc32_config") { } } } -} -if (current_cpu == "arm" || current_cpu == "arm64") { source_set("zlib_arm_crc32") { visibility = [ ":*" ] @@ -108,7 +111,7 @@ if (current_cpu == "arm" || current_cpu == "arm64") { } config("zlib_inflate_chunk_simd_config") { - if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) { + if (use_x86_x64_optimizations) { defines = [ "INFLATE_CHUNK_SIMD_SSE2" ] if (current_cpu == "x64") { @@ -116,17 +119,15 @@ config("zlib_inflate_chunk_simd_config") { } } - if (current_cpu == "arm" || current_cpu == "arm64") { - if (arm_use_neon) { - defines = [ "INFLATE_CHUNK_SIMD_NEON" ] - } + if (use_arm_neon_optimizations) { + defines = [ "INFLATE_CHUNK_SIMD_NEON" ] } } source_set("zlib_inflate_chunk_simd") { visibility = [ ":*" ] - if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) { + if (use_x86_x64_optimizations || use_arm_neon_optimizations) { include_dirs = [ "." ] sources = [ @@ -135,26 +136,13 @@ source_set("zlib_inflate_chunk_simd") { "contrib/optimizations/inffast_chunk.h", "contrib/optimizations/inflate.c", ] - } - - if (current_cpu == "arm" || current_cpu == "arm64") { - if (arm_use_neon) { - include_dirs = [ "." ] - - sources = [ - "contrib/optimizations/chunkcopy.h", - "contrib/optimizations/inffast_chunk.c", - "contrib/optimizations/inffast_chunk.h", - "contrib/optimizations/inflate.c", - ] - if (!is_debug) { - # Here we trade better performance on newer/bigger ARMv8 cores - # for less perf on ARMv7. For details, check: - # https://bugs.chromium.org/p/chromium/issues/detail?id=772870#c40 - configs -= [ "//build/config/compiler:default_optimization" ] - configs += [ "//build/config/compiler:optimize_speed" ] - } + if (use_arm_neon_optimizations && !is_debug) { + # Here we trade better performance on newer/bigger ARMv8 cores + # for less perf on ARMv7. For details, check: + # https://bugs.chromium.org/p/chromium/issues/detail?id=772870#c40 + configs -= [ "//build/config/compiler:default_optimization" ] + configs += [ "//build/config/compiler:optimize_speed" ] } } @@ -165,7 +153,7 @@ source_set("zlib_inflate_chunk_simd") { } config("zlib_crc32_simd_config") { - if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) { + if (use_x86_x64_optimizations) { defines = [ "CRC32_SIMD_SSE42_PCLMUL" ] } } @@ -173,7 +161,7 @@ config("zlib_crc32_simd_config") { source_set("zlib_crc32_simd") { visibility = [ ":*" ] - if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) { + if (use_x86_x64_optimizations) { sources = [ "crc32_simd.c", "crc32_simd.h", @@ -193,7 +181,7 @@ source_set("zlib_crc32_simd") { static_library("zlib_x86_simd") { visibility = [ ":*" ] - if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) { + if (use_x86_x64_optimizations) { sources = [ "crc_folding.c", "fill_window_sse.c", @@ -216,7 +204,7 @@ static_library("zlib_x86_simd") { } config("zlib_warnings") { - if (is_clang && !is_ios && (current_cpu == "x86" || current_cpu == "x64")) { + if (is_clang && use_x86_x64_optimizations) { cflags = [ "-Wno-incompatible-pointer-types" ] } } @@ -243,7 +231,6 @@ static_library("zlib") { "inffast.c", "inffast.h", "inffixed.h", - "inflate.c", "inflate.h", "inftrees.c", "inftrees.h", @@ -261,26 +248,21 @@ static_library("zlib") { defines = [] deps = [] - if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) { - deps += [ ":zlib_crc32_simd" ] - - deps += [ ":zlib_adler32_simd" ] - sources += [ "x86.c" ] - - deps += [ ":zlib_inflate_chunk_simd" ] - sources -= [ "inflate.c" ] - } - - if (current_cpu == "arm" || current_cpu == "arm64") { - if (arm_use_neon) { - deps += [ ":zlib_adler32_simd" ] - - deps += [ ":zlib_arm_crc32" ] + if (use_x86_x64_optimizations || use_arm_neon_optimizations) { + deps += [ + ":zlib_adler32_simd", + ":zlib_inflate_chunk_simd", + ] - deps += [ ":zlib_inflate_chunk_simd" ] - sources -= [ "inflate.c" ] + if (use_x86_x64_optimizations) { + sources += [ "x86.c" ] + deps += [ ":zlib_crc32_simd" ] + } else if (use_arm_neon_optimizations) { sources += [ "contrib/optimizations/slide_hash_neon.h" ] + deps += [ ":zlib_arm_crc32" ] } + } else { + sources += [ "inflate.c" ] } configs -= [ "//build/config/compiler:chromium_code" ] @@ -294,6 +276,7 @@ static_library("zlib") { public_configs = [ ":zlib_config" ] deps += [ ":zlib_x86_simd" ] + allow_circular_includes_from = deps } config("minizip_warnings") { |