Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 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 import fnmatch | 5 import fnmatch | 
| 6 import itertools | 6 import itertools | 
| 7 import os | 7 import os | 
| 8 | 8 | 
| 9 import make_shaders | 9 import make_shaders | 
| 10 | 10 | 
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 # Unless we disable strict aliasing, we get warnings about some of the | 32 # Unless we disable strict aliasing, we get warnings about some of the | 
| 33 # program's command line flags processing code that look like: | 33 # program's command line flags processing code that look like: | 
| 34 # 'dereferencing type-punned pointer will break strict-aliasing rules' | 34 # 'dereferencing type-punned pointer will break strict-aliasing rules' | 
| 35 base_env.Append(CCFLAGS=['-fno-strict-aliasing']) | 35 base_env.Append(CCFLAGS=['-fno-strict-aliasing']) | 
| 36 | 36 | 
| 37 base_env.Append(CPPPATH=['..']) | 37 base_env.Append(CPPPATH=['..']) | 
| 38 | 38 | 
| 39 # We need glib-2.0 ONLY to satisfy libbase. | 39 # We need glib-2.0 ONLY to satisfy libbase. | 
| 40 # TODO(derat): Weep. | 40 # TODO(derat): Weep. | 
| 41 base_env.Append(LIBS=Split('base gflags pthread rt')) | 41 base_env.Append(LIBS=Split('base gflags pthread rt')) | 
| 42 base_env.ParseConfig('pkg-config --cflags --libs glib-2.0 x11') | 42 base_env.ParseConfig('pkg-config --cflags --libs glib-2.0 x11 xrender') | 
| 
 
Daniel Erat
2011/04/02 14:54:36
nit: this should be in wm_env below, not base_env
 
 | |
| 43 | 43 | 
| 44 # Fork off a new environment, add Cairo to it, and build the screenshot | 44 # Fork off a new environment, add Cairo to it, and build the screenshot | 
| 45 # program. | 45 # program. | 
| 46 screenshot_env = base_env.Clone() | 46 screenshot_env = base_env.Clone() | 
| 47 screenshot_env.ParseConfig('pkg-config --cflags --libs cairo') | 47 screenshot_env.ParseConfig('pkg-config --cflags --libs cairo') | 
| 48 screenshot_env.Program('screenshot', 'screenshot.cc') | 48 screenshot_env.Program('screenshot', 'screenshot.cc') | 
| 49 | 49 | 
| 50 # Check for BACKEND on the build line | 50 # Check for BACKEND on the build line | 
| 51 backend = ARGUMENTS.get('BACKEND', 'OPENGL').lower() | 51 backend = ARGUMENTS.get('BACKEND', 'OPENGL').lower() | 
| 52 | 52 | 
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 srcs.append(Split('''\ | 127 srcs.append(Split('''\ | 
| 128 compositor/gles/opengles_visitor.cc | 128 compositor/gles/opengles_visitor.cc | 
| 129 compositor/gles/real_gles2_interface.cc | 129 compositor/gles/real_gles2_interface.cc | 
| 130 compositor/gles/shader_base.cc | 130 compositor/gles/shader_base.cc | 
| 131 compositor/gles/shaders.cc | 131 compositor/gles/shaders.cc | 
| 132 ''')) | 132 ''')) | 
| 133 # SCons doesn't figure out this dependency on its own, since | 133 # SCons doesn't figure out this dependency on its own, since | 
| 134 # opengles_visitor.cc includes "window_manager/compositor/gles/shaders.h", | 134 # opengles_visitor.cc includes "window_manager/compositor/gles/shaders.h", | 
| 135 # while the shaders builder just provides "compositor/gles/shaders.h". | 135 # while the shaders builder just provides "compositor/gles/shaders.h". | 
| 136 Depends('compositor/gles/opengles_visitor.o', 'compositor/gles/shaders.h') | 136 Depends('compositor/gles/opengles_visitor.o', 'compositor/gles/shaders.h') | 
| 137 elif backend == 'xrender': | |
| 138 srcs.append(Split('''\ | |
| 139 compositor/xrender/xrender_visitor.cc | |
| 140 ''')) | |
| 137 | 141 | 
| 138 libwm_core = wm_env.Library('wm_core', srcs) | 142 libwm_core = wm_env.Library('wm_core', srcs) | 
| 139 | 143 | 
| 140 # Define a library to be used by tests. | 144 # Define a library to be used by tests. | 
| 141 srcs = Split('''\ | 145 srcs = Split('''\ | 
| 142 compositor/gl/mock_gl_interface.cc | 146 compositor/gl/mock_gl_interface.cc | 
| 143 compositor/mock_compositor.cc | 147 compositor/mock_compositor.cc | 
| 144 mock_dbus_interface.cc | 148 mock_dbus_interface.cc | 
| 145 test_lib.cc | 149 test_lib.cc | 
| 146 x11/mock_x_connection.cc | 150 x11/mock_x_connection.cc | 
| 147 ''') | 151 ''') | 
| 148 libtest = wm_env.Library('test', Split(srcs)) | 152 libtest = wm_env.Library('test', Split(srcs)) | 
| 149 | 153 | 
| 150 wm_env.Prepend(LIBS=[libwm_core, libwm_ipc]) | 154 wm_env.Prepend(LIBS=[libwm_core, libwm_ipc]) | 
| 151 | 155 | 
| 152 backend_defines = {'opengl': ['COMPOSITOR_OPENGL'], | 156 backend_defines = {'opengl': ['COMPOSITOR_OPENGL'], | 
| 153 'opengles': ['COMPOSITOR_OPENGLES']} | 157 'opengles': ['COMPOSITOR_OPENGLES'], | 
| 158 'xrender': ['COMPOSITOR_XRENDER']} | |
| 154 wm_env.Append(CPPDEFINES=backend_defines[backend]) | 159 wm_env.Append(CPPDEFINES=backend_defines[backend]) | 
| 155 | 160 | 
| 156 test_env = wm_env.Clone() | 161 test_env = wm_env.Clone() | 
| 157 | 162 | 
| 158 wm_env.Program('wm', 'main.cc') | 163 wm_env.Program('wm', 'main.cc') | 
| 159 | 164 | 
| 160 test_env.Append(LIBS=['gtest']) | 165 test_env.Append(LIBS=['gtest']) | 
| 161 # libtest needs to be listed first since it depends on wm_core and wm_ipc. | 166 # libtest needs to be listed first since it depends on wm_core and wm_ipc. | 
| 162 test_env.Prepend(LIBS=[libtest]) | 167 test_env.Prepend(LIBS=[libtest]) | 
| 163 tests = [] | 168 tests = [] | 
| 164 | 169 | 
| 165 # These are tests that only get built when we use particular backends. | 170 # These are tests that only get built when we use particular backends. | 
| 166 backend_tests = {'opengl': ['real_compositor_test.cc', | 171 backend_tests = {'opengl': ['real_compositor_test.cc', | 
| 167 'opengl_visitor_test.cc'], | 172 'opengl_visitor_test.cc'], | 
| 168 'opengles': []} | 173 'opengles': [], | 
| 174 'xrender': []} | |
| 169 all_backend_tests = set(itertools.chain(*backend_tests.values())) | 175 all_backend_tests = set(itertools.chain(*backend_tests.values())) | 
| 170 for root, dirnames, filenames in os.walk('.'): | 176 for root, dirnames, filenames in os.walk('.'): | 
| 171 for filename in fnmatch.filter(filenames, '*_test.cc'): | 177 for filename in fnmatch.filter(filenames, '*_test.cc'): | 
| 172 if filename in all_backend_tests and filename not in backend_tests[backend]: | 178 if filename in all_backend_tests and filename not in backend_tests[backend]: | 
| 173 continue | 179 continue | 
| 174 tests += test_env.Program(os.path.join(root, filename)) | 180 tests += test_env.Program(os.path.join(root, filename)) | 
| 175 | 181 | 
| 176 # Create a 'tests' target that will build all tests. | 182 # Create a 'tests' target that will build all tests. | 
| 177 test_env.Alias('tests', tests) | 183 test_env.Alias('tests', tests) | 
| 178 | 184 | 
| 179 # mock_chrome is just a small program that developers can use to test | 185 # mock_chrome is just a small program that developers can use to test | 
| 180 # interaction between the window manager and Chrome. We only define a | 186 # interaction between the window manager and Chrome. We only define a | 
| 181 # target for it if gtkmm is installed so that this SConstruct file can | 187 # target for it if gtkmm is installed so that this SConstruct file can | 
| 182 # still be parsed in the chroot build environment, which shouldn't contain | 188 # still be parsed in the chroot build environment, which shouldn't contain | 
| 183 # gtkmm. | 189 # gtkmm. | 
| 184 if os.system('pkg-config --exists gtkmm-2.4') == 0: | 190 if os.system('pkg-config --exists gtkmm-2.4') == 0: | 
| 185 mock_chrome_env = wm_env.Clone() | 191 mock_chrome_env = wm_env.Clone() | 
| 186 mock_chrome_env.ParseConfig('pkg-config --cflags --libs gtkmm-2.4') | 192 mock_chrome_env.ParseConfig('pkg-config --cflags --libs gtkmm-2.4') | 
| 187 mock_chrome_env.Program('mock_chrome', 'mock_chrome.cc') | 193 mock_chrome_env.Program('mock_chrome', 'mock_chrome.cc') | 
| OLD | NEW |