diff options
author | gspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-04 17:25:00 +0000 |
---|---|---|
committer | gspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-04 17:25:00 +0000 |
commit | 37a625a6cefff0972bc95d2add8a797a37dbb3f9 (patch) | |
tree | 43e4b5f31e2d44b6a456fee666b3988d4b2f212d /o3d | |
parent | e6060447254932d459c6c6fa6061c11a01432c7d (diff) | |
download | chromium_src-37a625a6cefff0972bc95d2add8a797a37dbb3f9.zip chromium_src-37a625a6cefff0972bc95d2add8a797a37dbb3f9.tar.gz chromium_src-37a625a6cefff0972bc95d2add8a797a37dbb3f9.tar.bz2 |
This adds in targets for selenium and updated several other problems,
including some problems with the samples and idl generation.
Selenium targets launch selenium on all platforms, but the tests don't
pass anywhere but Windows yet because the plugin isn't found.
I'll work on that next.
Review URL: http://codereview.chromium.org/197014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25467 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/DEPS_gyp | 10 | ||||
-rw-r--r-- | o3d/build/all.gyp | 4 | ||||
-rw-r--r-- | o3d/build/common.gypi | 19 | ||||
-rw-r--r-- | o3d/build/libs.gyp | 135 | ||||
-rw-r--r-- | o3d/build/nacl.gyp | 52 | ||||
-rw-r--r-- | o3d/compiler/technique/technique.gyp | 13 | ||||
-rw-r--r-- | o3d/converter/converter.gyp | 29 | ||||
-rw-r--r-- | o3d/core/core.gyp | 43 | ||||
-rw-r--r-- | o3d/core/cross/canvas_paint.cc | 2 | ||||
-rw-r--r-- | o3d/import/archive.gyp | 15 | ||||
-rw-r--r-- | o3d/import/import.gyp | 19 | ||||
-rw-r--r-- | o3d/plugin/cross/main.cc | 2 | ||||
-rw-r--r-- | o3d/plugin/idl/codegen.py | 1 | ||||
-rw-r--r-- | o3d/plugin/idl/idl.gyp | 118 | ||||
-rw-r--r-- | o3d/plugin/idl/idl_filenames.py | 24 | ||||
-rw-r--r-- | o3d/plugin/linux/main_linux.cc | 2 | ||||
-rw-r--r-- | o3d/plugin/plugin.gyp | 76 | ||||
-rw-r--r-- | o3d/samples/samples.gyp | 71 | ||||
-rw-r--r-- | o3d/samples/samples_gen.py | 352 | ||||
-rw-r--r-- | o3d/tests/selenium/main.py | 23 | ||||
-rw-r--r-- | o3d/tests/selenium/selenium.gyp | 190 | ||||
-rw-r--r-- | o3d/tests/tests.gyp | 43 |
22 files changed, 878 insertions, 365 deletions
diff --git a/o3d/DEPS_gyp b/o3d/DEPS_gyp index c660f01..de4e395 100644 --- a/o3d/DEPS_gyp +++ b/o3d/DEPS_gyp @@ -4,12 +4,13 @@ vars = { "chromium_rev": "22547", "o3d_code_rev": "145", "skia_rev": "279", - "gyp_rev": "601", + "gyp_rev": "626", "gtest_rev": "267", "gflags_rev": "30", "breakpad_rev": "346", "v8_rev": "2624", "icu38_rev": "20192", + "nacl_rev": "569", } deps = { @@ -90,10 +91,8 @@ deps = { "base": Var("chromium_trunk") + "/src/base@" + Var("chromium_rev"), - # NACL has to be in this weird directory because it looks for - # googleclient two levels above it. "native_client": - "http://nativeclient.googlecode.com/svn/trunk/src/native_client@492", + "http://nativeclient.googlecode.com/svn/trunk/src/native_client@" + Var("nacl_rev"), "breakpad/src": "http://google-breakpad.googlecode.com/svn/trunk/src@" + Var("breakpad_rev"), @@ -115,7 +114,6 @@ deps = { "testing/gmock": Var("chromium_trunk") + "/src/testing/gmock@" + Var("chromium_rev"), -# "http://googlemock.googlecode.com/svn/tags/release-1.0.0", # Stuff needed for GYP to run "build": @@ -146,7 +144,7 @@ deps_os = { hooks = [ { # A change to a .gyp, .gypi, or to GYP itself shound run the generator. - "pattern": "\\.gypi?$|[/\\\\]src[/\\\\]tools[/\\\\]gyp[/\\\\]", + "pattern": "\\.gypi?$|[/\\\\]src[/\\\\]tools[/\\\\]gyp[/\\\\]|MANIFEST$", "action": ["python", "tools/gyp/gyp", "o3d/build/all.gyp", "--depth", "."], }, ] diff --git a/o3d/build/all.gyp b/o3d/build/all.gyp index 32f3998..1996704 100644 --- a/o3d/build/all.gyp +++ b/o3d/build/all.gyp @@ -26,12 +26,10 @@ '../import/import.gyp:o3dImport', '../installer/installer.gyp:installer', '../plugin/idl/idl.gyp:o3dPluginIdl', - '../plugin/plugin.gyp:add_version', '../plugin/plugin.gyp:npo3dautoplugin', - '../plugin/plugin.gyp:o3dPluginLogging', '../samples/samples.gyp:*', + '../tests/selenium/selenium.gyp:*', '../serializer/serializer.gyp:o3dSerializer', - '../statsreport/statsreport.gyp:o3dStatsReport', '../tests/tests.gyp:unit_tests', '../utils/utils.gyp:o3dUtils', ], diff --git a/o3d/build/common.gypi b/o3d/build/common.gypi index a011c8e..5dc0538 100644 --- a/o3d/build/common.gypi +++ b/o3d/build/common.gypi @@ -16,10 +16,14 @@ 'nacldir': 'third_party/native_client/googleclient', 'nixysadir': 'third_party/nixysa', 'npapidir': 'third_party/npapi', + 'pdiffdir': 'third_party/pdiff/files', 'pngdir': 'third_party/libpng', + 'screenshotsdir': 'o3d_assets/tests/screenshots', + 'seleniumdir': 'third_party/selenium_rc/files', 'skiadir': 'third_party/skia/include', 'zlibdir': 'third_party/zlib', 'o3d_in_chrome%': 0, + 'selenium_screenshots%': 0, }, 'target_defaults': { 'defines': [ @@ -44,7 +48,6 @@ 'cgdir': 'third_party/cg/files/win', 'swiftshaderdir': 'o3d-internal/third_party/swiftshader/files', 'LIBRARY_SUFFIX': '.lib', - 'CONFIGURATION': '$(ConfigurationName)', }, 'target_defaults': { 'defines': [ @@ -65,7 +68,6 @@ 'renderer': 'gl', 'cgdir': 'third_party/cg/files/mac', 'LIBRARY_SUFFIX': '.a', - 'CONFIGURATION': '$(CONFIGURATION)', }, 'target_defaults': { 'defines': [ @@ -103,12 +105,21 @@ 'renderer': 'gl', 'cgdir': 'third_party/cg/files/linux', 'LIBRARY_SUFFIX': '.a', - 'CONFIGURATION': '$(CONFIGURATION)', }, 'target_defaults': { 'defines': [ - 'RENDERER_GL', + 'LINUX', + 'MOZ_X11', + 'NACL_LINUX=1', 'OS_LINUX', + 'RENDERER_GL', + 'SK_BUILD_FOR_UNIX', + 'UNICODE', + 'XP_UNIX', + ], + 'cflags': [ + '-fvisibility=hidden', + '-Wstrict-aliasing', ], }, }, diff --git a/o3d/build/libs.gyp b/o3d/build/libs.gyp index 88dba6b..0244c48 100644 --- a/o3d/build/libs.gyp +++ b/o3d/build/libs.gyp @@ -13,15 +13,99 @@ ], 'targets': [ { + 'target_name': 'gl_libs', + 'type': 'none', + 'direct_dependent_settings': { + 'include_dirs': [ + '../../<(glewdir)/include', + ], + }, + 'conditions': [ + [ 'OS=="linux"', + { + 'direct_dependent_settings': { + 'defines': [ + 'GL_GLEXT_PROTOTYPES', + ], + 'scons_variable_settings': { + 'LIBPATH': [ + '../../<(glewdir)/lib', + ], + }, + 'libraries': [ + "-lGL", + "-lGLEW", + ], + }, + }, + ], + [ 'OS=="mac"', + { + 'direct_dependent_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework', + ], + }, + }, + ], + ], + }, + { 'target_name': 'cg_libs', 'type': 'none', + 'direct_dependent_settings': { + 'include_dirs': [ + '../../<(cgdir)/include', + ], + }, + 'conditions': [ + [ 'OS=="linux"', + { + 'direct_dependent_settings': { + 'scons_variable_settings': { + 'LIBPATH': [ + '<(PRODUCT_DIR)', + ], + }, + 'libraries': [ + "-lCg", + "-lCgGL", + ], + }, + }, + ], + [ 'OS=="win"', + { + 'direct_dependent_settings': { + 'libraries': [ + "../../<(cgdir)/lib/cg.lib", + "../../<(cgdir)/lib/cgD3D9.lib", + "../../<(cgdir)/lib/cgGL.lib", + "../../<(cgdir)/lib/glut32.lib", + ], + }, + }, + ], + [ 'OS=="mac"', + { + 'direct_dependent_settings': { + 'libraries': [ + "<(PRODUCT_DIR)/Cg.framework", + ], + }, + } + ], + ], 'copies': [ { 'destination': '<(PRODUCT_DIR)', 'conditions' : [ - [ 'OS=="mac"', + [ 'OS=="linux"', { 'files': [ + "../../<(cgdir)/lib/libCg.so", + "../../<(cgdir)/lib/libCgGL.so", + "../../<(cgdir)/bin/cgc", ], }, ], @@ -49,25 +133,38 @@ }, ], 'conditions': [ - ['OS=="win"', { - 'targets': [ - { - 'target_name': 'dx_dll', - 'type': 'none', - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)', - 'conditions' : [ - ['"<(dx_redist_exists)" == "True"', { - 'files': ['<(dx_redist_path)/d3dx9_36.dll'], - },{ - 'files': ['$(windir)/system32/d3dx9_36.dll'], - }], + ['OS=="win"', + { + 'targets': [ + { + 'target_name': 'dx_dll', + 'type': 'none', + 'direct_dependent_settings': { + 'include_dirs': [ + '$(DXSDK_DIR)/Include', + ], + 'libraries': [ + '"$(DXSDK_DIR)/Lib/x86/d3dx9.lib"', ], }, - ], - }, - ], - }], + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)', + 'conditions' : [ + ['"<(dx_redist_exists)" == "True"', + { + 'files': ['<(dx_redist_path)/d3dx9_36.dll'], + }, + { + 'files': ['$(windir)/system32/d3dx9_36.dll'], + } + ], + ], + }, + ], + }, + ], + } + ], ], } diff --git a/o3d/build/nacl.gyp b/o3d/build/nacl.gyp index 19b4de5..e69de29 100644 --- a/o3d/build/nacl.gyp +++ b/o3d/build/nacl.gyp @@ -1,52 +0,0 @@ -# Copyright (c) 2009 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. - -{ - 'variables': { - 'chromium_code': 1, - }, - 'includes': [ - 'common.gypi', - ], - 'targets': [ - { - 'target_name': 'build_nacl', - 'type': 'none', - 'variables': { - 'nacl_output_dir': '<(SHARED_INTERMEDIATE_DIR)/nacl_libs', - }, - 'actions': [ - { - 'action_name': 'build_nacl', - 'inputs' : [ - 'build_nacl.py', - ], - 'outputs': [ - '<(nacl_output_dir)/google_nacl_imc<(LIBRARY_SUFFIX)', - '<(nacl_output_dir)/google_nacl_imc_c<(LIBRARY_SUFFIX)', - 'dummy_file_that_never_gets_built_so_scons_always_runs', - ], - 'action': [ - 'python', - '<@(_inputs)', - '--output="<(nacl_output_dir)"', - '--configuration="<(CONFIGURATION)"', - '--platform=<(OS)', - 'google_nacl_imc', - 'google_nacl_imc_c', - ], - }, - ], - 'direct_dependent_settings': { - 'include_dirs': [ - '../../<(nacldir)', - ], - 'libraries': [ - '<(nacl_output_dir)/google_nacl_imc<(LIBRARY_SUFFIX)', - '<(nacl_output_dir)/google_nacl_imc_c<(LIBRARY_SUFFIX)', - ], - }, - }, - ], -} diff --git a/o3d/compiler/technique/technique.gyp b/o3d/compiler/technique/technique.gyp index a750038..3c409073 100644 --- a/o3d/compiler/technique/technique.gyp +++ b/o3d/compiler/technique/technique.gyp @@ -66,8 +66,19 @@ }, }, 'xcode_settings': { - 'OTHER_CFLAGS': ['-x', 'c++'], + 'OTHER_CFLAGS': [ + '-x', 'c++', + ], }, + 'conditions': [ + ['OS == "linux"', + { + 'cflags': [ + '-x', 'c++', + ], + } + ], + ], }, { 'target_name': 'o3dTechniqueTest', diff --git a/o3d/converter/converter.gyp b/o3d/converter/converter.gyp index 0e15f54..fea5c1a 100644 --- a/o3d/converter/converter.gyp +++ b/o3d/converter/converter.gyp @@ -35,7 +35,6 @@ '../import/import.gyp:o3dImport', '../serializer/serializer.gyp:o3dSerializer', '../utils/utils.gyp:o3dUtils', - '../build/libs.gyp:cg_libs', ], 'sources': [ 'cross/buffer_stub.cc', @@ -56,6 +55,13 @@ 'cross/texture_stub.h', ], 'conditions' : [ + ['renderer == "gl"', + { + 'dependencies': [ + '../build/libs.gyp:cg_libs', + ], + }, + ], ['OS == "mac"', { 'postbuilds': [ @@ -83,19 +89,28 @@ }, }, ], + ['OS == "linux"', + { + 'link_settings': { + 'libraries': [ + '-lGL', + ], + }, + }, + ], ['OS == "win"', { 'dependencies': [ '../build/libs.gyp:dx_dll', + '../build/libs.gyp:cg_libs', ], + 'link_settings': { + 'libraries': [ + '-lrpcrt4.lib', + ], + }, 'msvs_settings': { 'VCLinkerTool': { - 'AdditionalDependencies': [ - 'rpcrt4.lib', - '"$(DXSDK_DIR)/Lib/x86/d3dx9.lib"', - '../../<(cgdir)/lib/cg.lib', - '../../<(cgdir)/lib/cgGL.lib', - ], # Set /SUBSYSTEM:CONSOLE for converter.exe, since # it is a console app. 'SubSystem': '1', diff --git a/o3d/core/core.gyp b/o3d/core/core.gyp index 63952282..b38c8e7 100644 --- a/o3d/core/core.gyp +++ b/o3d/core/core.gyp @@ -24,13 +24,21 @@ ], } ], + ['OS == "linux"', + { + 'cflags': [ + '-include', + 'core/cross/precompile.h', + ], + }, + ], ['renderer == "gl"', { 'include_dirs': [ '../../<(glewdir)/include', '../../<(cgdir)/include', ], - } + }, ], ], }, @@ -240,7 +248,6 @@ 'direct_dependent_settings': { 'include_dirs': [ '..', - 'cross', ], }, 'conditions': [ @@ -255,7 +262,15 @@ 'win', ], }, - } + }, + ], + ['renderer == "gl"', + { + 'dependencies': [ + '../build/libs.gyp:cg_libs', + '../build/libs.gyp:gl_libs', + ], + }, ], ['OS == "linux"', { @@ -268,7 +283,7 @@ 'linux', ], }, - } + }, ], ['OS == "mac"', { @@ -281,10 +296,10 @@ 'mac', ], }, - 'xcode_settings': { - 'GCC_PREFIX_HEADER': 'cross/precompile.h', - }, - }, + 'xcode_settings': { + 'GCC_PREFIX_HEADER': 'cross/precompile.h', + }, + }, ], ], }, @@ -299,10 +314,10 @@ 'conditions': [ ['OS == "mac"', { - 'xcode_settings': { - 'GCC_PREFIX_HEADER': 'cross/precompile.h', - }, - }, + 'xcode_settings': { + 'GCC_PREFIX_HEADER': 'cross/precompile.h', + }, + }, ], ['renderer == "gl"', { @@ -332,7 +347,7 @@ 'cross/gl/utils_gl.cc', 'cross/gl/utils_gl.h', ], - } + }, ], ['renderer == "d3d9" and OS == "win"', { @@ -362,7 +377,7 @@ 'win/d3d9/utils_d3d9.cc', 'win/d3d9/utils_d3d9.h', ], - } + }, ], ], }, diff --git a/o3d/core/cross/canvas_paint.cc b/o3d/core/cross/canvas_paint.cc index 446c5c1f..fc7e55e 100644 --- a/o3d/core/cross/canvas_paint.cc +++ b/o3d/core/cross/canvas_paint.cc @@ -157,6 +157,7 @@ StrokeDrawLooper::StrokeDrawLooper(SkFlattenableReadBuffer& buffer) { O3D_DEFN_CLASS(CanvasPaint, ParamObject); +#ifndef OS_LINUX static SkPaint::Align ToSKAlign(CanvasPaint::TextAlign align) { switch (align) { case CanvasPaint::LEFT: @@ -169,6 +170,7 @@ static SkPaint::Align ToSKAlign(CanvasPaint::TextAlign align) { return SkPaint::kLeft_Align; } } +#endif // OS_LINUX CanvasPaint::CanvasPaint(ServiceLocator* service_locator) : ParamObject(service_locator), diff --git a/o3d/import/archive.gyp b/o3d/import/archive.gyp index 7465206..6de6cee 100644 --- a/o3d/import/archive.gyp +++ b/o3d/import/archive.gyp @@ -16,6 +16,21 @@ '../../<(cgdir)/include', '../../<(gtestdir)', ], + 'conditions': [ + ['OS=="linux"', + { + 'include_dirs': [ + '/usr/include/cairo', + '/usr/include/glib-2.0', + '/usr/include/gtk-2.0', + '/usr/include/pango-1.0', + '/usr/lib/glib-2.0/include', + '/usr/lib/gtk-2.0/include', + '/usr/include/atk-1.0', + ], + }, + ], + ], }, 'targets': [ { diff --git a/o3d/import/import.gyp b/o3d/import/import.gyp index 01d3dc3..3dc94b3 100644 --- a/o3d/import/import.gyp +++ b/o3d/import/import.gyp @@ -37,8 +37,6 @@ 'cross/collada.h', 'cross/collada_zip_archive.cc', 'cross/collada_zip_archive.h', - 'cross/destination_buffer.cc', - 'cross/destination_buffer.h', 'cross/file_output_stream_processor.cc', 'cross/file_output_stream_processor.h', 'cross/precompile.h', @@ -51,6 +49,13 @@ ], 'conditions' : [ + ['renderer == "gl"', + { + 'dependencies': [ + '../build/libs.gyp:cg_libs', + ], + }, + ], ['renderer == "d3d9" and OS == "win"', { 'include_dirs': [ @@ -87,6 +92,13 @@ ], 'include_dirs': [ '../../third_party/glew/files/include', + '/usr/include/cairo', + '/usr/include/glib-2.0', + '/usr/include/gtk-2.0', + '/usr/include/pango-1.0', + '/usr/lib/glib-2.0/include', + '/usr/lib/gtk-2.0/include', + '/usr/include/atk-1.0', ], }, ], @@ -97,8 +109,11 @@ 'type': 'static_library', 'sources': [ 'cross/camera_info.cc', + 'cross/camera_info.h', 'cross/destination_buffer.cc', + 'cross/destination_buffer.h', 'cross/json_object.cc', + 'cross/json_object.h', ], }, { diff --git a/o3d/plugin/cross/main.cc b/o3d/plugin/cross/main.cc index 1d33da5..d71e103 100644 --- a/o3d/plugin/cross/main.cc +++ b/o3d/plugin/cross/main.cc @@ -169,7 +169,7 @@ NPError EXPORT_SYMBOL OSCALL NP_GetEntryPoints(NPPluginFuncs *pluginFuncs) { return NPERR_NO_ERROR; } -char * EXPORT_SYMBOL NP_GetMIMEDescription(void) { +char* NP_GetMIMEDescription(void) { return const_cast<char*>(O3D_PLUGIN_MIME_TYPE "::O3D MIME"); } diff --git a/o3d/plugin/idl/codegen.py b/o3d/plugin/idl/codegen.py index 22cbec2..76bd40a 100644 --- a/o3d/plugin/idl/codegen.py +++ b/o3d/plugin/idl/codegen.py @@ -19,7 +19,6 @@ import subprocess import sys import os -import os.path script_dir = os.path.join(os.path.dirname(sys.argv[0])) third_party = os.path.normpath( diff --git a/o3d/plugin/idl/idl.gyp b/o3d/plugin/idl/idl.gyp index 4194115..b381e85 100644 --- a/o3d/plugin/idl/idl.gyp +++ b/o3d/plugin/idl/idl.gyp @@ -8,7 +8,7 @@ ], 'variables': { 'chromium_code': 0, - 'idl_out_dir': '<(SHARED_INTERMEDIATE_DIR)/idl_glue', + 'idl_out_path': '<(SHARED_INTERMEDIATE_DIR)/idl_glue', 'static_glue_dir': '../../../third_party/nixysa/static_glue/npapi', 'idl_files': [ 'archive_request.idl', @@ -71,85 +71,101 @@ 'viewport.idl', ], }, + 'target_defaults': { + 'include_dirs': [ + '../..', + '../../..', + '../../../<(npapidir)/include', + '../../../<(zlibdir)', + '../../../skia/config', + '../../plugin/cross', + '<(static_glue_dir)', + '<(idl_out_path)', + ], + 'conditions': [ + ['OS=="win"', + { + 'defines': [ + 'OS_WINDOWS', + ], + }, + ], + ['OS=="mac"', + { + 'include_dirs': [ + '../mac', + ], + 'defines': [ + 'XP_MACOSX', + ], + }, + ], + ['OS=="linux"', + { + 'include_dirs': [ + '/usr/include/cairo', + '/usr/include/glib-2.0', + '/usr/include/gtk-2.0', + '/usr/include/pango-1.0', + '/usr/lib/glib-2.0/include', + '/usr/lib/gtk-2.0/include', + '/usr/include/atk-1.0', + ], + }, + ], + ], + }, 'targets': [ { 'target_name': 'o3dPluginIdl', 'type': 'static_library', - 'rules': [ + 'dependencies': [ + '../../../<(zlibdir)/zlib.gyp:zlib', + '../../../base/base.gyp:base', + '../../../skia/skia.gyp:skia', + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '../../../<(npapidir)/include', + '<(idl_out_path)', + '<(static_glue_dir)', + ], + }, + 'actions': [ { - 'rule_name': 'generate_idl', - 'extension': 'idl', + 'action_name': 'generate_idl', 'process_outputs_as_sources': 1, 'inputs': [ '../../../<(nixysadir)/codegen.py', 'codegen.py', + '<@(idl_files)', ], 'outputs': [ - '<(idl_out_dir)/<(RULE_INPUT_ROOT)_glue.cc', - '<(idl_out_dir)/<(RULE_INPUT_ROOT)_glue.h', + '<(idl_out_path)/hash', + '<(idl_out_path)/globals_glue.cc', + '<(idl_out_path)/globals_glue.h', + '<!@(python idl_filenames.py \'<(idl_out_path)\' <@(idl_files))', ], 'action': [ 'python', 'codegen.py', + '--force', # If the build system wants to rebuild, we rebuild. '--binding-module=o3d:../../plugin/o3d_binding.py', '--generate=npapi', - '--output-dir=<(idl_out_dir)', + '--output-dir=<(idl_out_path)', '<@(idl_files)', ], - 'message': 'Generating IDL glue for <(RULE_INPUT_PATH)', + 'message': 'Generating IDL glue code.', }, ], - 'include_dirs': [ - '../..', - '../../..', - '../../../<(npapidir)/include', - '../../plugin/cross', - '<(static_glue_dir)', - '<(idl_out_dir)', - ], - 'dependencies': [ - '../../../<(zlibdir)/zlib.gyp:zlib', - '../../../base/base.gyp:base', - '../../../skia/skia.gyp:skia', - ], 'sources': [ '../cross/archive_request_static_glue.cc', '../cross/archive_request_static_glue.h', '../cross/o3d_glue.cc', '../cross/o3d_glue.h', - '<(idl_out_dir)/globals_glue.cc', - '<(idl_out_dir)/globals_glue.h', '<(static_glue_dir)/common.cc', '<(static_glue_dir)/npn_api.cc', '<(static_glue_dir)/static_object.cc', - '<@(idl_files)', - ], - 'hard_dependency': 1, - 'direct_dependent_settings': { - 'include_dirs': [ - '../../../<(npapidir)/include', - '<(idl_out_dir)', - '<(static_glue_dir)', - ], - }, - 'conditions': [ - ['OS=="win"', - { - 'defines': [ - 'OS_WINDOWS', - ], - }, - ], - ['OS=="mac"', - { - 'include_dirs': [ - '../mac', - ], - 'defines': [ - 'XP_MACOSX', - ], - }, - ], ], }, ], diff --git a/o3d/plugin/idl/idl_filenames.py b/o3d/plugin/idl/idl_filenames.py new file mode 100644 index 0000000..ceb1575 --- /dev/null +++ b/o3d/plugin/idl/idl_filenames.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +# This script takes a list of inputs and generates a list of outputs +# that Nixysa will generate. It passes through any files not ending +# in .idl, and converts idl files into corresponding .cc and .h files. + +# The first argument is the destintation directory for the output +# files, and the rest are relative paths to the source files. The +# output is posix paths, because that's what GYP expects. + +import sys +import posixpath + +output_dir = sys.argv[1] + +for file in sys.argv[2:]: + (base, suffix) = posixpath.splitext(file) + if suffix == ".idl": + print posixpath.normpath(posixpath.join(output_dir, "%s_glue.h" % base)) + print posixpath.normpath(posixpath.join(output_dir, "%s_glue.cc" % base)) + else: + print posixpath.normpath(posixpath.join(output_dir, file)) + +sys.exit(0) diff --git a/o3d/plugin/linux/main_linux.cc b/o3d/plugin/linux/main_linux.cc index 5fe7439..fbb6495 100644 --- a/o3d/plugin/linux/main_linux.cc +++ b/o3d/plugin/linux/main_linux.cc @@ -94,7 +94,6 @@ void LinuxExposeHandler(Widget w, Boolean *cont) { PluginObject *obj = static_cast<PluginObject *>(user_data); if (event->type != Expose) return; - XExposeEvent *expose_event = &event->xexpose; DrawPlugin(obj); } @@ -468,6 +467,7 @@ static gboolean GtkHandleMouseButton(GtkWidget *widget, event.set_type(Event::TYPE_DBLCLICK); obj->client()->AddEventToQueue(event); } + return TRUE; } static gboolean GtkHandleKey(GtkWidget *widget, diff --git a/o3d/plugin/plugin.gyp b/o3d/plugin/plugin.gyp index 9331ce3..53c24a2 100644 --- a/o3d/plugin/plugin.gyp +++ b/o3d/plugin/plugin.gyp @@ -73,6 +73,13 @@ ], }, ], + ['renderer == "gl"', + { + 'dependencies': [ + '../build/libs.gyp:cg_libs', + ], + }, + ], ['OS == "mac"', { 'mac_bundle': 1, @@ -82,7 +89,7 @@ '../../breakpad/breakpad.gyp:breakpad', ], 'xcode_settings': { - 'INFOPLIST_FILE': '<(SHARED_INTERMEDIATE_DIR)/plugin/Info.plist', + 'INFOPLIST_FILE': '<(SHARED_INTERMEDIATE_DIR)/plugin/Info.plist', }, 'mac_bundle_resources': [ 'mac/Resources/English.lproj', @@ -144,18 +151,42 @@ { 'postbuild_name': 'Process Resource File', 'action': ['python', - 'version_info.py', - 'mac/o3d_plugin.r', - '${BUILT_PRODUCTS_DIR}/O3D.r', - ], + 'version_info.py', + 'mac/o3d_plugin.r', + '${BUILT_PRODUCTS_DIR}/O3D.r', + ], }, { 'postbuild_name': 'Compile Resource File', 'action': ['/usr/bin/Rez', - '-o', - '${BUILT_PRODUCTS_DIR}/O3D.plugin/Contents/Resources/O3D.rsrc', - '${BUILT_PRODUCTS_DIR}/O3D.r', - ], + '-o', + '${BUILT_PRODUCTS_DIR}/O3D.plugin/Contents/Resources/O3D.rsrc', + '${BUILT_PRODUCTS_DIR}/O3D.r', + ], + }, + ], + }, + ], + ['OS == "linux"', + { + 'sources': [ + 'linux/main_linux.cc', + 'linux/config.cc', + ], + 'link_settings': { + 'libraries': [ + '-lGL', + ], + }, + # On Linux, shared library targets aren't copied to the + # product dir automatically. Filed GYP issue #74 to address this. + # TODO(gspencer): Remove when issue #74 is resolved. + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)', + 'files': [ + '<(PRODUCT_DIR)/obj/o3d/plugin/<(LIBRARY_PREFIX)<(_target_name)<(SHARED_LIB_SUFFIX)', + ], }, ], }, @@ -330,11 +361,11 @@ 'msvs_settings': { 'VCLinkerTool': { 'ModuleDefinitionFile': - 'npapi_host_control/win/npapi_host_control.def' + 'npapi_host_control/win/npapi_host_control.def' }, 'VCCLCompilerTool': { 'ForcedIncludeFiles': - 'plugin/npapi_host_control/win/precompile.h', + 'plugin/npapi_host_control/win/precompile.h', 'CompileAs': '2', # Build all the files as C++, since # ATL requires that. }, @@ -343,6 +374,29 @@ 'UseOfATL': '1', # 1 = static link to ATL, 2 = dynamic link }, }, + { + 'target_name': 'o3d_host_register', + 'type': 'none', + 'dependencies': [ + 'o3d_host', + ], + 'actions': [ + { + 'action_name': 'register_o3d_host', + 'inputs': [ + '<(PRODUCT_DIR)/o3d_host.dll', + ], + 'outputs': [ + 'file_that_never_exists_so_this_action_always_runs', + ], + 'action': [ + 'regsvr32', + '/s', + '<(_inputs)', + ], + }, + ], + }, ], }, ], diff --git a/o3d/samples/samples.gyp b/o3d/samples/samples.gyp index 27d96f1..7bc7999 100644 --- a/o3d/samples/samples.gyp +++ b/o3d/samples/samples.gyp @@ -11,35 +11,66 @@ ], 'targets': [ { - 'target_name': 'split_samples', + 'target_name': 'install_samples', 'type': 'none', - 'rules': [ + 'copies': [ { - 'rule_name': 'split_sample', - 'extension': 'html', - 'inputs': [ - 'split_samples.py', - ], - 'outputs': [ - '<(PRODUCT_DIR)/samples/<(RULE_INPUT_NAME)', - '<(PRODUCT_DIR)/samples/<(RULE_INPUT_ROOT).js', - ], - 'action': ['python', '<@(_inputs)', - '--products', '<(PRODUCT_DIR)/samples', - '--samples', '.', - '<(RULE_INPUT_PATH)', - ], + 'destination': '<(PRODUCT_DIR)/samples', + 'files': [ + '2d.html', + 'animated-scene.html', + 'animation.html', + 'bitmap-draw-image.html', + 'billboards.html', + 'canvas-texturedraw.html', + 'canvas.html', + 'convolution.html', + 'culling.html', + 'customcamera.html', + 'displayfps.html', + 'error-texture.html', + 'generate-texture.html', + 'hellocube-colors.html', + 'hellocube-textures.html', + 'hellocube.html', + 'helloworld.html', + 'hud-2d-overlay.html', + 'instance-override.html', + 'instancing.html', + 'juggler.html', + 'julia.html', + 'multiple-clients.html', + 'multiple-views.html', + 'old-school-shadows.html', + 'particles.html', + 'phongshading.html', + 'picking.html', + 'primitives.html', + 'procedural-texture.html', + 'render-mode.html', + 'render-targets.html', + 'rotatemodel.html', + 'scatter-chart.html', + 'shader-test.html', + 'simple.html', + 'simpletexture.html', + 'skinning.html', + 'sobel.html', + 'stencil_example.html', + 'texturesamplers.html', + 'tutorial-primitive.html', + 'vertex-shader.html', + 'vertex-shader-animation.html', + 'zsorting.html' + ] }, ], - 'sources': [ - '<!@(python split_samples.py --samples . --find_candidates)', - ], }, { 'target_name': 'samples', 'type': 'none', 'dependencies': [ - 'split_samples', + 'install_samples', '<!(python samples_gen.py):build_samples', ], }, diff --git a/o3d/samples/samples_gen.py b/o3d/samples/samples_gen.py index 00fe45c..6add64b 100644 --- a/o3d/samples/samples_gen.py +++ b/o3d/samples/samples_gen.py @@ -1,168 +1,184 @@ -#!/usr/bin/env python
-# Copyright (c) 2009 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 os.path
-import sys
-
-output_filename = 'samples_gen.gyp'
-try:
- output_file = open(output_filename, "w+")
-except IOError:
- sys.stderr.write('Unable to write to generated gyp file %s\n',
- output_filename)
-
-x_up = '1,0,0'
-y_up = '0,1,0'
-z_up = '0,0,1'
-
-names = {
- x_up : 'x_up',
- y_up : 'y_up',
- z_up : 'z_up',
-}
-
-assets = [
- {'path': 'GoogleIO-2009/convert_assets/background.zip', 'up': y_up},
- {'path': 'GoogleIO-2009/convert_assets/character.zip', 'up': y_up},
- {'path': 'beachdemo/convert_assets/beach-low-poly.dae', 'up': z_up},
- {'path': 'beachdemo/convert_assets/beachdemo.zip', 'up': z_up},
- {'path': 'convert_assets/dome1.zip', 'up': y_up},
- {'path': 'convert_assets/dome2.zip', 'up': y_up},
- {'path': 'convert_assets/dome3.zip', 'up': y_up},
- {'path': 'convert_assets/dome4.zip', 'up': y_up},
- {'path': 'convert_assets/kitty_151_idle_stand05_cff1.zip', 'up': y_up},
- {'path': 'convert_assets/part1.zip', 'up': y_up},
- {'path': 'convert_assets/part2.zip', 'up': y_up},
- {'path': 'convert_assets/part3.zip', 'up': y_up},
- {'path': 'convert_assets/seven_shapes.zip', 'up': y_up},
- {'path': 'convert_assets/stencil_frame.zip', 'up': y_up},
- {'path': 'convert_assets/teapot.zip', 'up': y_up},
- {'path': 'convert_assets/yard.zip', 'up': y_up},
- {'path': 'home-configurators/convert_cbassets/Agra_Rug.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Asimi_Rug.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Camden_Chair.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Elements_Bookshelf.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Ferrara_Rug.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/House_Roofless.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Lounge_Chair.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Lounge_Chaise.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Lounge_Sofa.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Lounge_Storage_Ottoman.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Madison_Dining_Table.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Miles_Side_Chair.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Pullman_Bar_Stool.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Puzzle_TV_Stand.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Stow_Leather_Ottoman.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Tivoli_Dining_Table.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Tivoli_Miles_Dining_Set.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Troy_Chair.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Troy_Ottoman.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Troy_Sofa.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Troy_Storage_Ottoman.kmz', 'up': z_up},
- {'path': 'home-configurators/convert_cbassets/Troy_Twin_Sleeper.kmz', 'up': z_up},
- {'path': 'io/convert_levels/all_actors.kmz', 'up': y_up},
- {'path': 'io/convert_levels/map1.kmz', 'up': y_up},
- {'path': 'simpleviewer/convert_assets/cube.zip', 'up': y_up},
- {'path': 'waterdemo/convert_assets/bamboo.zip', 'up': y_up},
- {'path': 'waterdemo/convert_assets/coconuts.zip', 'up': y_up},
- {'path': 'waterdemo/convert_assets/driftwood.zip', 'up': y_up},
- {'path': 'waterdemo/convert_assets/island.zip', 'up': y_up},
- {'path': 'waterdemo/convert_assets/lazy_bridge.zip', 'up': y_up},
- {'path': 'waterdemo/convert_assets/palm_leaves.zip', 'up': y_up},
- {'path': 'waterdemo/convert_assets/palm_trees.zip', 'up': y_up},
- {'path': 'waterdemo/convert_assets/rocks.9.zip', 'up': y_up},
- {'path': 'waterdemo/convert_assets/rocks.zip', 'up': y_up},
-]
-
-output_file.write("""# Copyright (c) 2009 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.
-
-{
- 'variables': {
- 'chromium_code': 1,
- },
- 'includes': [
- '../build/common.gypi',
- ],
- 'targets': [
- {
- 'target_name': 'build_samples',
- 'type': 'none',
- 'dependencies': [
- '../converter/converter.gyp:o3dConverter',
- ],
- 'actions': [\n""")
-for asset in assets:
- filename = os.path.splitext(os.path.basename(asset['path']))[0]
- filename = filename.replace('.','_')
- filename = filename.replace('-','_')
- filename = filename.lower()
- name = "convert_" + filename
- output = asset['path'].replace('convert_', '')
- output = os.path.splitext(output)[0] + ".o3dtgz"
- output_dir = os.path.dirname(output)
- output_file.write(" {\n")
- output_file.write(" 'action_name': '%s',\n" % name)
- output_file.write(" 'inputs': [\n")
- output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path'])
- output_file.write(" ],\n")
- output_file.write(" 'outputs': [\n")
- output_file.write(" '../samples/%s',\n" % output)
- output_file.write(" ],\n")
- output_file.write(" 'action': [\n")
- output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n")
- output_file.write(" '--no-condition',\n")
- output_file.write(" '--up-axis=%s',\n" % asset['up'])
- output_file.write(" '<(_inputs)',\n")
- output_file.write(" '<(_outputs)',\n")
- output_file.write(" ],\n")
- output_file.write(" },\n")
-
-output_file.write(" ],\n")
-
-# Coalesce copies by directory so we don't have tons of copies rules
-# to parse.
-copies = {}
-for asset in assets:
- output = asset['path'].replace('convert_', '')
- output = os.path.splitext(output)[0] + ".o3dtgz"
- output_dir = os.path.dirname(output)
- if output_dir in copies:
- # Make sure we don't add any twice.
- if not output in copies[output_dir]:
- copies[output_dir] += [output]
- else:
- copies[output_dir] = [output]
-
-# Add in all the MANIFEST files to be copied,
-# Skipping the ones in the assets above (if any).
-manifest = open("MANIFEST", "r")
-for item in manifest.read().splitlines():
- item_dir = os.path.dirname(item)
- if item_dir in copies:
- if not item in copies[item_dir]:
- copies[item_dir] += [item]
- else:
- copies[item_dir] = [item]
-
-output_file.write(" 'copies': [\n")
-for (dir, paths) in copies.items():
- output_file.write(" {\n")
- output_file.write(" 'destination': " \
- "'<(PRODUCT_DIR)/samples/%s',\n" % dir)
- output_file.write(" 'files': [\n")
- for path in paths:
- output_file.write(" '../samples/%s',\n" % path)
- output_file.write(" ],\n")
- output_file.write(" },\n")
-
-output_file.write(" ],\n")
-output_file.write(" },\n")
-output_file.write(" ],\n")
-output_file.write("}\n")
-
-print output_filename
-sys.exit(0)
+#!/usr/bin/env python +# Copyright (c) 2009 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 posixpath +import sys + +output_filename = 'samples_gen.gyp' +try: + output_file = open(output_filename, "w+") +except IOError: + sys.stderr.write('Unable to write to generated gyp file %s\n', + output_filename) + +x_up = '1,0,0' +y_up = '0,1,0' +z_up = '0,0,1' + +names = { + x_up : 'x_up', + y_up : 'y_up', + z_up : 'z_up', +} + +assets = [ + {'path': 'GoogleIO-2009/convert_assets/background.zip', 'up': y_up}, + {'path': 'GoogleIO-2009/convert_assets/character.zip', 'up': y_up}, + {'path': 'beachdemo/convert_assets/beach-low-poly.dae', 'up': z_up}, + {'path': 'beachdemo/convert_assets/beachdemo.zip', 'up': z_up}, + {'path': 'convert_assets/dome1.zip', 'up': y_up}, + {'path': 'convert_assets/dome2.zip', 'up': y_up}, + {'path': 'convert_assets/dome3.zip', 'up': y_up}, + {'path': 'convert_assets/dome4.zip', 'up': y_up}, + {'path': 'convert_assets/kitty_151_idle_stand05_cff1.zip', 'up': y_up}, + {'path': 'convert_assets/part1.zip', 'up': y_up}, + {'path': 'convert_assets/part2.zip', 'up': y_up}, + {'path': 'convert_assets/part3.zip', 'up': y_up}, + {'path': 'convert_assets/seven_shapes.zip', 'up': y_up}, + {'path': 'convert_assets/stencil_frame.zip', 'up': y_up}, + {'path': 'convert_assets/teapot.zip', 'up': y_up}, + {'path': 'convert_assets/yard.zip', 'up': y_up}, + {'path': 'home-configurators/convert_cbassets/Agra_Rug.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Asimi_Rug.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Camden_Chair.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Elements_Bookshelf.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Ferrara_Rug.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/House_Roofless.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Lounge_Chair.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Lounge_Chaise.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Lounge_Sofa.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Lounge_Storage_Ottoman.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Madison_Dining_Table.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Miles_Side_Chair.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Pullman_Bar_Stool.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Puzzle_TV_Stand.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Stow_Leather_Ottoman.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Tivoli_Dining_Table.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Tivoli_Miles_Dining_Set.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Troy_Chair.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Troy_Ottoman.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Troy_Sofa.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Troy_Storage_Ottoman.kmz', 'up': z_up}, + {'path': 'home-configurators/convert_cbassets/Troy_Twin_Sleeper.kmz', 'up': z_up}, + {'path': 'io/convert_levels/all_actors.kmz', 'up': y_up}, + {'path': 'io/convert_levels/map1.kmz', 'up': y_up}, + {'path': 'simpleviewer/convert_assets/cube.zip', 'up': y_up}, + {'path': 'waterdemo/convert_assets/bamboo.zip', 'up': y_up}, + {'path': 'waterdemo/convert_assets/coconuts.zip', 'up': y_up}, + {'path': 'waterdemo/convert_assets/driftwood.zip', 'up': y_up}, + {'path': 'waterdemo/convert_assets/island.zip', 'up': y_up}, + {'path': 'waterdemo/convert_assets/lazy_bridge.zip', 'up': y_up}, + {'path': 'waterdemo/convert_assets/palm_leaves.zip', 'up': y_up}, + {'path': 'waterdemo/convert_assets/palm_trees.zip', 'up': y_up}, + {'path': 'waterdemo/convert_assets/rocks.9.zip', 'up': y_up}, + {'path': 'waterdemo/convert_assets/rocks.zip', 'up': y_up}, +] + +output_file.write("""# Copyright (c) 2009 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. + +{ + 'variables': { + 'chromium_code': 1, + }, + 'includes': [ + '../build/common.gypi', + ], + 'targets': [ + { + 'target_name': 'build_samples', + 'type': 'none', + 'dependencies': [ + '../converter/converter.gyp:o3dConverter', + ], + 'actions': [\n""") +for asset in assets: + filename = posixpath.splitext(posixpath.basename(asset['path']))[0] + filename = filename.replace('.','_') + filename = filename.replace('-','_') + filename = filename.lower() + name = "convert_" + filename + output = asset['path'].replace('convert_', '') + output = posixpath.splitext(output)[0] + ".o3dtgz" + output_dir = posixpath.dirname(output) + output_file.write(" {\n") + output_file.write(" 'action_name': '%s',\n" % name) + output_file.write(" 'inputs': [\n") + output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) + output_file.write(" ],\n") + output_file.write(" 'outputs': [\n") + if sys.platform[:5] == 'linux': + # TODO(gspencer): This is a HACK! We shouldn't need to put the + # absolute path here, but currently on Linux (scons), it is unable + # to copy generated items out of the source tree (because the + # repository mojo fails to find it and puts in the wrong path). + output_file.write(" '%s',\n" % posixpath.abspath(output)) + else: + output_file.write(" '../samples/%s',\n" % output) + output_file.write(" ],\n") + output_file.write(" 'action': [\n") + if sys.platform[:5] == 'linux': + output_file.write(" 'LD_LIBRARY_PATH=<(PRODUCT_DIR):<(PRODUCT_DIR)/lib',\n") + output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") + output_file.write(" '--no-condition',\n") + output_file.write(" '--up-axis=%s',\n" % asset['up']) + output_file.write(" '<(_inputs)',\n") + output_file.write(" '<(_outputs)',\n") + output_file.write(" ],\n") + output_file.write(" },\n") + +output_file.write(" ],\n") + +# Coalesce copies by directory so we don't have tons of copies rules +# to parse. +copies = {} +for asset in assets: + output = asset['path'].replace('convert_', '') + output = posixpath.splitext(output)[0] + ".o3dtgz" + output_dir = posixpath.dirname(output) + if output_dir in copies: + # Make sure we don't add any twice. + if not output in copies[output_dir]: + copies[output_dir] += [output] + else: + copies[output_dir] = [output] + +# Add in all the MANIFEST files to be copied, +# Skipping the ones in the assets above (if any). +manifest = open("MANIFEST", "r") +for item in manifest.read().splitlines(): + item_dir = posixpath.dirname(item) + if item_dir in copies: + if not item in copies[item_dir]: + copies[item_dir] += [item] + else: + copies[item_dir] = [item] + +output_file.write(" 'copies': [\n") +for (dir, paths) in copies.items(): + output_file.write(" {\n") + output_file.write(" 'destination': " \ + "'<(PRODUCT_DIR)/samples/%s',\n" % dir) + output_file.write(" 'files': [\n") + for path in paths: + if sys.platform[:5] == 'linux': + # TODO(gspencer): This is a HACK! We shouldn't need to put the + # absolute path here, but currently on Linux (scons), it is unable + # to copy generated items out of the source tree (because the + # repository mojo fails to find it and puts in the wrong path). + output_file.write(" '%s',\n" % posixpath.abspath(path)) + else: + output_file.write(" '../samples/%s',\n" % path) + output_file.write(" ],\n") + output_file.write(" },\n") + +output_file.write(" ],\n") +output_file.write(" },\n") +output_file.write(" ],\n") +output_file.write("}\n") + +print output_filename +sys.exit(0) diff --git a/o3d/tests/selenium/main.py b/o3d/tests/selenium/main.py index b421659..bf4e9a8 100644 --- a/o3d/tests/selenium/main.py +++ b/o3d/tests/selenium/main.py @@ -992,6 +992,21 @@ def main(unused_argv): # Return error code 1. return 1 +def GetChromePath(): + value = None + if sys.platform == "win32" or sys.platform == "cygwin": + import _winreg + try: + key = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, + "Applications\\chrome.exe\\shell\\open\\command") + (value, type) = _winreg.QueryValueEx(key, None) + _winreg.CloseKey(key) + except WindowsError: + raise Exception("Unable to determine location for Chrome -- " + "it is installed?") + value = os.path.dirname(value) + return value + if __name__ == "__main__": remaining_argv = FLAGS(sys.argv) @@ -999,6 +1014,14 @@ if __name__ == "__main__": os.environ["MOZ_CRASHREPORTER_DISABLE"] = "1" os.environ["MOZ_PLUGIN_PATH"] = os.path.normpath(FLAGS.product_dir) + # Setup the path for chrome. + chrome_path = GetChromePath() + if chrome_path: + if os.environ.get("PATH"): + os.environ["PATH"] = os.pathsep.join([os.environ["PATH"], chrome_path]) + else: + os.environ["PATH"] = chrome_path + # Setup the LD_LIBRARY_PATH on Linux. if sys.platform[:5] == "linux": if os.environ.get("LD_LIBRARY_PATH"): diff --git a/o3d/tests/selenium/selenium.gyp b/o3d/tests/selenium/selenium.gyp new file mode 100644 index 0000000..b9aa09f --- /dev/null +++ b/o3d/tests/selenium/selenium.gyp @@ -0,0 +1,190 @@ +# Copyright (c) 2009 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. + +{ + 'variables': { + 'chromium_code': 1, + 'selenium_args': [ + '--referencedir=<(screenshotsdir)', + '--product_dir=<(PRODUCT_DIR)', + '--screencompare=<(PRODUCT_DIR)/perceptualdiff<(EXECUTABLE_SUFFIX)', + ], + }, + 'includes': [ + '../../build/common.gypi', + ], + 'targets': [ + { + 'target_name': 'install_selenium_tests', + 'type': 'none', + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/tests/selenium/tests', + 'files': [ + 'tests/base-test.html', + 'tests/culling-zsort-test.html', + 'tests/drawshapes.html', + 'tests/effect-import-test.html', + 'tests/event-test.html', + 'tests/features-test.html', + 'tests/init-status-test.html', + 'tests/math-test.html', + 'tests/no-rendergraph.html', + 'tests/non-cachable-params.html', + 'tests/offscreen-test.html', + 'tests/ownership-test.html', + 'tests/param-array-test.html', + 'tests/pixel-perfection.html', + 'tests/quaternion-test.html', + 'tests/render-test.html', + 'tests/serialization-test.html', + 'tests/test-test.html', + 'tests/texture-set-test.html', + 'tests/type-test.html', + 'tests/util-test.html', + 'tests/v8-test.html', + 'tests/version-check-test.html', + 'tests/window-overlap-test.html', + 'tests/window-overlap-top.html', + ], + }, + { + 'destination': '<(PRODUCT_DIR)/tests/selenium/tests/assets', + 'files': [ + 'tests/assets/archive.o3dtgz', + ], + }, + ] + }, + { + 'target_name': 'selenium_firefox', + 'type': 'none', + 'dependencies': [ + 'install_selenium_tests', + '../tests.gyp:unit_tests', + '../../plugin/plugin.gyp:npo3dautoplugin', + ], + 'scons_propagate_variables': [ + 'HOME', + 'DISPLAY', + 'XAUTHORITY', + ], + 'run_as': { + 'working_directory': '<(DEPTH)', + 'action': [ + 'python<(EXECUTABLE_SUFFIX)', + 'o3d/tests/selenium/main.py', + '<@(selenium_args)', + '--browser=*firefox', + '--screenshotsdir=<(PRODUCT_DIR)/tests/selenium/screenshots_firefox', + ], + }, + }, + { + 'target_name': 'selenium_chrome', + 'type': 'none', + 'dependencies': [ + 'install_selenium_tests', + '../tests.gyp:unit_tests', + '../../plugin/plugin.gyp:npo3dautoplugin', + ], + 'scons_propagate_variables': [ + 'HOME', + 'DISPLAY', + 'XAUTHORITY', + ], + 'run_as': { + 'action': [ + 'python<(EXECUTABLE_SUFFIX)', + 'main.py', + '<@(selenium_args)', + '--browser=*googlechrome', + '--screenshotsdir=<(PRODUCT_DIR)/tests/selenium/screenshots_chrome', + ], + }, + 'conditions': [ + ['OS=="linux"', + { + 'variables': { + 'selenium_args': [ + '--browserpath=/usr/bin/google-chrome', + ], + }, + }, + ], + ['OS=="mac"', + { + 'variables': { + 'selenium_args': [ + '--browserpath="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"', + ], + }, + }, + ], + ], + }, + ], + 'conditions': [ + ['<(selenium_screenshots) == 1', + { + 'variables': { + 'selenium_args': [ + '--screenshots', + ], + }, + }, + ], + ['OS=="mac"', + { + 'targets': [ + { + 'target_name': 'selenium_safari', + 'type': 'none', + 'dependencies': [ + 'install_selenium_tests', + '../tests.gyp:unit_tests', + '../../plugin/plugin.gyp:npo3dautoplugin', + ], + 'run_as': { + 'action': [ + 'python<(EXECUTABLE_SUFFIX)', + 'main.py', + '<@(selenium_args)', + '--browser=*safari', + '--screenshotsdir=<(PRODUCT_DIR)/tests/selenium/screenshots_safari', + ], + }, + }, + ], + }, + ], + ['OS=="win"', + { + 'targets': [ + { + 'target_name': 'selenium_ie', + 'type': 'none', + 'dependencies': [ + 'install_selenium_tests', + '../tests.gyp:unit_tests', + '../../plugin/plugin.gyp:npo3dautoplugin', + '../../plugin/plugin.gyp:o3d_host', + '../../plugin/plugin.gyp:o3d_host_register', + ], + 'run_as': { + 'action': [ + 'python<(EXECUTABLE_SUFFIX)', + 'main.py', + '<@(selenium_args)', + '--servertimeout=80', + '--browser=*iexplore', + '--screenshotsdir=<(PRODUCT_DIR)/tests/selenium/screenshots_ie', + ], + }, + }, + ], + }, + ], + ], +} diff --git a/o3d/tests/tests.gyp b/o3d/tests/tests.gyp index 802f636..a8c6766 100644 --- a/o3d/tests/tests.gyp +++ b/o3d/tests/tests.gyp @@ -38,7 +38,6 @@ '../import/archive.gyp:o3dArchiveTest', '../import/import.gyp:o3dImportTest', '../serializer/serializer.gyp:o3dSerializerTest', - '../statsreport/statsreport.gyp:o3dStatsReportTest', '../utils/utils.gyp:o3dUtils', '../utils/utils.gyp:o3dUtilsTest', ], @@ -83,11 +82,30 @@ }, ], 'conditions' : [ + ['renderer == "gl"', + { + 'dependencies': [ + '../build/libs.gyp:cg_libs', + '../build/libs.gyp:gl_libs', + ], + }, + ], ['OS == "mac"', { + 'dependencies': [ + '../statsreport/statsreport.gyp:o3dStatsReportTest', + ], 'sources': [ 'common/mac/testing_common.mm', ], + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)', + 'files': [ + '../../<(pdiffdir)/bin/mac/perceptualdiff', + ], + }, + ], 'include_dirs': [ '../../third_party/glew/files/include', ], @@ -105,10 +123,22 @@ ], ['OS == "win"', { + 'dependencies': [ + '../statsreport/statsreport.gyp:o3dStatsReportTest', + ], 'sources': [ 'common/win/testing_common.cc', 'common/win/testing_common.h', ], + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)', + 'files': [ + '../../<(pdiffdir)/bin/win/perceptualdiff.exe', + '../../<(pdiffdir)/bin/win/FreeImage.dll', + ], + }, + ], 'msvs_settings': { 'VCLinkerTool': { 'AdditionalDependencies': [ @@ -138,7 +168,7 @@ 'common/win/dxcapture.cc', ], 'include_dirs': [ - '$(DXSDK_DIR)/Include', + '"$(DXSDK_DIR)/Include"', ], 'msvs_settings': { 'VCLinkerTool': { @@ -156,8 +186,13 @@ 'sources': [ 'common/linux/testing_common.cc', ], - 'include_dirs': [ - '../../third_party/glew/files/include', + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)', + 'files': [ + '../../<(pdiffdir)/bin/linux/perceptualdiff', + ], + }, ], }, ], |