SConstruct (10866:0421e52a57af) SConstruct (10878:0e466ba12a99)
1# -*- mode:python -*-
2
3# Copyright (c) 2013, 2015 ARM Limited
4# All rights reserved.
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating

--- 542 unchanged lines hidden (view full) ---

551# Set up default C++ compiler flags
552if main['GCC'] or main['CLANG']:
553 # As gcc and clang share many flags, do the common parts here
554 main.Append(CCFLAGS=['-pipe'])
555 main.Append(CCFLAGS=['-fno-strict-aliasing'])
556 # Enable -Wall and then disable the few warnings that we
557 # consistently violate
558 main.Append(CCFLAGS=['-Wall', '-Wno-sign-compare', '-Wundef'])
1# -*- mode:python -*-
2
3# Copyright (c) 2013, 2015 ARM Limited
4# All rights reserved.
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating

--- 542 unchanged lines hidden (view full) ---

551# Set up default C++ compiler flags
552if main['GCC'] or main['CLANG']:
553 # As gcc and clang share many flags, do the common parts here
554 main.Append(CCFLAGS=['-pipe'])
555 main.Append(CCFLAGS=['-fno-strict-aliasing'])
556 # Enable -Wall and then disable the few warnings that we
557 # consistently violate
558 main.Append(CCFLAGS=['-Wall', '-Wno-sign-compare', '-Wundef'])
559 # We always compile using C++11, but only gcc >= 4.7 and clang 3.1
560 # actually use that name, so we stick with c++0x
561 main.Append(CXXFLAGS=['-std=c++0x'])
559 # We always compile using C++11
560 main.Append(CXXFLAGS=['-std=c++11'])
562 # Add selected sanity checks from -Wextra
563 main.Append(CXXFLAGS=['-Wmissing-field-initializers',
564 '-Woverloaded-virtual'])
565else:
566 print termcap.Yellow + termcap.Bold + 'Error' + termcap.Normal,
567 print "Don't know what compiler options to use for your compiler."
568 print termcap.Yellow + ' compiler:' + termcap.Normal, main['CXX']
569 print termcap.Yellow + ' version:' + termcap.Normal,

--- 7 unchanged lines hidden (view full) ---

577 print " environment."
578 print " "
579 print " If you are trying to use a compiler other than those listed"
580 print " above you will need to ease fix SConstruct and "
581 print " src/SConscript to support that compiler."
582 Exit(1)
583
584if main['GCC']:
561 # Add selected sanity checks from -Wextra
562 main.Append(CXXFLAGS=['-Wmissing-field-initializers',
563 '-Woverloaded-virtual'])
564else:
565 print termcap.Yellow + termcap.Bold + 'Error' + termcap.Normal,
566 print "Don't know what compiler options to use for your compiler."
567 print termcap.Yellow + ' compiler:' + termcap.Normal, main['CXX']
568 print termcap.Yellow + ' version:' + termcap.Normal,

--- 7 unchanged lines hidden (view full) ---

576 print " environment."
577 print " "
578 print " If you are trying to use a compiler other than those listed"
579 print " above you will need to ease fix SConstruct and "
580 print " src/SConscript to support that compiler."
581 Exit(1)
582
583if main['GCC']:
585 # Check for a supported version of gcc. >= 4.6 is chosen for its
584 # Check for a supported version of gcc. >= 4.7 is chosen for its
586 # level of c++11 support. See
585 # level of c++11 support. See
587 # http://gcc.gnu.org/projects/cxx0x.html for details. 4.6 is also
588 # the first version with proper LTO support.
586 # http://gcc.gnu.org/projects/cxx0x.html for details.
589 gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
587 gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
590 if compareVersions(gcc_version, "4.6") < 0:
591 print 'Error: gcc version 4.6 or newer required.'
588 if compareVersions(gcc_version, "4.7") < 0:
589 print 'Error: gcc version 4.7 or newer required.'
592 print ' Installed version:', gcc_version
593 Exit(1)
594
595 main['GCC_VERSION'] = gcc_version
596
597 # gcc from version 4.8 and above generates "rep; ret" instructions
598 # to avoid performance penalties on certain AMD chips. Older
599 # assemblers detect this as an error, "Error: expecting string

--- 37 unchanged lines hidden (view full) ---

637 # Use the same amount of jobs for LTO as we are running
638 # scons with
639 main['LTO_LDFLAGS'] = ['-flto=%d' % GetOption('num_jobs')]
640
641 main.Append(TCMALLOC_CCFLAGS=['-fno-builtin-malloc', '-fno-builtin-calloc',
642 '-fno-builtin-realloc', '-fno-builtin-free'])
643
644elif main['CLANG']:
590 print ' Installed version:', gcc_version
591 Exit(1)
592
593 main['GCC_VERSION'] = gcc_version
594
595 # gcc from version 4.8 and above generates "rep; ret" instructions
596 # to avoid performance penalties on certain AMD chips. Older
597 # assemblers detect this as an error, "Error: expecting string

--- 37 unchanged lines hidden (view full) ---

635 # Use the same amount of jobs for LTO as we are running
636 # scons with
637 main['LTO_LDFLAGS'] = ['-flto=%d' % GetOption('num_jobs')]
638
639 main.Append(TCMALLOC_CCFLAGS=['-fno-builtin-malloc', '-fno-builtin-calloc',
640 '-fno-builtin-realloc', '-fno-builtin-free'])
641
642elif main['CLANG']:
645 # Check for a supported version of clang, >= 3.0 is needed to
646 # support similar features as gcc 4.6. See
643 # Check for a supported version of clang, >= 3.1 is needed to
644 # support similar features as gcc 4.7. See
647 # http://clang.llvm.org/cxx_status.html for details
648 clang_version_re = re.compile(".* version (\d+\.\d+)")
649 clang_version_match = clang_version_re.search(CXX_version)
650 if (clang_version_match):
651 clang_version = clang_version_match.groups()[0]
645 # http://clang.llvm.org/cxx_status.html for details
646 clang_version_re = re.compile(".* version (\d+\.\d+)")
647 clang_version_match = clang_version_re.search(CXX_version)
648 if (clang_version_match):
649 clang_version = clang_version_match.groups()[0]
652 if compareVersions(clang_version, "3.0") < 0:
653 print 'Error: clang version 3.0 or newer required.'
650 if compareVersions(clang_version, "3.1") < 0:
651 print 'Error: clang version 3.1 or newer required.'
654 print ' Installed version:', clang_version
655 Exit(1)
656 else:
657 print 'Error: Unable to determine clang version.'
658 Exit(1)
659
660 # clang has a few additional warnings that we disable,
661 # tautological comparisons are allowed due to unsigned integers

--- 775 unchanged lines hidden ---
652 print ' Installed version:', clang_version
653 Exit(1)
654 else:
655 print 'Error: Unable to determine clang version.'
656 Exit(1)
657
658 # clang has a few additional warnings that we disable,
659 # tautological comparisons are allowed due to unsigned integers

--- 775 unchanged lines hidden ---