diff options
Diffstat (limited to 'o3d/plugin/idl')
-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 |
3 files changed, 91 insertions, 52 deletions
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) |