blob: bd20d4e2108b463f450e7636904763eec6c5db90 [file] [log] [blame]
Brian Paulace31242016-06-15 10:42:34 -06001import filecmp
2import os
3import subprocess
Jose Fonsecab99dcbf2017-08-01 14:36:16 +01004from sys import executable as python_cmd
José Fonseca33ceb672008-02-18 10:52:44 +00005
Brian Paulace31242016-06-15 10:42:34 -06006Import('*')
José Fonseca982609f2011-02-11 17:38:54 +00007
José Fonseca601498a2010-11-01 13:30:22 +00008if env['platform'] == 'windows':
José Fonseca6d670f62011-01-12 15:32:17 +00009 SConscript('getopt/SConscript')
Chia-I Wu1e6c10f2010-05-31 11:47:58 +080010
Nicolai Hähnle49bdb732017-07-31 16:51:13 +020011SConscript('util/xmlpool/SConscript')
Kenneth Graunke1e0da622014-02-24 23:39:14 -080012SConscript('util/SConscript')
Emil Velikov1a882fd2016-01-18 10:47:13 +020013SConscript('compiler/SConscript')
José Fonseca982609f2011-02-11 17:38:54 +000014
15if env['hostonly']:
16 # We are just compiling the things necessary on the host for cross
17 # compilation
18 Return()
19
Brian Paulace31242016-06-15 10:42:34 -060020
21def write_git_sha1_h_file(filename):
22 """Mesa looks for a git_sha1.h file at compile time in order to display
23 the current git hash id in the GL_VERSION string. This function tries
24 to retrieve the git hashid and write the header file. An empty file
25 will be created if anything goes wrong."""
26
Brian Paulace31242016-06-15 10:42:34 -060027 tempfile = "git_sha1.h.tmp"
Eric Engestrom3fd425a2017-06-27 12:08:41 +010028 with open(tempfile, "w") as f:
Jose Fonsecab99dcbf2017-08-01 14:36:16 +010029 args = [ python_cmd, Dir('#').abspath + '/bin/git_sha1_gen.py' ]
Eric Engestrom3fd425a2017-06-27 12:08:41 +010030 try:
Eric Engestrom9f6110a2017-06-29 17:21:44 +010031 subprocess.Popen(args, stdout=f).wait()
Eric Engestrom3fd425a2017-06-27 12:08:41 +010032 except:
33 print "Warning: exception in write_git_sha1_h_file()"
34 return
35
Brian Paulace31242016-06-15 10:42:34 -060036 if not os.path.exists(filename) or not filecmp.cmp(tempfile, filename):
37 # The filename does not exist or it's different from the new file,
38 # so replace old file with new.
39 if os.path.exists(filename):
40 os.remove(filename)
41 os.rename(tempfile, filename)
42 return
43
44
45# Create the git_sha1.h header file
46write_git_sha1_h_file("git_sha1.h")
47# and update CPPPATH so the git_sha1.h header can be found
48env.Append(CPPPATH = ["#" + env['build_dir']])
49
50
51
Jose Fonseca47870d62015-03-24 20:26:21 +000052if env['platform'] != 'windows':
53 SConscript('loader/SConscript')
José Fonseca982609f2011-02-11 17:38:54 +000054
Chia-I Wubb770af2011-01-14 17:50:29 +080055# When env['gles'] is set, the targets defined in mapi/glapi/SConscript are not
56# used. libgl-xlib and libgl-gdi adapt themselves to use the targets defined
57# in mapi/glapi-shared/SConscript. mesa/SConscript also adapts itself to
58# enable OpenGL ES support.
Brian Pauldff36e92012-05-30 10:08:11 -060059SConscript('mapi/glapi/gen/SConscript')
José Fonseca601498a2010-11-01 13:30:22 +000060SConscript('mapi/glapi/SConscript')
Alexander von Gluck IV61ef6972013-12-31 15:39:49 -060061
62# Haiku C++ libGL dispatch (renderers depend on libgl)
63if env['platform'] in ['haiku']:
64 SConscript('hgl/SConscript')
65
José Fonseca601498a2010-11-01 13:30:22 +000066SConscript('mesa/SConscript')
José Fonseca1ca29452010-08-13 13:53:04 +010067
Brian Paul88625e62011-09-16 10:11:52 -060068if not env['embedded']:
Vinson Lee5cf69322012-05-23 17:26:20 -070069 if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 'windows'):
José Fonsecaf8aeb1c2011-09-20 20:40:05 +010070 SConscript('glx/SConscript')
Alexander von Gluck IV400b8332014-12-22 10:10:13 -050071 if env['platform'] == 'haiku':
Emil Velikove7e29182015-07-14 02:04:30 +010072 SConscript('egl/SConscript')
Keith Whitwelle3c6d412010-06-08 17:38:01 +010073
Chia-I Wubb770af2011-01-14 17:50:29 +080074 if env['gles']:
75 SConscript('mapi/shared-glapi/SConscript')
76
José Fonseca706eda32010-03-09 15:07:57 +000077SConscript('gallium/SConscript')
José Fonseca57d00012009-01-23 12:32:35 +000078