blob: 7caf477255eb57d2a14e765033ef226179872deb [file] [log] [blame]
# -*- python -*-
# Copyright 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
# OpenGL ES examples
Import('env')
env.Prepend(CPPDEFINES=['XP_UNIX'])
env.Replace(TEST_DIR='${SOURCE_ROOT}/ppapi/native_client/tests/' +
'ppapi_gles_book/')
# Underlay $SOURCE_ROOT/gpu in this directory.
Dir('.').addRepository(Dir('#/../gpu'))
# Underlay $SOURCE_ROOT/third_party/gles2_book in this directory.
Dir('.').addRepository(Dir('#/../third_party/gles2_book'))
# Don't warn on pointer signedness issues (third_party sources)
env.Append(CFLAGS=['-Wno-pointer-sign'])
# ..and don't warn about missing braces
env.Append(CCFLAGS=['-Wno-missing-braces'])
# Add local path to find GPU sources and GLES2 includes.
env.Append(CPPPATH=[
'$SOURCE_ROOT/third_party/gles2_book/Common/Include',
'$SOURCE_ROOT/ppapi/lib/gl/include',
])
gles_demo_srcs = [
'Common/Source/esShader.c',
'Common/Source/esShapes.c',
'Common/Source/esTransform.c',
'Common/Source/esUtil.c',
'demos/framework/demo.cc',
'demos/framework/pepper.cc',
]
env.ComponentLibrary('ppapi_gles_demo', gles_demo_srcs)
gles_book_examples = {
'hello_triangle': [
'Chapter_2/Hello_Triangle/Hello_Triangle.c'],
'mip_map_2d': [
'Chapter_9/MipMap2D/MipMap2D.c'],
'simple_texture_2d': [
'Chapter_9/Simple_Texture2D/Simple_Texture2D.c'],
'simple_texture_cubemap': [
'Chapter_9/Simple_TextureCubemap/Simple_TextureCubemap.c'],
'simple_vertex_shader': [
'Chapter_8/Simple_VertexShader/Simple_VertexShader.c'],
'stencil_test': [
'Chapter_11/Stencil_Test/Stencil_Test.c'],
'texture_wrap': [
'Chapter_9/TextureWrap/TextureWrap.c'],
}
for demo, sources in gles_book_examples.iteritems():
nexe_name = ('ppapi_gles_book_%s_%s'
% (demo, env.get('TARGET_FULLARCH')))
nmf_name = 'ppapi_gles_book_' + demo + '.nmf'
nexe = env.ComponentProgram(
nexe_name,
['demos/gles2_book/demo_' + demo + '.cc'] + sources,
EXTRA_LIBS=['${PPAPI_LIBS}',
'ppapi_cpp',
'ppapi_gles_demo',
'ppapi_cpp',
'ppapi_gles2',
'm'])
env.Publish(nexe_name, 'run',
['ppapi_gles_book.html'])
test = env.PPAPIBrowserTester(
'ppapi_gles_book_' + demo + '.out',
url='ppapi_gles_book.html?manifest=' + nmf_name,
nmfs=['${TEST_DIR}/' + nmf_name],
files=[nexe,
env.File('ppapi_gles_book.html')],
browser_flags=['--enable-accelerated-plugins'])
env.AddNodeToTestSuite(
test,
['chrome_browser_tests'],
'run_ppapi_gles_book_' + demo + '_test',
is_broken=env.PPAPIBrowserTesterIsBroken() or
env.PPAPIGraphics3DIsBroken())