| OLD | NEW |
| (Empty) | |
| 1 #!/usr/bin/python2.4 |
| 2 # Copyright 2008, Google Inc. |
| 3 # All rights reserved. |
| 4 # |
| 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are |
| 7 # met: |
| 8 # |
| 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. |
| 11 # * Redistributions in binary form must reproduce the above |
| 12 # copyright notice, this list of conditions and the following disclaimer |
| 13 # in the documentation and/or other materials provided with the |
| 14 # distribution. |
| 15 # * Neither the name of Google Inc. nor the names of its |
| 16 # contributors may be used to endorse or promote products derived from |
| 17 # this software without specific prior written permission. |
| 18 # |
| 19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 |
| 31 """Build tool setup for Linux. |
| 32 |
| 33 This module is a SCons tool which should be include in the topmost windows |
| 34 environment. |
| 35 It is used as follows: |
| 36 env = base_env.Clone(tools = ['component_setup']) |
| 37 linux_env = base_env.Clone(tools = ['target_platform_linux']) |
| 38 """ |
| 39 |
| 40 |
| 41 def ComponentPlatformSetup(env, builder_name): |
| 42 """Hook to allow platform to modify environment inside a component builder. |
| 43 |
| 44 Args: |
| 45 env: Environment to modify |
| 46 builder_name: Name of the builder |
| 47 """ |
| 48 if env.get('ENABLE_EXCEPTIONS'): |
| 49 env.FilterOut(CCFLAGS=['-fno-exceptions']) |
| 50 env.Append(CCFLAGS=['-fexceptions']) |
| 51 |
| 52 #------------------------------------------------------------------------------ |
| 53 |
| 54 |
| 55 def generate(env): |
| 56 # NOTE: SCons requires the use of this name, which fails gpylint. |
| 57 """SCons entry point for this tool.""" |
| 58 |
| 59 # Use g++ |
| 60 env.Tool('g++') |
| 61 env.Tool('gcc') |
| 62 env.Tool('gnulink') |
| 63 env.Tool('ar') |
| 64 env.Tool('as') |
| 65 |
| 66 # Declare bits |
| 67 DeclareBit('linux', 'Target platform is linux.', |
| 68 exclusive_groups=('target_platform')) |
| 69 DeclareBit('posix', 'Target platform is posix.') |
| 70 env.SetBits('linux', 'posix') |
| 71 |
| 72 env.Replace( |
| 73 TARGET_PLATFORM='LINUX', |
| 74 COMPONENT_PLATFORM_SETUP=ComponentPlatformSetup, |
| 75 ) |
| 76 |
| 77 env.Append( |
| 78 HOST_PLATFORMS=['LINUX'], |
| 79 CPPDEFINES=['OS_LINUX=OS_LINUX'], |
| 80 |
| 81 # Settings for debug |
| 82 CCFLAGS_DEBUG=[ |
| 83 '-O0', # turn off optimizations |
| 84 '-g', # turn on debugging info |
| 85 ], |
| 86 |
| 87 # Settings for optimized |
| 88 CCFLAGS_OPTIMIZED=['-O2'], |
| 89 |
| 90 # Settings for component_builders |
| 91 COMPONENT_LIBRARY_LINK_SUFFIXES=['.so', '.a'], |
| 92 COMPONENT_LIBRARY_DEBUG_SUFFIXES=[], |
| 93 ) |
| OLD | NEW |