summaryrefslogtreecommitdiffstats
path: root/o3d/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'o3d/plugin')
-rw-r--r--o3d/plugin/cross/main.cc2
-rw-r--r--o3d/plugin/idl/codegen.py1
-rw-r--r--o3d/plugin/idl/idl.gyp118
-rw-r--r--o3d/plugin/idl/idl_filenames.py24
-rw-r--r--o3d/plugin/linux/main_linux.cc2
-rw-r--r--o3d/plugin/plugin.gyp76
6 files changed, 158 insertions, 65 deletions
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)',
+ ],
+ },
+ ],
+ },
],
},
],