Brian Paul | ace3124 | 2016-06-15 10:42:34 -0600 | [diff] [blame] | 1 | import filecmp |
| 2 | import os |
| 3 | import subprocess |
Jose Fonseca | b99dcbf | 2017-08-01 14:36:16 +0100 | [diff] [blame^] | 4 | from sys import executable as python_cmd |
José Fonseca | 33ceb67 | 2008-02-18 10:52:44 +0000 | [diff] [blame] | 5 | |
Brian Paul | ace3124 | 2016-06-15 10:42:34 -0600 | [diff] [blame] | 6 | Import('*') |
José Fonseca | 982609f | 2011-02-11 17:38:54 +0000 | [diff] [blame] | 7 | |
José Fonseca | 601498a | 2010-11-01 13:30:22 +0000 | [diff] [blame] | 8 | if env['platform'] == 'windows': |
José Fonseca | 6d670f6 | 2011-01-12 15:32:17 +0000 | [diff] [blame] | 9 | SConscript('getopt/SConscript') |
Chia-I Wu | 1e6c10f | 2010-05-31 11:47:58 +0800 | [diff] [blame] | 10 | |
Nicolai Hähnle | 49bdb73 | 2017-07-31 16:51:13 +0200 | [diff] [blame] | 11 | SConscript('util/xmlpool/SConscript') |
Kenneth Graunke | 1e0da62 | 2014-02-24 23:39:14 -0800 | [diff] [blame] | 12 | SConscript('util/SConscript') |
Emil Velikov | 1a882fd | 2016-01-18 10:47:13 +0200 | [diff] [blame] | 13 | SConscript('compiler/SConscript') |
José Fonseca | 982609f | 2011-02-11 17:38:54 +0000 | [diff] [blame] | 14 | |
| 15 | if env['hostonly']: |
| 16 | # We are just compiling the things necessary on the host for cross |
| 17 | # compilation |
| 18 | Return() |
| 19 | |
Brian Paul | ace3124 | 2016-06-15 10:42:34 -0600 | [diff] [blame] | 20 | |
| 21 | def 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 Paul | ace3124 | 2016-06-15 10:42:34 -0600 | [diff] [blame] | 27 | tempfile = "git_sha1.h.tmp" |
Eric Engestrom | 3fd425a | 2017-06-27 12:08:41 +0100 | [diff] [blame] | 28 | with open(tempfile, "w") as f: |
Jose Fonseca | b99dcbf | 2017-08-01 14:36:16 +0100 | [diff] [blame^] | 29 | args = [ python_cmd, Dir('#').abspath + '/bin/git_sha1_gen.py' ] |
Eric Engestrom | 3fd425a | 2017-06-27 12:08:41 +0100 | [diff] [blame] | 30 | try: |
Eric Engestrom | 9f6110a | 2017-06-29 17:21:44 +0100 | [diff] [blame] | 31 | subprocess.Popen(args, stdout=f).wait() |
Eric Engestrom | 3fd425a | 2017-06-27 12:08:41 +0100 | [diff] [blame] | 32 | except: |
| 33 | print "Warning: exception in write_git_sha1_h_file()" |
| 34 | return |
| 35 | |
Brian Paul | ace3124 | 2016-06-15 10:42:34 -0600 | [diff] [blame] | 36 | 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 |
| 46 | write_git_sha1_h_file("git_sha1.h") |
| 47 | # and update CPPPATH so the git_sha1.h header can be found |
| 48 | env.Append(CPPPATH = ["#" + env['build_dir']]) |
| 49 | |
| 50 | |
| 51 | |
Jose Fonseca | 47870d6 | 2015-03-24 20:26:21 +0000 | [diff] [blame] | 52 | if env['platform'] != 'windows': |
| 53 | SConscript('loader/SConscript') |
José Fonseca | 982609f | 2011-02-11 17:38:54 +0000 | [diff] [blame] | 54 | |
Chia-I Wu | bb770af | 2011-01-14 17:50:29 +0800 | [diff] [blame] | 55 | # 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 Paul | dff36e9 | 2012-05-30 10:08:11 -0600 | [diff] [blame] | 59 | SConscript('mapi/glapi/gen/SConscript') |
José Fonseca | 601498a | 2010-11-01 13:30:22 +0000 | [diff] [blame] | 60 | SConscript('mapi/glapi/SConscript') |
Alexander von Gluck IV | 61ef697 | 2013-12-31 15:39:49 -0600 | [diff] [blame] | 61 | |
| 62 | # Haiku C++ libGL dispatch (renderers depend on libgl) |
| 63 | if env['platform'] in ['haiku']: |
| 64 | SConscript('hgl/SConscript') |
| 65 | |
José Fonseca | 601498a | 2010-11-01 13:30:22 +0000 | [diff] [blame] | 66 | SConscript('mesa/SConscript') |
José Fonseca | 1ca2945 | 2010-08-13 13:53:04 +0100 | [diff] [blame] | 67 | |
Brian Paul | 88625e6 | 2011-09-16 10:11:52 -0600 | [diff] [blame] | 68 | if not env['embedded']: |
Vinson Lee | 5cf6932 | 2012-05-23 17:26:20 -0700 | [diff] [blame] | 69 | if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 'windows'): |
José Fonseca | f8aeb1c | 2011-09-20 20:40:05 +0100 | [diff] [blame] | 70 | SConscript('glx/SConscript') |
Alexander von Gluck IV | 400b833 | 2014-12-22 10:10:13 -0500 | [diff] [blame] | 71 | if env['platform'] == 'haiku': |
Emil Velikov | e7e2918 | 2015-07-14 02:04:30 +0100 | [diff] [blame] | 72 | SConscript('egl/SConscript') |
Keith Whitwell | e3c6d41 | 2010-06-08 17:38:01 +0100 | [diff] [blame] | 73 | |
Chia-I Wu | bb770af | 2011-01-14 17:50:29 +0800 | [diff] [blame] | 74 | if env['gles']: |
| 75 | SConscript('mapi/shared-glapi/SConscript') |
| 76 | |
José Fonseca | 706eda3 | 2010-03-09 15:07:57 +0000 | [diff] [blame] | 77 | SConscript('gallium/SConscript') |
José Fonseca | 57d0001 | 2009-01-23 12:32:35 +0000 | [diff] [blame] | 78 | |