1# Copyright (c) 2012 The ANGLE Project 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{
6    'variables':
7    {
8        'angle_code': 1,
9        'angle_post_build_script%': 0,
10        'angle_gen_path': '<(SHARED_INTERMEDIATE_DIR)/angle',
11        'angle_id_script_base': 'commit_id.py',
12        'angle_id_script': '<(angle_gen_path)/<(angle_id_script_base)',
13        'angle_id_header_base': 'commit.h',
14        'angle_id_header': '<(angle_gen_path)/id/<(angle_id_header_base)',
15        'angle_use_commit_id%': '<!(python <(angle_id_script_base) check ..)',
16    },
17    'includes':
18    [
19        'compiler.gypi',
20        'libGLESv2.gypi',
21        'libEGL.gypi'
22    ],
23
24    'targets':
25    [
26        {
27            'target_name': 'copy_scripts',
28            'type': 'none',
29            'hard_dependency': 1,
30            'copies':
31            [
32                {
33                    'destination': '<(angle_gen_path)',
34                    'files': [ 'copy_compiler_dll.bat', '<(angle_id_script_base)' ],
35                },
36            ],
37        },
38    ],
39    'conditions':
40    [
41        ['angle_use_commit_id!=0',
42        {
43            'targets':
44            [
45                {
46                    'target_name': 'commit_id',
47                    'type': 'none',
48                    'includes': [ '../build/common_defines.gypi', ],
49                    'dependencies': [ 'copy_scripts', ],
50                    'hard_dependency': 1,
51                    'actions':
52                    [
53                        {
54                            'action_name': 'Generate ANGLE Commit ID Header',
55                            'message': 'Generating ANGLE Commit ID',
56                            # reference the git index as an input, so we rebuild on changes to the index
57                            'inputs': [ '<(angle_id_script)', '<(angle_path)/.git/index' ],
58                            'outputs': [ '<(angle_id_header)' ],
59                            'msvs_cygwin_shell': 0,
60                            'action':
61                            [
62                                'python', '<(angle_id_script)', 'gen', '<(angle_path)', '<(angle_id_header)'
63                            ],
64                        },
65                    ],
66                    'all_dependent_settings':
67                    {
68                        'include_dirs':
69                        [
70                            '<(angle_gen_path)',
71                        ],
72                    },
73                }
74            ]
75        },
76        { # angle_use_commit_id==0
77            'targets':
78            [
79                {
80                    'target_name': 'commit_id',
81                    'type': 'none',
82                    'hard_dependency': 1,
83                    'copies':
84                    [
85                        {
86                            'destination': '<(angle_gen_path)/id',
87                            'files': [ '<(angle_id_header_base)' ]
88                        }
89                    ],
90                    'all_dependent_settings':
91                    {
92                        'include_dirs':
93                        [
94                            '<(angle_gen_path)',
95                        ],
96                    },
97                }
98            ]
99        }],
100        ['OS=="win"',
101        {
102            'targets':
103            [
104                {
105                    'target_name': 'copy_compiler_dll',
106                    'type': 'none',
107                    'dependencies': [ 'copy_scripts', ],
108                    'includes': [ '../build/common_defines.gypi', ],
109                    'actions':
110                    [
111                        {
112                            'action_name': 'copy_dll',
113                            'message': 'Copying D3D Compiler DLL...',
114                            'msvs_cygwin_shell': 0,
115                            'inputs': [ 'copy_compiler_dll.bat' ],
116                            'outputs': [ '<(PRODUCT_DIR)/d3dcompiler_46.dll' ],
117                            'action':
118                            [
119                                "<(angle_gen_path)/copy_compiler_dll.bat",
120                                "$(PlatformName)",
121                                "<(windows_sdk_path)",
122                                "<(PRODUCT_DIR)"
123                            ],
124                        },
125                    ], #actions
126                },
127            ], # targets
128        }],
129        ['angle_post_build_script!=0 and OS=="win"',
130        {
131            'targets':
132            [
133                {
134                    'target_name': 'post_build',
135                    'type': 'none',
136                    'includes': [ '../build/common_defines.gypi', ],
137                    'dependencies': [ 'libGLESv2', 'libEGL' ],
138                    'actions':
139                    [
140                        {
141                            'action_name': 'ANGLE Post-Build Script',
142                            'message': 'Running <(angle_post_build_script)...',
143                            'msvs_cygwin_shell': 0,
144                            'inputs': [ '<(angle_post_build_script)', '<!@(["python", "<(angle_post_build_script)", "inputs", "<(angle_path)", "<(CONFIGURATION_NAME)", "$(PlatformName)", "<(PRODUCT_DIR)"])' ],
145                            'outputs': [ '<!@(python <(angle_post_build_script) outputs "<(angle_path)" "<(CONFIGURATION_NAME)" "$(PlatformName)" "<(PRODUCT_DIR)")' ],
146                            'action': ['python', '<(angle_post_build_script)', 'run', '<(angle_path)', '<(CONFIGURATION_NAME)', '$(PlatformName)', '<(PRODUCT_DIR)'],
147                        },
148                    ], #actions
149                },
150            ], # targets
151        }],
152    ] # conditions
153}
154