José Fonseca | 57d0001 | 2009-01-23 12:32:35 +0000 | [diff] [blame] | 1 | Import('*') |
| 2 | |
José Fonseca | 14a8c9d | 2010-01-01 19:58:39 +0000 | [diff] [blame] | 3 | # Shared environment settings |
José Fonseca | 57d0001 | 2009-01-23 12:32:35 +0000 | [diff] [blame] | 4 | env = env.Clone() |
| 5 | |
José Fonseca | 57d0001 | 2009-01-23 12:32:35 +0000 | [diff] [blame] | 6 | env.PrependUnique(CPPPATH = [ |
| 7 | '#/include', |
| 8 | ]) |
| 9 | |
José Fonseca | 57d0001 | 2009-01-23 12:32:35 +0000 | [diff] [blame] | 10 | if env['platform'] == 'windows': |
| 11 | env.PrependUnique(LIBS = [ |
| 12 | 'glu32', |
| 13 | 'opengl32', |
| 14 | 'gdi32', |
| 15 | 'user32', |
| 16 | ]) |
| 17 | else: |
| 18 | env.PrependUnique(LIBS = [ |
| 19 | 'GLU', |
| 20 | 'GL', |
| 21 | 'X11', |
| 22 | ]) |
José Fonseca | 7bbf7f9 | 2009-12-31 21:10:25 +0000 | [diff] [blame] | 23 | |
José Fonseca | 14a8c9d | 2010-01-01 19:58:39 +0000 | [diff] [blame] | 24 | # Library specific environment settings |
| 25 | lib_env = env.Clone() |
| 26 | |
| 27 | lib_env.Append(CPPDEFINES = [ |
| 28 | 'GLEW_BUILD', |
José Fonseca | 14a8c9d | 2010-01-01 19:58:39 +0000 | [diff] [blame] | 29 | #'GLEW_MX', # Multiple Rendering Contexts support |
| 30 | ]) |
| 31 | |
| 32 | if lib_env['platform'] == 'windows': |
José Fonseca | 7bbf7f9 | 2009-12-31 21:10:25 +0000 | [diff] [blame] | 33 | target = 'glew' |
| 34 | else: |
| 35 | target = 'GLEW' |
| 36 | |
José Fonseca | de22c94 | 2010-01-08 00:33:58 +0000 | [diff] [blame] | 37 | source = [ |
| 38 | 'glew.c', |
| 39 | ] |
José Fonseca | 8a318ed | 2010-01-01 22:35:28 +0000 | [diff] [blame] | 40 | |
José Fonseca | 14a8c9d | 2010-01-01 19:58:39 +0000 | [diff] [blame] | 41 | if lib_env['platform'] == 'windows': |
José Fonseca | de22c94 | 2010-01-08 00:33:58 +0000 | [diff] [blame] | 42 | glew = lib_env.SharedLibrary(target = target, source = source) |
| 43 | env.InstallSharedLibrary(glew, version=(1, 5, 2)) |
José Fonseca | 14a8c9d | 2010-01-01 19:58:39 +0000 | [diff] [blame] | 44 | glew = lib_env.FindIxes(glew, 'LIBPREFIX', 'LIBSUFFIX') |
José Fonseca | de22c94 | 2010-01-08 00:33:58 +0000 | [diff] [blame] | 45 | else: |
| 46 | # Use static library on Unices to avoid binary compatability issues |
| 47 | lib_env.Append(CPPDEFINES = ['GLEW_STATIC']) |
| 48 | glew = lib_env.StaticLibrary(target = target, source = source) |
José Fonseca | 7bbf7f9 | 2009-12-31 21:10:25 +0000 | [diff] [blame] | 49 | |
José Fonseca | 14a8c9d | 2010-01-01 19:58:39 +0000 | [diff] [blame] | 50 | # Program specific environment settings |
| 51 | prog_env = env.Clone() |
José Fonseca | 7bbf7f9 | 2009-12-31 21:10:25 +0000 | [diff] [blame] | 52 | |
José Fonseca | 14a8c9d | 2010-01-01 19:58:39 +0000 | [diff] [blame] | 53 | prog_env.Prepend(LIBS = [glew]) |
José Fonseca | 57d0001 | 2009-01-23 12:32:35 +0000 | [diff] [blame] | 54 | |
José Fonseca | 14a8c9d | 2010-01-01 19:58:39 +0000 | [diff] [blame] | 55 | prog_env.Program( |
José Fonseca | 57d0001 | 2009-01-23 12:32:35 +0000 | [diff] [blame] | 56 | target = 'glewinfo', |
| 57 | source = ['glewinfo.c'], |
| 58 | ) |
| 59 | |
José Fonseca | 14a8c9d | 2010-01-01 19:58:39 +0000 | [diff] [blame] | 60 | prog_env.Program( |
José Fonseca | 57d0001 | 2009-01-23 12:32:35 +0000 | [diff] [blame] | 61 | target = 'visualinfo', |
| 62 | source = ['visualinfo.c'], |
| 63 | ) |
José Fonseca | 7bbf7f9 | 2009-12-31 21:10:25 +0000 | [diff] [blame] | 64 | |
| 65 | Export('glew') |