OLD | NEW |
| (Empty) |
1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 Import('env') | |
6 | |
7 env = env.Clone() | |
8 | |
9 env.Prepend( | |
10 CPPPATH = [ | |
11 '$ICU38_DIR/public/common', | |
12 '$ICU38_DIR/public/i18n', | |
13 '#/..', | |
14 ], | |
15 ) | |
16 | |
17 env.Append( | |
18 CPPDEFINES = [ | |
19 'U_STATIC_IMPLEMENTATION', | |
20 ], | |
21 ) | |
22 | |
23 if env['PLATFORM'] == 'win32': | |
24 env.Append( | |
25 CCFLAGS = [ | |
26 '/TP', | |
27 ], | |
28 ) | |
29 | |
30 lib_input_files = [ | |
31 'gurl.cc', | |
32 'url_canon_etc.cc', | |
33 'url_canon_fileurl.cc', | |
34 'url_canon_host.cc', | |
35 'url_canon_icu.cc', | |
36 'url_canon_internal.cc', | |
37 'url_canon_ip.cc', | |
38 'url_canon_mailtourl.cc', | |
39 'url_canon_path.cc', | |
40 'url_canon_pathurl.cc', | |
41 'url_canon_query.cc', | |
42 'url_canon_relative.cc', | |
43 'url_canon_stdurl.cc', | |
44 'url_parse.cc', | |
45 'url_parse_file.cc', | |
46 'url_util.cc', | |
47 ] | |
48 | |
49 def BuildObjectFiles(environ, input_files): | |
50 obj_files = [] | |
51 for input_file in input_files: | |
52 source = '../googleurl/src/' + input_file | |
53 target = '$TARGET_ROOT/googleurl/' + input_file[:input_file.find('.cc')] | |
54 obj_files.append(environ.StaticObject(source = source, target = target)) | |
55 return obj_files | |
56 | |
57 env.ChromeStaticLibrary('$TARGET_ROOT/googleurl/googleurl', | |
58 BuildObjectFiles(env, lib_input_files)) | |
59 | |
60 env_tests = env.Clone() | |
61 | |
62 env_tests.Append( | |
63 CPPPATH = [ | |
64 '$GTEST_DIR/include', | |
65 ], | |
66 CPPDEFINES = [ | |
67 'UNIT_TEST', | |
68 ], | |
69 LIBS = [ | |
70 'googleurl', | |
71 'base', | |
72 env_tests['ICU_LIBS'], # TODO(sgk): '$ICU_LIBS' when scons is fixed | |
73 'gtest', | |
74 ] | |
75 ) | |
76 | |
77 test_files = [ | |
78 'gurl_unittest.cc', | |
79 'url_canon_unittest.cc', | |
80 'url_parse_unittest.cc', | |
81 'url_util_unittest.cc', | |
82 ] | |
83 | |
84 test_obj_files = BuildObjectFiles(env_tests, test_files) | |
85 # The version of gtest that googleurl uses provides a main() function; ours | |
86 # doesn't so include our own main function. | |
87 test_obj_files.append(env_tests.StaticObject(source = '../base/run_all_unittests
.cc', | |
88 target = '$TARGET_ROOT/googleurl/run_all_unittests')) | |
89 | |
90 gurl_unittests = env_tests.ChromeTestProgram( | |
91 '$TARGET_ROOT/googleurl/googleurl_unittests', test_obj_files) | |
92 | |
93 installed_gurl_unittests = env.Install('$TARGET_ROOT', gurl_unittests) | |
94 | |
95 env.Alias('googleurl', installed_gurl_unittests) | |
OLD | NEW |