1import filecmp
2import os
3import subprocess
4from sys import executable as python_cmd
5
6Import('*')
7
8if env['platform'] == 'windows':
9    SConscript('getopt/SConscript')
10
11SConscript('util/SConscript')
12SConscript('compiler/SConscript')
13
14if env['hostonly']:
15    # We are just compiling the things necessary on the host for cross
16    # compilation
17    Return()
18
19
20def write_git_sha1_h_file(filename):
21    """Mesa looks for a git_sha1.h file at compile time in order to display
22    the current git hash id in the GL_VERSION string.  This function tries
23    to retrieve the git hashid and write the header file.  An empty file
24    will be created if anything goes wrong."""
25
26    args = [ python_cmd, Dir('#').abspath + '/bin/git_sha1_gen.py', '--output', filename ]
27    try:
28        subprocess.call(args)
29    except:
30        print("Warning: exception in write_git_sha1_h_file()")
31        return
32
33
34# Create the git_sha1.h header file
35write_git_sha1_h_file("git_sha1.h")
36# and update CPPPATH so the git_sha1.h header can be found
37env.Append(CPPPATH = ["#" + env['build_dir']])
38
39
40
41if env['platform'] != 'windows':
42    SConscript('loader/SConscript')
43
44SConscript('mapi/glapi/gen/SConscript')
45SConscript('mapi/glapi/SConscript')
46
47SConscript('mesa/SConscript')
48
49SConscript('gallium/SConscript')
50
51