Home | History | Annotate | Download | only in ios
      1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 # Xcode throws an error if an iOS target depends on a Mac OS X target. So
      6 # any place a utility program needs to be build and run, an action is
      7 # used to run ninja as script to work around this.
      8 # Example:
      9 # {
     10 #   'target_name': 'foo',
     11 #   'type': 'none',
     12 #   'variables': {
     13 #     # The name of a directory used for ninja. This cannot be shared with
     14 #     # another mac build.
     15 #     'ninja_output_dir': 'ninja-foo',
     16 #     # The full path to the location in which the ninja executable should be
     17 #     # placed. This cannot be shared with another mac build.
     18 #    'ninja_product_dir':
     19 #      '<(DEPTH)/xcodebuild/<(ninja_output_dir)/<(CONFIGURATION_NAME)',
     20 #     # The list of all the gyp files that contain the targets to run.
     21 #     're_run_targets': [
     22 #       'foo.gyp',
     23 #     ],
     24 #   },
     25 #   'includes': ['path_to/mac_build.gypi'],
     26 #   'actions': [
     27 #     {
     28 #       'action_name': 'compile foo',
     29 #       'inputs': [],
     30 #       'outputs': [],
     31 #       'action': [
     32 #         '<@(ninja_cmd)',
     33 #         # All the targets to build.
     34 #         'foo1',
     35 #         'foo2',
     36 #       ],
     37 #     },
     38 #   ],
     39 # }
     40 {
     41   'variables': {
     42     'variables': {
     43      'parent_generator%': '<(GENERATOR)',
     44     },
     45     'parent_generator%': '<(parent_generator)',
     46     # Common ninja command line flags.
     47     'ninja_cmd': [
     48       # Bounce through clean_env to clean up the environment so things
     49       # set by the iOS build don't pollute the Mac build.
     50       '<(DEPTH)/build/ios/clean_env.py',
     51       # ninja must be found in the PATH.
     52       'ADD_TO_PATH=<!(echo $PATH)',
     53       'ninja',
     54       '-C',
     55       '<(ninja_product_dir)',
     56     ],
     57 
     58     # Common syntax to rerun gyp to generate the Mac projects.
     59     're_run_gyp': [
     60       'build/gyp_chromium',
     61       '--depth=.',
     62       # Don't use anything set for the iOS side of things.
     63       '--ignore-environment',
     64       # Generate for ninja
     65       '--format=ninja',
     66       # Generate files into xcodebuild/ninja
     67       '-Goutput_dir=xcodebuild/<(ninja_output_dir)',
     68       # nacl isn't in the iOS checkout, make sure it's turned off
     69       '-Ddisable_nacl=1',
     70       # Add a variable to handle specific cases for mac_build.
     71       '-Dios_mac_build=1',
     72       # Pass through the Mac SDK version.
     73       '-Dmac_sdk=<(mac_sdk)',
     74       '-Dparent_generator=<(parent_generator)'
     75     ],
     76 
     77     # Rerun gyp for each of the projects needed. This is what actually
     78     # generates the projects on disk.
     79     're_run_gyp_execution':
     80       '<!(cd <(DEPTH) && <@(re_run_gyp) <@(re_run_targets))',
     81   },
     82   # Since these are used to generate things needed by other targets, make
     83   # them hard dependencies so they are always built first.
     84   'hard_dependency': 1,
     85 }
     86