From 7bbf7f94ea786e41ff1364cedaf7dd5c0bbf605a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 31 Dec 2009 21:10:25 +0000 Subject: scons: Build progs together with everything else. This is a substantial reorganization, This particular commit enables: - building the progs for unices platforms - glew is now built as a shared library (it is the default, and it is inconvenient and pointless to shift away from that default) - all progs get built by default --- src/glew/SConscript | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'src/glew') diff --git a/src/glew/SConscript b/src/glew/SConscript index 1161be6e63..b4541a7c26 100644 --- a/src/glew/SConscript +++ b/src/glew/SConscript @@ -7,7 +7,7 @@ env = env.Clone() env.Append(CPPDEFINES = [ 'GLEW_BUILD', - 'GLEW_STATIC', + #'GLEW_STATIC', #'GLEW_MX', # Multiple Rendering Contexts support ]) @@ -15,15 +15,6 @@ env.PrependUnique(CPPPATH = [ '#/include', ]) -glew = env.StaticLibrary( - target = 'glew', - source = [ - 'glew.c', - ], -) - -env = env.Clone() - if env['platform'] == 'windows': env.PrependUnique(LIBS = [ 'glu32', @@ -37,6 +28,24 @@ else: 'GL', 'X11', ]) + +if env['platform'] == 'windows': + target = 'glew' +else: + target = 'GLEW' + +glew = env.SharedLibrary( + target = target, + source = [ + 'glew.c', + ], +) + +if env['platform'] == 'windows': + glew = env.FindIxes(glew, 'LIBPREFIX', 'LIBSUFFIX') + +env = env.Clone() + env.Prepend(LIBS = [glew]) env.Program( @@ -48,3 +57,5 @@ env.Program( target = 'visualinfo', source = ['visualinfo.c'], ) + +Export('glew') -- cgit v1.2.3 From 14a8c9dac7ea43ad8a45052e17f7127451344e5a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 1 Jan 2010 19:58:39 +0000 Subject: scons: Fix glew build on MSVC. The environment for building the DLL needs to be quite different from the environment for building the programs, in order to get the dllexport/dllimport attribute done currectly. I don't know how MinGW managed to build the programs, but MS linker refuses to link symbols with mismatching attributes. --- src/glew/SConscript | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'src/glew') diff --git a/src/glew/SConscript b/src/glew/SConscript index b4541a7c26..330231d2c6 100644 --- a/src/glew/SConscript +++ b/src/glew/SConscript @@ -3,14 +3,9 @@ Import('*') if env['platform'] not in ['windows', 'linux']: Return() +# Shared environment settings env = env.Clone() -env.Append(CPPDEFINES = [ - 'GLEW_BUILD', - #'GLEW_STATIC', - #'GLEW_MX', # Multiple Rendering Contexts support -]) - env.PrependUnique(CPPPATH = [ '#/include', ]) @@ -29,31 +24,41 @@ else: 'X11', ]) -if env['platform'] == 'windows': +# Library specific environment settings +lib_env = env.Clone() + +lib_env.Append(CPPDEFINES = [ + 'GLEW_BUILD', + #'GLEW_STATIC', + #'GLEW_MX', # Multiple Rendering Contexts support +]) + +if lib_env['platform'] == 'windows': target = 'glew' else: target = 'GLEW' -glew = env.SharedLibrary( +glew = lib_env.SharedLibrary( target = target, source = [ 'glew.c', ], ) -if env['platform'] == 'windows': - glew = env.FindIxes(glew, 'LIBPREFIX', 'LIBSUFFIX') +if lib_env['platform'] == 'windows': + glew = lib_env.FindIxes(glew, 'LIBPREFIX', 'LIBSUFFIX') -env = env.Clone() +# Program specific environment settings +prog_env = env.Clone() -env.Prepend(LIBS = [glew]) +prog_env.Prepend(LIBS = [glew]) -env.Program( +prog_env.Program( target = 'glewinfo', source = ['glewinfo.c'], ) -env.Program( +prog_env.Program( target = 'visualinfo', source = ['visualinfo.c'], ) -- cgit v1.2.3 From 8a318edd0838ee3343be0425019d93541b621567 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 1 Jan 2010 22:35:28 +0000 Subject: scons: Put glut and glew shared libraries into build/xxx/bin or lib. Use bin subdir for windows dlls, lib for unices. --- scons/gallium.py | 38 +++++++++++++++++++++----------------- src/glew/SConscript | 2 ++ 2 files changed, 23 insertions(+), 17 deletions(-) (limited to 'src/glew') diff --git a/scons/gallium.py b/scons/gallium.py index 0133f9f046..69a356908f 100644 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -46,27 +46,31 @@ def symlink(target, source, env): os.remove(target) os.symlink(os.path.basename(source), target) +def install(env, source, subdir): + target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build'], subdir) + env.Install(target_dir, source) + def install_program(env, source): - source = str(source[0]) - target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build'], 'bin') - target_name = str(source) - env.InstallAs(os.path.join(target_dir, target_name), source) + install(env, source, 'bin') -def install_shared_library(env, source, version = ()): - source = str(source[0]) +def install_shared_library(env, sources, version = ()): + install_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build']) version = tuple(map(str, version)) - target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build'], 'lib') - if env['SHLIBSUFFIX'] == '.so': - target_name = '.'.join((str(source),) + version) - last = env.InstallAs(os.path.join(target_dir, target_name), source) - while len(version): - version = version[:-1] - target_name = '.'.join((str(source),) + version) - action = SCons.Action.Action(symlink, "$TARGET -> $SOURCE") - last = env.Command(os.path.join(target_dir, target_name), last, action) + if env['SHLIBSUFFIX'] == '.dll': + dlls = env.FindIxes(sources, 'SHLIBPREFIX', 'SHLIBSUFFIX') + install(env, dlls, 'bin') + libs = env.FindIxes(sources, 'LIBPREFIX', 'LIBSUFFIX') + install(env, libs, 'lib') else: - target_name = str(source) - env.InstallAs(os.path.join(target_dir, target_name), source) + for source in sources: + target_dir = os.path.join(install_dir, 'lib') + target_name = '.'.join((str(source),) + version) + last = env.InstallAs(os.path.join(target_dir, target_name), source) + while len(version): + version = version[:-1] + target_name = '.'.join((str(source),) + version) + action = SCons.Action.Action(symlink, "$TARGET -> $SOURCE") + last = env.Command(os.path.join(target_dir, target_name), last, action) def createInstallMethods(env): env.AddMethod(install_program, 'InstallProgram') diff --git a/src/glew/SConscript b/src/glew/SConscript index 330231d2c6..0c50abf6c7 100644 --- a/src/glew/SConscript +++ b/src/glew/SConscript @@ -45,6 +45,8 @@ glew = lib_env.SharedLibrary( ], ) +env.InstallSharedLibrary(glew, version=(1, 5)) + if lib_env['platform'] == 'windows': glew = lib_env.FindIxes(glew, 'LIBPREFIX', 'LIBSUFFIX') -- cgit v1.2.3 From 52eb3e4235cc661ab9626a704c555a5f096c628a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 2 Jan 2010 01:12:35 +0000 Subject: scons: Build glew on all platforms. It is required for progs. --- src/glew/SConscript | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/glew') diff --git a/src/glew/SConscript b/src/glew/SConscript index 0c50abf6c7..1d7dbb9b78 100644 --- a/src/glew/SConscript +++ b/src/glew/SConscript @@ -1,8 +1,5 @@ Import('*') -if env['platform'] not in ['windows', 'linux']: - Return() - # Shared environment settings env = env.Clone() -- cgit v1.2.3