From e858d13ac61e69ac798302577d41736d6b45103a Mon Sep 17 00:00:00 2001 From: "andrew@webrtc.org" Date: Tue, 20 Dec 2011 22:07:48 +0000 Subject: [PATCH] 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 --- src/build/common.gypi | 4 +++ src/build/merge_libs.gyp | 34 +++++++++++------- src/build/merge_libs.py | 26 +++++++------- src/build/no_op.cc | 3 ++ src/common_video/jpeg/main/source/jpeg.gypi | 39 +++++++++------------ src/common_video/libyuv/libyuv.gypi | 15 +++++--- 6 files changed, 70 insertions(+), 51 deletions(-) create mode 100644 src/build/no_op.cc diff --git a/src/build/common.gypi b/src/build/common.gypi index f889bff866..414fdd2fff 100644 --- a/src/build/common.gypi +++ b/src/build/common.gypi @@ -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? diff --git a/src/build/merge_libs.gyp b/src/build/merge_libs.gyp index 62d8d4e5ed..d7315589e6 100644 --- a/src/build/merge_libs.gyp +++ b/src/build/merge_libs.gyp @@ -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', diff --git a/src/build/merge_libs.py b/src/build/merge_libs.py index e2b96bf276..f3938ee867 100644 --- a/src/build/merge_libs.py +++ b/src/build/merge_libs.py @@ -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) diff --git a/src/build/no_op.cc b/src/build/no_op.cc new file mode 100644 index 0000000000..4cce7f667f --- /dev/null +++ b/src/build/no_op.cc @@ -0,0 +1,3 @@ +int main() { + return 0; +} diff --git a/src/common_video/jpeg/main/source/jpeg.gypi b/src/common_video/jpeg/main/source/jpeg.gypi index 8fab23a5dc..eec92dd1c2 100644 --- a/src/common_video/jpeg/main/source/jpeg.gypi +++ b/src/common_video/jpeg/main/source/jpeg.gypi @@ -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 diff --git a/src/common_video/libyuv/libyuv.gypi b/src/common_video/libyuv/libyuv.gypi index 938a67c6a6..bace5a207b 100644 --- a/src/common_video/libyuv/libyuv.gypi +++ b/src/common_video/libyuv/libyuv.gypi @@ -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 -} \ No newline at end of file +}