diff --git a/clang.gypi b/clang.gypi deleted file mode 100644 index 65f0598ba8e3..000000000000 --- a/clang.gypi +++ /dev/null @@ -1,49 +0,0 @@ -{ - 'variables': { - # Clang stuff. - 'make_clang_dir%': 'vendor/llvm-build/Release+Asserts', - # Set this to true when building with Clang. - 'clang%': 1, - 'conditions': [ - ['OS=="win"', { - # Do not use Clang on Windows. - 'clang%': 0, - }], - ], - }, - 'conditions': [ - ['clang==1', { - 'make_global_settings': [ - ['CC', '<(make_clang_dir)/bin/clang'], - ['CXX', '<(make_clang_dir)/bin/clang++'], - ['CC.host', '$(CC)'], - ['CXX.host', '$(CXX)'], - ], - 'target_defaults': { - 'cflags_cc': [ - '-std=c++11', - ], - 'xcode_settings': { - 'CC': '<(make_clang_dir)/bin/clang', - 'LDPLUSPLUS': '<(make_clang_dir)/bin/clang++', - 'OTHER_CFLAGS': [ - '-fcolor-diagnostics', - ], - - 'GCC_C_LANGUAGE_STANDARD': 'c99', # -std=c99 - 'CLANG_CXX_LIBRARY': 'libc++', # -stdlib=libc++ - 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11', # -std=c++11 - }, - 'target_conditions': [ - ['_type in ["executable", "shared_library"]', { - 'xcode_settings': { - # On some machines setting CLANG_CXX_LIBRARY doesn't work for - # linker. - 'OTHER_LDFLAGS': [ '-stdlib=libc++' ], - }, - }], - ], - }, - }], # clang==1 - ], -} diff --git a/common.gypi b/common.gypi index 6ca091d2686c..8d1742e96639 100644 --- a/common.gypi +++ b/common.gypi @@ -1,6 +1,6 @@ { 'includes': [ - 'clang.gypi', + 'toolchain.gypi', 'vendor/brightray/brightray.gypi', ], 'variables': { diff --git a/script/lib/config.py b/script/lib/config.py index 274779d44a67..3c171b5b5355 100644 --- a/script/lib/config.py +++ b/script/lib/config.py @@ -20,29 +20,18 @@ verbose_mode = False def get_target_arch(): - # Always build 64bit on OS X. - if PLATFORM == 'darwin': - return 'x64' - # Only build for host's arch on Linux. - elif PLATFORM == 'linux': - if platform.architecture()[0] == '32bit': - return 'ia32' - else: - return 'x64' - # On Windows it depends on user. - elif PLATFORM == 'win32': - try: - target_arch_path = os.path.join(__file__, '..', '..', '..', 'vendor', - 'brightray', 'vendor', 'download', - 'libchromiumcontent', '.target_arch') - with open(os.path.normpath(target_arch_path)) as f: - return f.read().strip() - except IOError as e: - if e.errno != errno.ENOENT: - raise - # Build 32bit by default. + try: + target_arch_path = os.path.join(__file__, '..', '..', '..', 'vendor', + 'brightray', 'vendor', 'download', + 'libchromiumcontent', '.target_arch') + with open(os.path.normpath(target_arch_path)) as f: + return f.read().strip() + except IOError as e: + if e.errno != errno.ENOENT: + raise + + if PLATFORM == 'win32': return 'ia32' - # Maybe we will support other platforms in future. else: return 'x64' diff --git a/script/update.py b/script/update.py index 23497ff9e5ac..8d850905b529 100755 --- a/script/update.py +++ b/script/update.py @@ -44,7 +44,7 @@ def run_gyp(target_arch, component): defines = [ '-Dlibchromiumcontent_component={0}'.format(component), '-Dtarget_arch={0}'.format(target_arch), - '-Dhost_arch={0}'.format(target_arch), + '-Dhost_arch=x64', '-Dlibrary=static_library', ] return subprocess.call([python, gyp, '-f', 'ninja', '--depth', '.', diff --git a/toolchain.gypi b/toolchain.gypi new file mode 100644 index 000000000000..1b96ac3ab68d --- /dev/null +++ b/toolchain.gypi @@ -0,0 +1,200 @@ +{ + 'variables': { + # Clang stuff. + 'make_clang_dir%': 'vendor/llvm-build/Release+Asserts', + # Set this to true when building with Clang. + 'clang%': 1, + + 'variables': { + # Set ARM architecture version. + 'arm_version%': 7, + + # Set NEON compilation flags. + 'arm_neon%': 1, + }, + + # Copy conditionally-set variables out one scope. + 'arm_version%': '<(arm_version)', + 'arm_neon%': '<(arm_neon)', + + # Variables to control Link-Time Optimization (LTO). + 'use_lto%': 0, + 'use_lto_o2%': 0, + + 'conditions': [ + # Do not use Clang on Windows. + ['OS=="win"', { + 'clang%': 0, + }], # OS=="win" + + # Set default compiler flags depending on ARM version. + ['arm_version==6', { + 'arm_arch%': 'armv6', + 'arm_tune%': '', + 'arm_fpu%': 'vfp', + 'arm_float_abi%': 'softfp', + 'arm_thumb%': 0, + }], # arm_version==6 + ['arm_version==7', { + 'arm_arch%': 'armv7-a', + 'arm_tune%': 'generic-armv7-a', + 'conditions': [ + ['arm_neon==1', { + 'arm_fpu%': 'neon', + }, { + 'arm_fpu%': 'vfpv3-d16', + }], + ], + 'arm_float_abi%': 'hard', + 'arm_thumb%': 1, + }], # arm_version==7 + ], + }, + 'conditions': [ + ['clang==1', { + 'make_global_settings': [ + ['CC', '<(make_clang_dir)/bin/clang'], + ['CXX', '<(make_clang_dir)/bin/clang++'], + ['CC.host', '$(CC)'], + ['CXX.host', '$(CXX)'], + ], + 'target_defaults': { + 'cflags_cc': [ + '-std=c++11', + ], + 'xcode_settings': { + 'CC': '<(make_clang_dir)/bin/clang', + 'LDPLUSPLUS': '<(make_clang_dir)/bin/clang++', + 'OTHER_CFLAGS': [ + '-fcolor-diagnostics', + ], + + 'GCC_C_LANGUAGE_STANDARD': 'c99', # -std=c99 + 'CLANG_CXX_LIBRARY': 'libc++', # -stdlib=libc++ + 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11', # -std=c++11 + }, + 'target_conditions': [ + ['_type in ["executable", "shared_library"]', { + 'xcode_settings': { + # On some machines setting CLANG_CXX_LIBRARY doesn't work for + # linker. + 'OTHER_LDFLAGS': [ '-stdlib=libc++' ], + }, + }], + ], + }, + }], # clang==1 + + ['OS=="linux"', { + 'target_defaults': { + 'target_conditions': [ + ['target_arch=="ia32" and _toolset=="target"', { + 'asflags': [ + '-32', + ], + 'cflags': [ + '-msse2', + '-mfpmath=sse', + '-mmmx', # Allows mmintrin.h for MMX intrinsics. + '-m32', + ], + 'ldflags': [ + '-m32', + ], + }], # target_arch=="ia32" and _toolset=="target" + ['target_arch=="x64" and _toolset=="target"', { + 'cflags': [ + '-m64', + '-march=x86-64', + ], + 'ldflags': [ + '-m64', + ], + }], # target_arch=="x64" and _toolset=="target" + ['target_arch=="arm" and _toolset=="target"', { + 'conditions': [ + ['clang==0', { + 'cflags_cc': [ + '-Wno-abi', + ], + }], + ['clang==1 and arm_arch!=""', { + 'cflags': [ + '-target arm-linux-gnueabihf', + ], + 'ldflags': [ + '-target arm-linux-gnueabihf', + ], + }], + ['arm_arch!=""', { + 'cflags': [ + '-march=<(arm_arch)', + ], + 'conditions': [ + ['use_lto==1 or use_lto_o2==1', { + 'ldflags': [ + '-march=<(arm_arch)', + ], + }], + ], + }], + ['clang==1', { + 'cflags': [ + '-no-integrated-as', + ], + }], + ['arm_tune!=""', { + 'cflags': [ + '-mtune=<(arm_tune)', + ], + 'conditions': [ + ['use_lto==1 or use_lto_o2==1', { + 'ldflags': [ + '-mtune=<(arm_tune)', + ], + }], + ], + }], + ['arm_fpu!=""', { + 'cflags': [ + '-mfpu=<(arm_fpu)', + ], + 'conditions': [ + ['use_lto==1 or use_lto_o2==1', { + 'ldflags': [ + '-mfpu=<(arm_fpu)', + ], + }], + ], + }], + ['arm_float_abi!=""', { + 'cflags': [ + '-mfloat-abi=<(arm_float_abi)', + ], + 'conditions': [ + ['use_lto==1 or use_lto_o2==1', { + 'ldflags': [ + '-mfloat-abi=<(arm_float_abi)', + ], + }], + ], + }], + ['arm_thumb==1', { + 'cflags': [ + '-mthumb', + ], + 'conditions': [ + ['use_lto==1 or use_lto_o2==1', { + 'ldflags': [ + '-mthumb', + ], + }], + ], + }], + ], + }], # target_arch=="arm" and _toolset=="target" + ], + }, + }], # OS=="linux" + ], +} diff --git a/vendor/brightray b/vendor/brightray index 6de84e1d3a84..89f8190ea519 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 6de84e1d3a84555f6ca651ba1e75ecaf8582f95a +Subproject commit 89f8190ea519181bbb276b2d0da2273345d3d406