Commit c7f1a719 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#724 SCons: add a new target that build only the libraries, not the...

#724 SCons: add a new target that build only the libraries, not the executables. Also add an option --aliases that gives away all aliases available.
parent ec6dbc22
......@@ -2,6 +2,7 @@ import os
import copy
import subprocess
import platform
import SCons
# Set the variables from the configuration file for the command line (the latter supercedes the former).
platform = platform.system()
......@@ -13,7 +14,15 @@ AddOption('--config_file',
help='Path to the configuration file to use.')
help='Print the list of available aliases.')
aliases = GetOption('aliases')
configuration_file = GetOption('configuration_file')
......@@ -446,9 +455,10 @@ if env['LIBRARY_TYPE'] == "shared":
for path in env['LIBPATH']:
# Create an alias: type 'scons install' in command line to populate fully the target_variant_directory.
# Create an alias: type 'scons all' in command line to populate fully the target_variant_directory.
# 'scons' alone is not enough, because I choose an installation directory outside of source folder.
env.Alias('install', target_variant_directory)
print target_variant_directory
env.Alias('all', target_variant_directory)
# List of libraries to build; a folder with the same name is expected to exist.
# 'ModelInstances' and 'ThirdParty' are left out on purpose:
......@@ -467,6 +477,8 @@ if platform == 'Linux':
# Iterate through the SConscript of all the libraries to build.
libs_for_alias = []
for library in libraries:
# SConscript will create the library.
......@@ -480,13 +492,17 @@ for library in libraries:
libname = PrepareTargetName(scons_library_object)
# Install here the library in the final target folder.
env.Command(os.path.join(target_variant_directory, libname), scons_library_object, InstallStaticLibrary)
full_path_target = os.path.join(target_variant_directory, libname)
env.Command(full_path_target, scons_library_object, InstallStaticLibrary)
# Update the list of known libraries so far.
all_libs = [libname] + all_libs
print all_libs
env.Alias('libraries', libs_for_alias)
# Now create the executables for all the problems.
......@@ -520,4 +536,12 @@ for library in exec_library_list:
libname = PrepareTargetName(library)
env.Command(os.path.join(target_variant_directory, libname), library, InstallStaticLibrary)
\ No newline at end of file
if aliases:
print 'Available Build Aliases:'
print '-----'
aliases = SCons.Node.Alias.default_ans.keys()
for x in aliases:
print x
print '-----'
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment