scons: Put glut and glew shared libraries into build/xxx/bin or lib.

Use bin subdir for windows dlls, lib for unices.
This commit is contained in:
José Fonseca
2010-01-01 22:35:28 +00:00
parent ee39dc20e6
commit 8a318edd08
2 changed files with 24 additions and 18 deletions

View File

@@ -46,27 +46,31 @@ def symlink(target, source, env):
os.remove(target) os.remove(target)
os.symlink(os.path.basename(source), target) os.symlink(os.path.basename(source), target)
def install_program(env, source): def install(env, source, subdir):
source = str(source[0]) target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build'], subdir)
target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build'], 'bin') env.Install(target_dir, source)
target_name = str(source)
env.InstallAs(os.path.join(target_dir, target_name), source)
def install_shared_library(env, source, version = ()): def install_program(env, source):
source = str(source[0]) install(env, source, 'bin')
def install_shared_library(env, sources, version = ()):
install_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build'])
version = tuple(map(str, version)) version = tuple(map(str, version))
target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build'], 'lib') if env['SHLIBSUFFIX'] == '.dll':
if env['SHLIBSUFFIX'] == '.so': dlls = env.FindIxes(sources, 'SHLIBPREFIX', 'SHLIBSUFFIX')
target_name = '.'.join((str(source),) + version) install(env, dlls, 'bin')
last = env.InstallAs(os.path.join(target_dir, target_name), source) libs = env.FindIxes(sources, 'LIBPREFIX', 'LIBSUFFIX')
while len(version): install(env, libs, 'lib')
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)
else: else:
target_name = str(source) for source in sources:
env.InstallAs(os.path.join(target_dir, target_name), source) 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): def createInstallMethods(env):
env.AddMethod(install_program, 'InstallProgram') env.AddMethod(install_program, 'InstallProgram')

View File

@@ -45,6 +45,8 @@ glew = lib_env.SharedLibrary(
], ],
) )
env.InstallSharedLibrary(glew, version=(1, 5))
if lib_env['platform'] == 'windows': if lib_env['platform'] == 'windows':
glew = lib_env.FindIxes(glew, 'LIBPREFIX', 'LIBSUFFIX') glew = lib_env.FindIxes(glew, 'LIBPREFIX', 'LIBSUFFIX')