diff options
author | noelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-13 19:51:13 +0000 |
---|---|---|
committer | noelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-13 19:51:13 +0000 |
commit | ebf9f3932c75fc02864e446f10aa4d99ffbe1512 (patch) | |
tree | 93f9f41bcbe7beb0e69025045e8a40c4ead88120 /native_client_sdk/src/examples/fullscreen_tumbler | |
parent | 2ad285cc76f93848cfec89f4028193793e8746e1 (diff) | |
download | chromium_src-ebf9f3932c75fc02864e446f10aa4d99ffbe1512.zip chromium_src-ebf9f3932c75fc02864e446f10aa4d99ffbe1512.tar.gz chromium_src-ebf9f3932c75fc02864e446f10aa4d99ffbe1512.tar.bz2 |
Convert examples from scons to Make
Remove all scons files.
Remove all scons test files.
Add Makefile.
Fix various build issues due to PPAPI changes.
NOTE: This only affect SDK builders and not Chrome itself.
BUG= http://code.google.com/p/chromium/issues/detail?id=109917
Review URL: http://codereview.chromium.org/9139029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117675 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk/src/examples/fullscreen_tumbler')
14 files changed, 227 insertions, 89 deletions
diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/Makefile b/native_client_sdk/src/examples/fullscreen_tumbler/Makefile new file mode 100644 index 0000000..79bc0b9 --- /dev/null +++ b/native_client_sdk/src/examples/fullscreen_tumbler/Makefile @@ -0,0 +1,188 @@ +# Copyright (c) 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. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# + +# +# Project information +# +# These variables store project specific settings for the project name +# build flags, files to copy or install. In the examples it is typically +# only the list of sources and project name that will actually change and +# the rest of the makefile is boilerplate for defining build rules. +# +PROJECT:=fullscreen_tumbler +C_SOURCES:= +CXX_SOURCES:=transforms.cc shader_util.cc opengl_context.cc tumbler_module.cc +CXX_SOURCES+=scripting_bridge.cc tumbler.cc cube.cc +COPY_FILES:=bind.js trackball.js dragger.js vector3.js tumbler.js +COPY_FILES+=fullscreen_tumbler.html fullscreen_tumbler.nmf +COPY_FILES+=../common/check_browser.js + + +# +# Get pepper directory for toolchain and includes. +# +# If PEPPER_ROOT is not set, then assume it can be found a two directories up, +# from the default example directory location. +# +THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST))) +PEPPER_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..) + +# Project Build flags +DEFINES:= +INCLUDES:= +WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -pedantic -Werror +CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS) $(DEFINES) $(INCLUDES) +LDFLAGS:=-lppapi_gles2 -lppapi_cpp -lppapi + +# +# Compute tool paths +# +# +OSNAME:=$(shell python $(PEPPER_ROOT)/tools/getos.py) +TC_PATH:=$(abspath $(PEPPER_ROOT)/toolchain/$(OSNAME)_x86_newlib) +CC:=$(TC_PATH)/bin/i686-nacl-gcc +CXX:=$(TC_PATH)/bin/i686-nacl-g++ +STRIP:=$(TC_PATH)/bin/i686-nacl-strip + +# +# Create shell aliases +# +# Create Python based aliases for common shell commands like copy or move. +# +COPY = python $(PEPPER_ROOT)/tools/oshelpers.py cp +MKDIR = python $(PEPPER_ROOT)/tools/oshelpers.py mkdir +RM = python $(PEPPER_ROOT)/tools/oshelpers.py rm +MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv + +# +# Disable DOS PATH warning when using Cygwin based tools Windows +# +CYGWIN ?= nodosfilewarning +export CYGWIN + +# +# Define a macro for copying files to the configuration directory +# +# Copys a source file to the destination directory, removing the base path +# from the source. Adds a dependency to the destination directory in case it +# needs to be created. +# +# $(1) = Source file +# $(2) = Destination directory +define FILE_COPY +$(2)/$(notdir $(1)) : $(1) | $(2) + $(COPY) $(1) $(2) +$(2)_COPIES+=$(2)/$(notdir $(1)) +endef + + +# Declare the ALL target first, to make the 'all' target the default build +all: DEBUG RELEASE + + +# +# Debug Build rules. +# +DEBUG_x86_32_FLAGS:=-m32 -O0 -g +DEBUG_x86_64_FLAGS:=-m64 -O0 -g +DEBUG_x86_32_OBJS:=$(patsubst %.cc,DBG/x86_32/%.o,$(CXX_SOURCES)) +DEBUG_x86_64_OBJS:=$(patsubst %.cc,DBG/x86_64/%.o,$(CXX_SOURCES)) + +# Create DBG configuration directories +DBG: + $(MKDIR) -p $@ + +DBG/x86_32: + $(MKDIR) -p $@ + +DBG/x86_64: + $(MKDIR) -p $@ + +# Copy all files to that config +$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),DBG))) + +# Include generated dependencies +-include DBG/x86_32/*.d +-include DBG/x86_64/*.d + +# Define compile rule for all 32 bit debug objects +DBG/x86_32/%.o : %.cc $(THIS_MAKE) | DBG/x86_32 + $(CXX) -o $@ -c $< $(DEBUG_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d + +# Define compile rule for all 64 bit debug objects +DBG/x86_64/%.o : %.cc $(THIS_MAKE) | DBG/x86_64 + $(CXX) -o $@ -c $< $(DEBUG_x86_64_FLAGS) $(CXXFLAGS) + +# Define Link rule for 32 bit debug NEXE +DBG/$(PROJECT)_x86_32.nexe : $(DEBUG_x86_32_OBJS) + $(CXX) -o $@ $^ $(DEBUG_x86_32_FLAGS) $(LDFLAGS) + +# Define Link rule for 64 bit debug NEXE +DBG/$(PROJECT)_x86_64.nexe : $(DEBUG_x86_64_OBJS) + $(CXX) -o $@ $^ $(DEBUG_x86_64_FLAGS) $(LDFLAGS) + +# Define a DEBUG alias to build the debug version +.PHONY : DEBUG RUN_DEBUG +DEBUG : DBG/$(PROJECT)_x86_32.nexe DBG/$(PROJECT)_x86_64.nexe $(DBG_COPIES) + +# Define a RUN_DEBUG alias to build and server the DEBUG version +RUN_DEBUG: DEBUG + cd DBG && python ../../httpd.py + + +# +# Release build rules. +# +RELEASE_x86_32_FLAGS:=-m32 -O2 -g +RELEASE_x86_64_FLAGS:=-m64 -O2 -g +RELEASE_x86_32_OBJS:=$(patsubst %.cc,REL/x86_32/%.o,$(CXX_SOURCES)) +RELEASE_x86_64_OBJS:=$(patsubst %.cc,REL/x86_64/%.o,$(CXX_SOURCES)) + +REL: + $(MKDIR) -p $@ + +REL/x86_32: + $(MKDIR) -p $@ + +REL/x86_64: + $(MKDIR) -p $@ + +# Copy all files to that config +$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),REL))) + +# Include generated dependencies +-include REL/x86_32/*.d +-include REL/x86_64/*.d + +# Define compile rule for all 32 bit debug objects +REL/x86_32/%.o : %.cc $(THIS_MAKE) | REL/x86_32 + $(CXX) -o $@ -c $< $(RELEASE_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d + +# Define compile rule for all 64 bit debug objects +REL/x86_64/%.o : %.cc $(THIS_MAKE) | REL/x86_64 + $(CXX) -o $@ -c $< $(RELEASE_x86_64_FLAGS) $(CXXFLAGS) + +# Define Link rule for 32 bit optimized and stripped NEXE +REL/$(PROJECT)_x86_32.nexe : $(RELEASE_x86_32_OBJS) + $(CXX) -o $@.unstripped $^ $(RELEASE_x86_32_FLAGS) $(LDFLAGS) + $(STRIP) $< -o $@ + +# Define Link rule for 64 bit optimized and stripped NEXE +REL/$(PROJECT)_x86_64.nexe : $(RELEASE_x86_64_OBJS) + $(CXX) -o $@.unstripped $^ $(RELEASE_x86_64_FLAGS) $(LDFLAGS) + $(STRIP) $@.unstripped -o $@ + +# Define a RELEASE alias to build the debug version +.PHONY : RELEASE RUN_RELEASE +RELEASE : REL/$(PROJECT)_x86_32.nexe REL/$(PROJECT)_x86_64.nexe $(REL_COPIES) + +# Define a RUN_RELEASE alias to build and server the RELEASE version +RUN_RELEASE: RELEASE + cd REL && python ../../httpd.py + diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/build.scons b/native_client_sdk/src/examples/fullscreen_tumbler/build.scons deleted file mode 100644 index b68cd27..0000000 --- a/native_client_sdk/src/examples/fullscreen_tumbler/build.scons +++ /dev/null @@ -1,66 +0,0 @@ -#! -*- python -*- -# -# Copyright (c) 2011 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import make_nacl_env -import nacl_utils -import os - -nacl_env = make_nacl_env.NaClEnvironment( - use_c_plus_plus_libs=True, nacl_platform=os.getenv('NACL_TARGET_PLATFORM'), - install_subdir='fullscreen_tumbler', lib_prefix='..') -nacl_env.Append( - # Add a CPPPATH that enables the full-path #include directives, such as - # #include "examples/sine_synth/sine_synth.h" - CPPPATH=[os.path.dirname(os.path.dirname(os.getcwd()))], - # Strict ANSI compliance. - EXTRA_CCFLAGS=['-pedantic'], - LIBS=['ppapi_gles2'], - ) - -sources = [ - 'cube.cc', - 'opengl_context.cc', - 'scripting_bridge.cc', - 'shader_util.cc', - 'transforms.cc', - 'tumbler.cc', - 'tumbler_module.cc', - ] - -opt_nexes, dbg_nexes = nacl_env.AllNaClModules(sources, 'fullscreen_tumbler') - -# This target is used by the SDK build system to provide a prebuilt version -# of the example in the SDK installer. -nacl_env.InstallPrebuilt('fullscreen_tumbler') - -common_files = [ - 'check_browser.js', - ] -common_files = [ - os.path.join(os.path.dirname(os.getcwd()), 'common', common_file) - for common_file in common_files] - -app_files = [ - 'fullscreen_tumbler.html', - 'fullscreen_tumbler.nmf', - 'bind.js', - 'dragger.js', - 'trackball.js', - 'tumbler.js', - 'vector3.js', - ] - -# Split the install of the .nexes from the other app sources so that the strip -# action is applied to the .nexes only. -install_nexes = nacl_env.NaClStrippedInstall(dir=nacl_env['NACL_INSTALL_ROOT'], - source=opt_nexes) -install_app = nacl_env.Install(dir=nacl_env['NACL_INSTALL_ROOT'], - source=app_files) -common_dir = os.path.join(os.path.dirname(nacl_env['NACL_INSTALL_ROOT']), - 'common') -install_common = nacl_env.Install(dir=common_dir, source=common_files) -nacl_env.Alias('install', - source=[install_app, install_common, install_nexes]) diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/cube.cc b/native_client_sdk/src/examples/fullscreen_tumbler/cube.cc index 5ce78c7..b9daf01 100644 --- a/native_client_sdk/src/examples/fullscreen_tumbler/cube.cc +++ b/native_client_sdk/src/examples/fullscreen_tumbler/cube.cc @@ -2,12 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "examples/fullscreen_tumbler/cube.h" #include <algorithm> +#include <GLES2/gl2.h> + +#include "ppapi/gles2/gl2ext_ppapi.h" + +#include "cube.h" +#include "shader_util.h" +#include "transforms.h" -#include "examples/fullscreen_tumbler/shader_util.h" -#include "examples/fullscreen_tumbler/transforms.h" namespace tumbler { diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/cube.h b/native_client_sdk/src/examples/fullscreen_tumbler/cube.h index 452182f..a90e0364 100644 --- a/native_client_sdk/src/examples/fullscreen_tumbler/cube.h +++ b/native_client_sdk/src/examples/fullscreen_tumbler/cube.h @@ -7,8 +7,9 @@ #include <GLES2/gl2.h> #include <vector> -#include "examples/fullscreen_tumbler/opengl_context.h" -#include "examples/fullscreen_tumbler/opengl_context_ptrs.h" + +#include "opengl_context.h" +#include "opengl_context_ptrs.h" namespace tumbler { diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/fullscreen_tumbler.html b/native_client_sdk/src/examples/fullscreen_tumbler/fullscreen_tumbler.html index 84daad7..880acc4 100644 --- a/native_client_sdk/src/examples/fullscreen_tumbler/fullscreen_tumbler.html +++ b/native_client_sdk/src/examples/fullscreen_tumbler/fullscreen_tumbler.html @@ -14,7 +14,7 @@ // Fullscreen support is in Chrome version 16. tumbler.CHROME_MINIMUM_VERSION = 16; </script> - <script type="text/javascript" src="../common/check_browser.js"></script> + <script type="text/javascript" src="check_browser.js"></script> <script type="text/javascript" src="bind.js"></script> <script type="text/javascript" src="dragger.js"></script> <script type="text/javascript" src="tumbler.js"></script> diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/opengl_context.cc b/native_client_sdk/src/examples/fullscreen_tumbler/opengl_context.cc index 8f0844d..d1675fc 100644 --- a/native_client_sdk/src/examples/fullscreen_tumbler/opengl_context.cc +++ b/native_client_sdk/src/examples/fullscreen_tumbler/opengl_context.cc @@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "examples/fullscreen_tumbler/opengl_context.h" #include <pthread.h> + +#include "ppapi/c/pp_graphics_3d.h" #include "ppapi/cpp/completion_callback.h" #include "ppapi/gles2/gl2ext_ppapi.h" +#include "opengl_context.h" namespace { // This is called by the brower when the 3D context has been flushed to the diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/opengl_context.h b/native_client_sdk/src/examples/fullscreen_tumbler/opengl_context.h index 24d7d90..48a8462 100644 --- a/native_client_sdk/src/examples/fullscreen_tumbler/opengl_context.h +++ b/native_client_sdk/src/examples/fullscreen_tumbler/opengl_context.h @@ -17,13 +17,14 @@ #include <algorithm> #include <string> -#include "examples/fullscreen_tumbler/opengl_context_ptrs.h" #include "ppapi/c/ppb_opengles2.h" #include "ppapi/cpp/graphics_3d.h" #include "ppapi/cpp/graphics_3d_client.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/size.h" +#include "opengl_context_ptrs.h" + namespace tumbler { /// OpenGLContext manages an OpenGL rendering context in the browser. diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/scripting_bridge.cc b/native_client_sdk/src/examples/fullscreen_tumbler/scripting_bridge.cc index ba87765..b44bb8e 100644 --- a/native_client_sdk/src/examples/fullscreen_tumbler/scripting_bridge.cc +++ b/native_client_sdk/src/examples/fullscreen_tumbler/scripting_bridge.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "examples/fullscreen_tumbler/scripting_bridge.h" +#include "scripting_bridge.h" namespace { const char* const kWhiteSpaceCharacters = " \t"; diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/scripting_bridge.h b/native_client_sdk/src/examples/fullscreen_tumbler/scripting_bridge.h index 6c32c10..e89d157 100644 --- a/native_client_sdk/src/examples/fullscreen_tumbler/scripting_bridge.h +++ b/native_client_sdk/src/examples/fullscreen_tumbler/scripting_bridge.h @@ -10,9 +10,10 @@ #include <tr1/memory> #include <vector> -#include "examples/fullscreen_tumbler/callback.h" #include "ppapi/cpp/var.h" +#include "callback.h" + namespace tumbler { class MethodCallbackExecutor; diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/shader_util.cc b/native_client_sdk/src/examples/fullscreen_tumbler/shader_util.cc index 544d9a4..e6a4ae7 100644 --- a/native_client_sdk/src/examples/fullscreen_tumbler/shader_util.cc +++ b/native_client_sdk/src/examples/fullscreen_tumbler/shader_util.cc @@ -2,10 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "examples/fullscreen_tumbler/shader_util.h" - #include <stdio.h> #include <stdlib.h> +#include <GLES2/gl2.h> + +#include "ppapi/gles2/gl2ext_ppapi.h" +#include "shader_util.h" namespace shader_util { diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/transforms.cc b/native_client_sdk/src/examples/fullscreen_tumbler/transforms.cc index 4e1a892..75a7c2c 100644 --- a/native_client_sdk/src/examples/fullscreen_tumbler/transforms.cc +++ b/native_client_sdk/src/examples/fullscreen_tumbler/transforms.cc @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "examples/fullscreen_tumbler/transforms.h" - #include <GLES2/gl2.h> #include <math.h> #include <string.h> +#include "transforms.h" + namespace transform_4x4 { static const GLfloat kPI = 3.1415926535897932384626433832795f; diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/tumbler.cc b/native_client_sdk/src/examples/fullscreen_tumbler/tumbler.cc index 2437141..a4fe68e 100644 --- a/native_client_sdk/src/examples/fullscreen_tumbler/tumbler.cc +++ b/native_client_sdk/src/examples/fullscreen_tumbler/tumbler.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "examples/fullscreen_tumbler/tumbler.h" #include <stdio.h> @@ -11,14 +10,16 @@ #include <string> #include <vector> -#include "examples/fullscreen_tumbler/cube.h" -#include "examples/fullscreen_tumbler/opengl_context.h" -#include "examples/fullscreen_tumbler/scripting_bridge.h" #include "ppapi/cpp/input_event.h" #include "ppapi/cpp/rect.h" #include "ppapi/cpp/size.h" #include "ppapi/cpp/var.h" +#include "cube.h" +#include "opengl_context.h" +#include "scripting_bridge.h" +#include "tumbler.h" + namespace { const uint32_t kKeyEnter = 0x0D; const size_t kQuaternionElementCount = 4; diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/tumbler.h b/native_client_sdk/src/examples/fullscreen_tumbler/tumbler.h index 6fe0e20..35699d8 100644 --- a/native_client_sdk/src/examples/fullscreen_tumbler/tumbler.h +++ b/native_client_sdk/src/examples/fullscreen_tumbler/tumbler.h @@ -9,13 +9,14 @@ #include <map> #include <vector> -#include "examples/fullscreen_tumbler/cube.h" -#include "examples/fullscreen_tumbler/opengl_context.h" -#include "examples/fullscreen_tumbler/opengl_context_ptrs.h" -#include "examples/fullscreen_tumbler/scripting_bridge.h" #include "ppapi/cpp/fullscreen.h" #include "ppapi/cpp/instance.h" +#include "cube.h" +#include "opengl_context.h" +#include "opengl_context_ptrs.h" +#include "scripting_bridge.h" + namespace pp { class KeyboardInputEvent; } // namespace pp diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/tumbler_module.cc b/native_client_sdk/src/examples/fullscreen_tumbler/tumbler_module.cc index bf4bee0..d1d103f 100644 --- a/native_client_sdk/src/examples/fullscreen_tumbler/tumbler_module.cc +++ b/native_client_sdk/src/examples/fullscreen_tumbler/tumbler_module.cc @@ -2,11 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "examples/fullscreen_tumbler/tumbler.h" +#include <GLES2/gl2.h> + #include "ppapi/cpp/instance.h" #include "ppapi/cpp/module.h" #include "ppapi/gles2/gl2ext_ppapi.h" +#include "tumbler.h" + /// The Module class. The browser calls the CreateInstance() method to create /// an instance of your NaCl module on the web page. The browser creates a new /// instance for each <embed> tag with type="application/x-nacl". |