| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 53 # Start a new environment for the window manager. | 53 # Start a new environment for the window manager. |
| 54 wm_env = base_env.Clone() | 54 wm_env = base_env.Clone() |
| 55 | 55 |
| 56 wm_env.Append(LIBS=Split('chromeos metrics protobuf')) | 56 wm_env.Append(LIBS=Split('chromeos metrics protobuf')) |
| 57 wm_env.ParseConfig('pkg-config --cflags --libs dbus-1 libpcrecpp libpng12 ' + | 57 wm_env.ParseConfig('pkg-config --cflags --libs dbus-1 libpcrecpp libpng12 ' + |
| 58 'xcb x11-xcb xcb-composite xcb-randr xcb-shape xcb-damage ' + | 58 'xcb x11-xcb xcb-composite xcb-randr xcb-shape xcb-damage ' + |
| 59 'xcb-sync xcomposite xdamage xext') | 59 'xcb-sync xcomposite xdamage xext xrender') |
| 60 | 60 |
| 61 if backend == 'opengl': | 61 if backend == 'opengl': |
| 62 # This is needed so that glext headers include glBindBuffer and | 62 # This is needed so that glext headers include glBindBuffer and |
| 63 # related APIs. | 63 # related APIs. |
| 64 wm_env.Append(CPPDEFINES=['GL_GLEXT_PROTOTYPES']) | 64 wm_env.Append(CPPDEFINES=['GL_GLEXT_PROTOTYPES']) |
| 65 wm_env.ParseConfig('pkg-config --cflags --libs gl') | 65 wm_env.ParseConfig('pkg-config --cflags --libs gl') |
| 66 elif backend == 'opengles': | 66 elif backend == 'opengles': |
| 67 # Add builder for .glsl* files, and GLESv2 libraries | 67 # Add builder for .glsl* files, and GLESv2 libraries |
| 68 make_shaders.AddBuildRules(wm_env) | 68 make_shaders.AddBuildRules(wm_env) |
| 69 wm_env.Append(LIBS=['EGL', 'GLESv2']) | 69 wm_env.Append(LIBS=['EGL', 'GLESv2']) |
| (...skipping 57 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 |