OLD | NEW |
1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
| 5 # Protobuffer compilation |
| 6 """ Inputs: |
| 7 target: list of targets to compile to |
| 8 source: list of sources to compile |
| 9 env: the scons environment in which we are compiling |
| 10 Outputs: |
| 11 target: the list of targets we'll emit |
| 12 source: the list of sources we'll compile""" |
| 13 def ProtocolBufferEmitter(target, source, env): |
| 14 output = str(source[0]) |
| 15 output = output[0:output.rfind('.proto')] |
| 16 target = [ |
| 17 output + '.pb.cc', |
| 18 output + '.pb.h', |
| 19 ] |
| 20 return target, source |
| 21 |
| 22 """ Inputs: |
| 23 source: list of sources to process |
| 24 target: list of targets to generate |
| 25 env: scons environment in which we are working |
| 26 for_signature: unused |
| 27 Outputs: a list of commands to execute to generate the targets from |
| 28 the sources.""" |
| 29 def ProtocolBufferGenerator(source, target, env, for_signature): |
| 30 commands = [ |
| 31 '/usr/bin/protoc ' |
| 32 ' --proto_path . ${SOURCES} --cpp_out .'] |
| 33 return commands |
| 34 |
| 35 proto_builder = Builder(generator = ProtocolBufferGenerator, |
| 36 emitter = ProtocolBufferEmitter, |
| 37 single_source = 1, |
| 38 suffix = '.pb.cc') |
| 39 |
5 env = Environment() | 40 env = Environment() |
6 env['CCFLAGS'] = '-g -fno-exceptions -Wall -Werror -D_FILE_OFFSET_BITS=64 ' + \ | 41 env['CCFLAGS'] = ' '.join("""-g |
7 '-I/usr/include/libxml2' | 42 -fno-exceptions |
8 env['LIBS'] = Split('curl gtest ssl xml2 z') | 43 -Wall |
9 env['CPPPATH'] = ['..'] | 44 -Werror |
| 45 -Wclobbered |
| 46 -Wempty-body |
| 47 -Wignored-qualifiers |
| 48 -Wmissing-field-initializers |
| 49 -Wsign-compare |
| 50 -Wtype-limits |
| 51 -Wuninitialized |
| 52 -D_FILE_OFFSET_BITS=64 |
| 53 -I/usr/include/libxml2""".split()); |
| 54 |
| 55 env['LIBS'] = Split("""base |
| 56 curl |
| 57 gflags |
| 58 glib-2.0 |
| 59 gtest |
| 60 gthread-2.0 |
| 61 libpcrecpp |
| 62 protobuf |
| 63 pthread |
| 64 ssl |
| 65 xml2 |
| 66 z""") |
| 67 env['CPPPATH'] = ['..', '../../third_party/chrome/files', '../../common'] |
| 68 env['LIBPATH'] = ['../../third_party/chrome'] |
| 69 env['BUILDERS']['ProtocolBuffer'] = proto_builder |
10 env.ParseConfig('pkg-config --cflags --libs glib-2.0') | 70 env.ParseConfig('pkg-config --cflags --libs glib-2.0') |
| 71 env.ProtocolBuffer('update_metadata.pb.cc', 'update_metadata.proto') |
11 | 72 |
12 if ARGUMENTS.get('debug', 0): | 73 if ARGUMENTS.get('debug', 0): |
13 env['CCFLAGS'] += ' -fprofile-arcs -ftest-coverage' | 74 env['CCFLAGS'] += ' -fprofile-arcs -ftest-coverage' |
14 env['LIBS'] += ['gcov'] | 75 env['LIBS'] += ['gcov'] |
15 | 76 |
| 77 |
| 78 |
16 sources = Split("""action_processor.cc | 79 sources = Split("""action_processor.cc |
17 decompressing_file_writer.cc | 80 decompressing_file_writer.cc |
| 81 delta_diff_parser.cc |
18 download_action.cc | 82 download_action.cc |
| 83 filesystem_copier_action.cc |
| 84 filesystem_iterator.cc |
| 85 file_writer.cc |
| 86 gzip.cc |
| 87 install_action.cc |
19 libcurl_http_fetcher.cc | 88 libcurl_http_fetcher.cc |
20 omaha_hash_calculator.cc | 89 omaha_hash_calculator.cc |
21 update_check_action.cc""") | 90 omaha_request_prep_action.cc |
| 91 omaha_response_handler_action.cc |
| 92 postinstall_runner_action.cc |
| 93 set_bootable_flag_action.cc |
| 94 subprocess.cc |
| 95 update_check_action.cc |
| 96 » » update_metadata.pb.cc |
| 97 » » utils.cc""") |
22 main = ['main.cc'] | 98 main = ['main.cc'] |
23 | 99 |
24 unittest_sources = Split("""action_unittest.cc | 100 unittest_sources = Split("""action_unittest.cc |
25 action_pipe_unittest.cc | 101 action_pipe_unittest.cc |
26 action_processor_unittest.cc | 102 action_processor_unittest.cc |
27 decompressing_file_writer_unittest.cc | 103 decompressing_file_writer_unittest.cc |
| 104 delta_diff_generator_unittest.cc |
28 download_action_unittest.cc | 105 download_action_unittest.cc |
29 file_writer_unittest.cc | 106 file_writer_unittest.cc |
| 107 filesystem_copier_action_unittest.cc |
| 108 filesystem_iterator_unittest.cc |
| 109 gzip_unittest.cc |
30 http_fetcher_unittest.cc | 110 http_fetcher_unittest.cc |
| 111 install_action_unittest.cc |
| 112 integration_unittest.cc |
31 mock_http_fetcher.cc | 113 mock_http_fetcher.cc |
32 omaha_hash_calculator_unittest.cc | 114 omaha_hash_calculator_unittest.cc |
| 115 omaha_request_prep_action_unittest.cc |
| 116 omaha_response_handler_action_unittest.cc |
| 117 postinstall_runner_action_unittest.cc |
| 118 set_bootable_flag_action_unittest.cc |
| 119 subprocess_unittest.cc |
33 test_utils.cc | 120 test_utils.cc |
34 update_check_action_unittest.cc""") | 121 update_check_action_unittest.cc |
| 122 utils_unittest.cc""") |
35 unittest_main = ['testrunner.cc'] | 123 unittest_main = ['testrunner.cc'] |
36 | 124 |
| 125 delta_generator_sources = Split("""delta_diff_generator.cc""") |
| 126 |
37 env.Program('update_engine', sources + main) | 127 env.Program('update_engine', sources + main) |
38 unittest_cmd = env.Program('update_engine_unittests', | 128 unittest_cmd = env.Program('update_engine_unittests', |
39 sources + unittest_sources + unittest_main) | 129 sources + delta_generator_sources + |
| 130 unittest_sources + unittest_main) |
40 | 131 |
41 Clean(unittest_cmd, Glob('*.gcda') + Glob('*.gcno') + Glob('*.gcov') + | 132 Clean(unittest_cmd, Glob('*.gcda') + Glob('*.gcno') + Glob('*.gcov') + |
42 Split('html app.info')) | 133 Split('html app.info')) |
| 134 |
| 135 delta_generator_cmd = env.Program('delta_generator', |
| 136 sources + delta_generator_sources + main) |
| 137 |
| 138 http_server_cmd = env.Program('test_http_server', 'test_http_server.cc') |
OLD | NEW |