2012-04-03 03:34:16 +02:00
|
|
|
# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
|
|
|
# reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
# can be found in the LICENSE file.
|
|
|
|
|
2020-01-13 11:04:13 +01:00
|
|
|
from __future__ import absolute_import
|
2012-04-03 03:34:16 +02:00
|
|
|
from cef_parser import *
|
|
|
|
|
2017-05-28 15:04:18 +02:00
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
def make_gypi_file(header):
|
2017-05-28 15:04:18 +02:00
|
|
|
# header string
|
2024-03-28 19:33:29 +01:00
|
|
|
result = get_copyright(full=False, translator=False).replace('//', '#') + \
|
|
|
|
"""#
|
2012-04-03 03:34:16 +02:00
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# This file was generated by the CEF translator tool and should not edited
|
|
|
|
# by hand. See the translator.README.txt file in the tools directory for
|
|
|
|
# more information.
|
|
|
|
#
|
2017-05-18 10:41:47 +02:00
|
|
|
# $hash=$$HASH$$$
|
|
|
|
#
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
'variables': {
|
|
|
|
"""
|
2017-05-28 15:04:18 +02:00
|
|
|
|
|
|
|
filenames = sorted(header.get_file_names())
|
|
|
|
|
|
|
|
# cpp includes
|
|
|
|
result += " 'autogen_cpp_includes': [\n"
|
|
|
|
for filename in filenames:
|
|
|
|
result += " 'include/" + filename + "',\n"
|
|
|
|
result += " ],\n"
|
|
|
|
|
|
|
|
# capi includes
|
|
|
|
result += " 'autogen_capi_includes': [\n"
|
|
|
|
for filename in filenames:
|
|
|
|
result += " 'include/capi/" + get_capi_file_name(filename) + "',\n"
|
|
|
|
result += " ],\n"
|
|
|
|
|
|
|
|
classes = sorted(header.get_class_names())
|
|
|
|
|
|
|
|
# library side includes
|
|
|
|
result += " 'autogen_library_side': [\n"
|
|
|
|
for clsname in classes:
|
|
|
|
cls = header.get_class(clsname)
|
|
|
|
filename = get_capi_name(clsname[3:], False)
|
|
|
|
dir = cls.get_file_directory()
|
|
|
|
if not dir is None:
|
|
|
|
filename = dir + '/' + filename
|
|
|
|
if cls.is_library_side():
|
|
|
|
result += " 'libcef_dll/cpptoc/"+filename+"_cpptoc.cc',\n" \
|
|
|
|
" 'libcef_dll/cpptoc/"+filename+"_cpptoc.h',\n"
|
|
|
|
else:
|
|
|
|
result += " 'libcef_dll/ctocpp/"+filename+"_ctocpp.cc',\n" \
|
|
|
|
" 'libcef_dll/ctocpp/"+filename+"_ctocpp.h',\n"
|
|
|
|
result += " ],\n"
|
|
|
|
|
|
|
|
# client side includes
|
|
|
|
result += " 'autogen_client_side': [\n"
|
|
|
|
for clsname in classes:
|
|
|
|
cls = header.get_class(clsname)
|
|
|
|
filename = get_capi_name(clsname[3:], False)
|
|
|
|
dir = cls.get_file_directory()
|
|
|
|
if not dir is None:
|
|
|
|
filename = dir + '/' + filename
|
|
|
|
if cls.is_library_side():
|
|
|
|
result += " 'libcef_dll/ctocpp/"+filename+"_ctocpp.cc',\n" \
|
|
|
|
" 'libcef_dll/ctocpp/"+filename+"_ctocpp.h',\n"
|
|
|
|
else:
|
|
|
|
result += " 'libcef_dll/cpptoc/"+filename+"_cpptoc.cc',\n" \
|
|
|
|
" 'libcef_dll/cpptoc/"+filename+"_cpptoc.h',\n"
|
|
|
|
result += " ],\n"
|
|
|
|
|
|
|
|
# footer string
|
|
|
|
result += \
|
2012-04-03 03:34:16 +02:00
|
|
|
""" },
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
|
2017-05-28 15:04:18 +02:00
|
|
|
return result
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2017-05-18 10:41:47 +02:00
|
|
|
def write_gypi_file(header, file):
|
2017-05-28 15:04:18 +02:00
|
|
|
newcontents = make_gypi_file(header)
|
|
|
|
return (file, newcontents)
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
# test the module
|
|
|
|
if __name__ == "__main__":
|
2017-05-28 15:04:18 +02:00
|
|
|
import sys
|
|
|
|
|
|
|
|
# verify that the correct number of command-line arguments are provided
|
|
|
|
if len(sys.argv) < 2:
|
2020-01-13 11:04:13 +01:00
|
|
|
sys.stderr.write('Usage: ' + sys.argv[0] + ' <infile>\n')
|
2017-05-28 15:04:18 +02:00
|
|
|
sys.exit()
|
|
|
|
|
|
|
|
# create the header object
|
|
|
|
header = obj_header()
|
|
|
|
header.add_file(sys.argv[1])
|
|
|
|
|
|
|
|
# dump the result to stdout
|
|
|
|
sys.stdout.write(make_gypi_file(header))
|