Add a NOOP target for merge libs.

Also allow certain components to not be built.

TEST=build merged_lib

Review URL: http://webrtc-codereview.appspot.com/328001

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1254 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org 2011-12-20 22:07:48 +00:00
parent 6f7fbc7fbe
commit e858d13ac6
6 changed files with 70 additions and 51 deletions

View File

@ -44,6 +44,10 @@
# which can be easily parsed for offline processing.
'enable_data_logging%': 0,
# Disable these to not build components which can be externally provided.
'build_libjpeg%': 1,
'build_libyuv%': 1,
'conditions': [
['OS=="win"', {
# TODO(andrew, perkj): does this need to be here?

View File

@ -7,18 +7,29 @@
# be found in the AUTHORS file in the root of the source tree.
{
'includes': [
'common.gypi',
],
'includes': [ 'common.gypi', ],
'targets': [
{
'target_name': 'no_op_voice',
'type': 'executable',
'dependencies': [
'../voice_engine/voice_engine.gyp:voice_engine_core',
],
'sources': [ 'no_op.cc', ],
},
{
'target_name': 'no_op',
'type': 'executable',
'dependencies': [
'../video_engine/video_engine.gyp:video_engine_core',
],
'sources': [ 'no_op.cc', ],
},
{
'target_name': 'merged_lib_voice',
'type': 'none',
'variables': {
'autotest_name': 'voe_auto_test',
},
'dependencies': [
'../voice_engine/voice_engine.gyp:<(autotest_name)',
'no_op_voice',
],
'actions': [
{
@ -27,7 +38,7 @@
'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)'],
'inputs': ['<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)no_op_voice<(EXECUTABLE_SUFFIX)'],
'outputs': ['<(output_lib)'],
'action': ['python',
'merge_libs.py',
@ -39,11 +50,8 @@
{
'target_name': 'merged_lib',
'type': 'none',
'variables': {
'autotest_name': 'vie_auto_test',
},
'dependencies': [
'../video_engine/video_engine.gyp:<(autotest_name)',
'no_op',
],
'actions': [
{
@ -52,7 +60,7 @@
'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)'],
'inputs': ['<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)no_op<(EXECUTABLE_SUFFIX)'],
'outputs': ['<(output_lib)'],
'action': ['python',
'merge_libs.py',

View File

@ -26,31 +26,33 @@ if __name__ == '__main__':
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)
Popen(["ar crs " + output_lib + " $(find " + search_path +
"/obj.target -name *\.o)"], shell=True)
Popen(["ar crs " + output_lib + " $(find " + search_path +
"/obj/gen -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)
Popen(["libtool -static -v -o " + output_lib + " " + search_path + "/*.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.
# 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(["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)
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)
sys.exit(0)

3
src/build/no_op.cc Normal file
View File

@ -0,0 +1,3 @@
int main() {
return 0;
}

View File

@ -29,39 +29,38 @@
],
},
'conditions': [
['build_with_chromium==1', {
'dependencies': [
'<(libjpeg_gyp_path):libjpeg',
],
}, {
['build_libjpeg==1', {
'conditions': [
['use_libjpeg_turbo==1', {
['build_with_chromium==1', {
'dependencies': [
'../../third_party/libjpeg_turbo/libjpeg.gyp:libjpeg',
'<(libjpeg_gyp_path):libjpeg',
],
}, {
'dependencies': [
'../../third_party/libjpeg/libjpeg.gyp:libjpeg',
'conditions': [
['use_libjpeg_turbo==1', {
'dependencies': [
'<(DEPTH)/third_party/libjpeg_turbo/libjpeg.gyp:libjpeg',
],
}, {
'dependencies': [
'<(DEPTH)/third_party/libjpeg/libjpeg.gyp:libjpeg',
],
}],
],
}],
],
}],
],
'sources': [
# interfaces
'../interface/jpeg.h',
# headers
'data_manager.h',
# sources
'jpeg.cc',
'data_manager.cc',
'data_manager.h',
'jpeg.cc',
],
},
], # targets
# Exclude the test target when building with chromium.
'conditions': [
'conditions': [
['build_with_chromium==0', {
'targets': [
{
@ -75,12 +74,8 @@
'../source',
],
'sources': [
# headers
# sources
'../test/test_jpeg.cc',
], # source
],
},
] # targets
}], # build_with_chromium

View File

@ -11,8 +11,15 @@
{
'target_name': 'webrtc_libyuv',
'type': '<(library)',
'dependencies': [
'<(DEPTH)/third_party/libyuv/libyuv.gyp:libyuv'
'conditions': [
['build_libyuv==1', {
'dependencies': [
'<(DEPTH)/third_party/libyuv/libyuv.gyp:libyuv'
],
}, {
# Need to add a directory normally exported by libyuv.gyp.
'include_dirs': [ '<(DEPTH)/third_party/libyuv/include', ],
}],
],
'sources': [
'include/libyuv.h',
@ -25,7 +32,7 @@
],
},
], # targets
'conditions': [
'conditions': [
['build_with_chromium==0', {
'targets': [
{
@ -45,4 +52,4 @@
], # targets
}], # build_with_chromium
], # conditions
}
}