git-svn-id: http://webrtc.googlecode.com/svn/trunk@504 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
zakkhoyt@google.com
2011-09-01 00:54:32 +00:00
parent 777ef59394
commit d9e11b429e
4 changed files with 110 additions and 3 deletions

56
src/build/merge_libs.py Normal file
View File

@@ -0,0 +1,56 @@
#!/usr/bin/env python
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
# Searches for libraries and/or object files on the specified path and
# merges them into a single library.
import subprocess
import sys
if __name__ == '__main__':
if len(sys.argv) != 3:
sys.stderr.write('Usage: ' + sys.argv[0] + ' <search_path> <output_lib>\n')
sys.exit(2)
search_path = sys.argv[1]
output_lib = sys.argv[2]
from subprocess import Popen, PIPE
if sys.platform.startswith('linux'):
Popen(["rm -f " + output_lib], shell=True)
Popen(["rm -rf " + search_path + "/obj.target/*do_not_use*"], shell=True)
Popen(["ar crs " + output_lib + " $(find " + search_path + " -name *\.o)"],
shell=True)
elif sys.platform == 'darwin':
Popen(["rm -f " + output_lib], shell=True)
Popen(["rm -f " + search_path + "/*do_not_use*"], shell=True)
Popen(["libtool -static -v -o " + output_lib + " $(find " + search_path +
" -name *\.a)"], shell=True)
elif sys.platform == 'win32':
# We need to execute a batch file to set some environment variables for the
# lib command. VS 8 uses vsvars.bat and VS 9 uses vsvars32.bat.
# It's required that at least one of them is in the system PATH.
# We try both and suppress stderr and stdout to fail silently.
Popen(["del " + output_lib], stderr=PIPE, stdout=PIPE, shell=True)
Popen(["del /F /S /Q " + search_path + "/lib/*do_not_use*"],
shell=True)
Popen(["vsvars.bat"], stderr=PIPE, stdout=PIPE, shell=True)
Popen(["vsvars32.bat"], stderr=PIPE, stdout=PIPE, shell=True)
Popen(["lib /OUT:" + output_lib + " " + search_path + "/lib/*.lib"],
shell=True)
else:
sys.stderr.write('Platform not supported: %r\n\n' % sys.platform)
sys.exit(1)
sys.exit(0)

View File

@@ -5,9 +5,35 @@
{ {
'includes': [ 'includes': [
'common_settings.gypi', # Common settings 'common_settings.gypi', # Common settings
# Defines target vie_auto_test
'video_engine/main/test/AutoTest/vie_auto_test.gypi', 'video_engine/main/test/AutoTest/vie_auto_test.gypi',
], ],
'variables': {
'autotest_name': 'vie_auto_test',
},
'targets': [
{
'target_name': 'merged_lib',
'type': 'none',
'dependencies': [
'<(autotest_name)',
],
'actions': [
{
'variables': {
'output_lib_name': 'webrtc',
'output_lib': '<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)<(output_lib_name)_<(OS)<(STATIC_LIB_SUFFIX)',
},
'action_name': 'merge_libs',
'inputs': ['<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)<(autotest_name)<(EXECUTABLE_SUFFIX)'],
'outputs': ['<(output_lib)'],
'action': ['python',
'./build/merge_libs.py',
'<(PRODUCT_DIR)',
'<(output_lib)'],
},
],
},
],
} }
# Local Variables: # Local Variables:

View File

@@ -8,7 +8,7 @@
], ],
'targets': [ 'targets': [
{ {
'target_name': 'vie_auto_test', 'target_name': '<(autotest_name)',
'type': 'executable', 'type': 'executable',
'dependencies': [ 'dependencies': [
'system_wrappers/source/system_wrappers.gyp:system_wrappers', 'system_wrappers/source/system_wrappers.gyp:system_wrappers',

View File

@@ -10,10 +10,35 @@
'includes': [ 'includes': [
'common_settings.gypi', 'common_settings.gypi',
], ],
'variables': {
'autotest_name': 'voe_auto_test',
},
'targets': [ 'targets': [
{
'target_name': 'merged_lib_voice',
'type': 'none',
'dependencies': [
'<(autotest_name)',
],
'actions': [
{
'variables': {
'output_lib_name': 'webrtc_voice_engine',
'output_lib': '<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)<(output_lib_name)_<(OS)<(STATIC_LIB_SUFFIX)',
},
'action_name': 'merge_libs',
'inputs': ['<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)<(autotest_name)<(EXECUTABLE_SUFFIX)'],
'outputs': ['<(output_lib)'],
'action': ['python',
'./build/merge_libs.py',
'<(PRODUCT_DIR)',
'<(output_lib)'],
},
],
},
# Auto test - command line test for all platforms # Auto test - command line test for all platforms
{ {
'target_name': 'voe_auto_test', 'target_name': '<(autotest_name)',
'type': 'executable', 'type': 'executable',
'dependencies': [ 'dependencies': [
'voice_engine/main/source/voice_engine_core.gyp:voice_engine_core', 'voice_engine/main/source/voice_engine_core.gyp:voice_engine_core',