2019-04-23 19:00:14 +02:00
|
|
|
# Copyright (c) 2019 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-09 21:22:11 +01:00
|
|
|
from __future__ import absolute_import
|
2022-02-02 18:31:20 +01:00
|
|
|
from cef_parser import get_copyright
|
2019-04-23 19:00:14 +02:00
|
|
|
from file_util import *
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
2022-02-02 18:31:20 +01:00
|
|
|
def make_config_header(gn_config):
|
|
|
|
""" Creates the header file contents for the cef build configuration. """
|
|
|
|
|
|
|
|
if not path_exists(gn_config):
|
|
|
|
raise Exception('File ' + gn_config + ' does not exist.')
|
|
|
|
|
|
|
|
defines = []
|
|
|
|
|
|
|
|
if sys.platform.startswith('linux'):
|
|
|
|
lines = read_file(gn_config).split("\n")
|
|
|
|
|
|
|
|
# All Linux builds use Ozone, and the X11 platform is enabled by default.
|
|
|
|
# Check if the config is explicitly disabling it.
|
|
|
|
if not 'ozone_platform_x11=false' in lines:
|
|
|
|
defines.append('#define CEF_X11 1')
|
|
|
|
|
|
|
|
result = get_copyright(full=True, translator=False) + \
|
|
|
|
"""//
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// This file is generated by the make_config_header.py tool.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef CEF_INCLUDE_CEF_CONFIG_H_
|
|
|
|
#define CEF_INCLUDE_CEF_CONFIG_H_
|
|
|
|
|
|
|
|
$DEFINES$
|
|
|
|
|
|
|
|
#endif // CEF_INCLUDE_CEF_CONFIG_H_
|
2019-04-23 19:00:14 +02:00
|
|
|
"""
|
2022-02-02 18:31:20 +01:00
|
|
|
|
|
|
|
result = result.replace('$DEFINES$', "\n".join(defines))
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
def write_config_header(output, gn_config):
|
|
|
|
output = os.path.abspath(output)
|
|
|
|
result = make_config_header(gn_config)
|
|
|
|
return write_file_if_changed(output, result)
|
|
|
|
|
|
|
|
|
|
|
|
def main(argv):
|
|
|
|
if len(argv) < 3:
|
|
|
|
print(("Usage:\n %s <output_header_file> <input_args_gn_file>" % argv[0]))
|
|
|
|
sys.exit(-1)
|
|
|
|
write_config_header(argv[1], argv[2])
|
|
|
|
|
|
|
|
|
|
|
|
if '__main__' == __name__:
|
|
|
|
main(sys.argv)
|