1b8e80941Smrgimport filecmp
2b8e80941Smrgimport os
3b8e80941Smrgimport subprocess
4b8e80941Smrgfrom sys import executable as python_cmd
5848b8605Smrg
6b8e80941SmrgImport('*')
7848b8605Smrg
8848b8605Smrgif env['platform'] == 'windows':
9848b8605Smrg    SConscript('getopt/SConscript')
10848b8605Smrg
11b8e80941SmrgSConscript('util/xmlpool/SConscript')
12848b8605SmrgSConscript('util/SConscript')
13b8e80941SmrgSConscript('compiler/SConscript')
14848b8605Smrg
15848b8605Smrgif env['hostonly']:
16848b8605Smrg    # We are just compiling the things necessary on the host for cross
17848b8605Smrg    # compilation
18848b8605Smrg    Return()
19848b8605Smrg
20848b8605Smrg
21b8e80941Smrgdef write_git_sha1_h_file(filename):
22b8e80941Smrg    """Mesa looks for a git_sha1.h file at compile time in order to display
23b8e80941Smrg    the current git hash id in the GL_VERSION string.  This function tries
24b8e80941Smrg    to retrieve the git hashid and write the header file.  An empty file
25b8e80941Smrg    will be created if anything goes wrong."""
26b8e80941Smrg
27b8e80941Smrg    args = [ python_cmd, Dir('#').abspath + '/bin/git_sha1_gen.py', '--output', filename ]
28b8e80941Smrg    try:
29b8e80941Smrg        subprocess.call(args)
30b8e80941Smrg    except:
31b8e80941Smrg        print("Warning: exception in write_git_sha1_h_file()")
32b8e80941Smrg        return
33b8e80941Smrg
34b8e80941Smrg
35b8e80941Smrg# Create the git_sha1.h header file
36b8e80941Smrgwrite_git_sha1_h_file("git_sha1.h")
37b8e80941Smrg# and update CPPPATH so the git_sha1.h header can be found
38b8e80941Smrgenv.Append(CPPPATH = ["#" + env['build_dir']])
39b8e80941Smrg
40b8e80941Smrg
41b8e80941Smrg
42b8e80941Smrgif env['platform'] != 'windows':
43b8e80941Smrg    SConscript('loader/SConscript')
44b8e80941Smrg
45848b8605SmrgSConscript('mapi/glapi/gen/SConscript')
46848b8605SmrgSConscript('mapi/glapi/SConscript')
47848b8605Smrg
48848b8605Smrg# Haiku C++ libGL dispatch (renderers depend on libgl)
49848b8605Smrgif env['platform'] in ['haiku']:
50848b8605Smrg    SConscript('hgl/SConscript')
51848b8605Smrg
52848b8605SmrgSConscript('mesa/SConscript')
53848b8605Smrg
54848b8605Smrgif not env['embedded']:
55848b8605Smrg    if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 'windows'):
56848b8605Smrg        SConscript('glx/SConscript')
57b8e80941Smrg    if env['platform'] == 'haiku':
58b8e80941Smrg        SConscript('egl/SConscript')
59848b8605Smrg
60848b8605SmrgSConscript('gallium/SConscript')
61848b8605Smrg
62