SkMojo: generate on Darwin/x86_64

also clean up generate and skmojo.gyp to work right.

BUG=skia:4891
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1660043004

Review URL: https://codereview.chromium.org/1660043004
This commit is contained in:
halcanary 2016-02-03 13:54:03 -08:00 committed by Commit bot
parent e62cbdffcf
commit 72002f28d5
2 changed files with 66 additions and 24 deletions

View File

@ -7,9 +7,11 @@
import hashlib
import os
import subprocess
import urllib2
import platform
import stat
import subprocess
import sys
import urllib2
THIS_DIR = os.path.abspath(os.path.dirname(__file__))
MOJO_DIR = os.path.abspath(os.path.join(THIS_DIR, '../../third_party/externals/mojo'))
@ -35,9 +37,16 @@ def GetFile(filename, bucket_directory):
assert sha1hash(filename) == sha
def GenerateBindings(path, cdir=None):
GetFile(os.path.join(MOJO_DIR,
'public/tools/bindings/mojom_parser/bin/linux64/mojom_parser'),
'mojo/mojom_parser/linux64')
system = (platform.machine(), platform.system())
if ('x86_64', 'Darwin') == system:
parser = 'public/tools/bindings/mojom_parser/bin/mac64/mojom_parser'
bucket_directory = 'mojo/mojom_parser/mac64'
elif ('x86_64', 'Linux') == system:
parser = 'public/tools/bindings/mojom_parser/bin/linux64/mojom_parser'
bucket_directory = 'mojo/mojom_parser/linux64'
else:
assert False
GetFile(os.path.join(MOJO_DIR, parser), bucket_directory)
assert os.path.isfile(path)
path = os.path.abspath(path)
exe = os.path.join(
@ -51,6 +60,8 @@ def GenerateBindings(path, cdir=None):
subprocess.check_call([exe, os.path.relpath(path, cdir)])
os.chdir(cwd)
if __name__ == '__main__':
if 1 == len(sys.argv):
for f in [
'public/interfaces/bindings/interface_control_messages.mojom',
'public/interfaces/application/service_provider.mojom',
@ -58,5 +69,6 @@ for f in [
'public/interfaces/application/application.mojom',
]:
GenerateBindings(os.path.join(MOJO_DIR, f), os.path.join(MOJO_DIR, os.pardir))
GenerateBindings(os.path.join(THIS_DIR, 'SkMojo.mojom'))
else:
for arg in sys.argv[1:]:
GenerateBindings(arg)

View File

@ -10,9 +10,18 @@
'variables': { 'mojo_parent_dir': '../third_party/externals' },
'include_dirs': [ '<(mojo_parent_dir)' ],
'all_dependent_settings': { 'include_dirs': [ '<(mojo_parent_dir)' ] },
'xcode_settings': { 'OTHER_CFLAGS': [ '-w' ], },
'sources': [
'<!@(python find.py <(mojo_parent_dir)/mojo/public/cpp "*.cc")',
'<(mojo_parent_dir)/mojo/public/platform/native/system_thunks.c',
'<(mojo_parent_dir)/mojo/public/interfaces/application/application.mojom.cc',
'<(mojo_parent_dir)/mojo/public/interfaces/application/application.mojom.h',
'<(mojo_parent_dir)/mojo/public/interfaces/application/service_provider.mojom.cc',
'<(mojo_parent_dir)/mojo/public/interfaces/application/service_provider.mojom.h',
'<(mojo_parent_dir)/mojo/public/interfaces/bindings/interface_control_messages.mojom.cc',
'<(mojo_parent_dir)/mojo/public/interfaces/bindings/interface_control_messages.mojom.h',
'<(mojo_parent_dir)/mojo/public/interfaces/bindings/tests/ping_service.mojom.cc',
'<(mojo_parent_dir)/mojo/public/interfaces/bindings/tests/ping_service.mojom.h',
],
'sources!': [
'<!@(python find.py <(mojo_parent_dir)/mojo/public/cpp "*_unittest.cc")',
@ -21,7 +30,32 @@
'<!@(python find.py <(mojo_parent_dir)/mojo/public/cpp "*_test_*.cc")',
'<!@(python find.py <(mojo_parent_dir)/mojo/public/cpp "*_win.cc")',
],
'actions':[
{
'action_name': 'generate_from_mojoms',
'inputs': [
'../experimental/mojo/generate.py',
'<(mojo_parent_dir)/mojo/public/tools/bindings/mojom_parser/bin/linux64/mojom_parser.sha1',
'<(mojo_parent_dir)/mojo/public/tools/bindings/mojom_parser/bin/mac64/mojom_parser.sha1',
'<(mojo_parent_dir)/mojo/public/tools/bindings/mojom_bindings_generator.py',
'<(mojo_parent_dir)/mojo/public/interfaces/bindings/interface_control_messages.mojom',
'<(mojo_parent_dir)/mojo/public/interfaces/application/service_provider.mojom',
'<(mojo_parent_dir)/mojo/public/interfaces/bindings/tests/ping_service.mojom',
'<(mojo_parent_dir)/mojo/public/interfaces/application/application.mojom',
],
'outputs': [
'<(mojo_parent_dir)/mojo/public/interfaces/application/application.mojom.cc',
'<(mojo_parent_dir)/mojo/public/interfaces/application/application.mojom.h',
'<(mojo_parent_dir)/mojo/public/interfaces/application/service_provider.mojom.cc',
'<(mojo_parent_dir)/mojo/public/interfaces/application/service_provider.mojom.h',
'<(mojo_parent_dir)/mojo/public/interfaces/bindings/interface_control_messages.mojom.cc',
'<(mojo_parent_dir)/mojo/public/interfaces/bindings/interface_control_messages.mojom.h',
'<(mojo_parent_dir)/mojo/public/interfaces/bindings/tests/ping_service.mojom.cc',
'<(mojo_parent_dir)/mojo/public/interfaces/bindings/tests/ping_service.mojom.h',
],
'action': ['python', '../experimental/mojo/generate.py']
},
], },
{
'target_name': 'skmojo',
'type': 'static_library',
@ -42,16 +76,12 @@
'inputs': [
'../experimental/mojo/generate.py',
'../experimental/mojo/SkMojo.mojom',
'<(mojo_dir)/tools/bindings/mojom_parser/bin/linux64/mojom_parser.sha1',
'<(mojo_dir)/tools/bindings/mojom_bindings_generator.py',
'<(mojo_dir)/interfaces/bindings/interface_control_messages.mojom',
'<(mojo_dir)/interfaces/application/service_provider.mojom',
'<(mojo_dir)/interfaces/bindings/tests/ping_service.mojom',
'<(mojo_dir)/interfaces/application/application.mojom',
],
'outputs': ['../experimental/mojo/SkMojo.mojom.h',
'../experimental/mojo/SkMojo.mojom.cc'],
'action': ['python', '../experimental/mojo/generate.py']
'outputs': [
'../experimental/mojo/SkMojo.mojom.h',
'../experimental/mojo/SkMojo.mojom.cc'
],
'action': ['python', '../experimental/mojo/generate.py', '../experimental/mojo/SkMojo.mojom']
},
],
},