From a562180ae1a87d9f327c6ca686931a8f9d84de81 Mon Sep 17 00:00:00 2001 From: wenjun Date: Tue, 8 Sep 2020 10:21:38 +0800 Subject: [PATCH] add OpenHarmony 1.0 baseline --- .gitee/ISSUE_TEMPLATE.zh-CN.md | 13 + .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md | 15 + .gitignore | 2 + .gn | 18 + BUILD.gn | 56 + LICENSE | 177 ++ __init__.py | 17 + __main__.py | 68 + build.py | 68 + build_ext_components.py | 64 + compile.py | 46 + compile_process.py | 63 + config.ini | 25 + config.py | 172 ++ config/BUILD.gn | 215 ++ config/BUILDCONFIG.gn | 60 + config/boards/hi3516dv300.gni | 15 + config/boards/hi3518ev300.gni | 15 + config/boards/hi3861v100.gni | 15 + config/component/lite_component.gni | 180 ++ config/kernel/liteos/cortex_a/BUILD.gn | 20 + config/kernel/liteos/cortex_m/BUILD.gn | 106 + config/subsystem/aafwk/config.gni | 19 + config/subsystem/lite_subsystem.gni | 99 + config/test.gni | 102 + config_convert.py | 72 + copy_files.py | 76 + filter.py | 49 + filter_process.py | 156 ++ gen_module_notice_file.py | 181 ++ gen_rootfs.py | 352 +++ gn_scripts.py | 45 + ndk/BUILD.gn | 113 + ndk/README.md | 128 + ndk/archive_ndk.py | 72 + ndk/build/.gn | 15 + ndk/build/BUILD.gn | 23 + ndk/build/build.py | 88 + ndk/build/config/BUILD.gn | 206 ++ ndk/build/config/BUILDCONFIG.gn | 66 + ndk/build/config/variable.gni | 33 + ndk/build/toolchain/BUILD.gn | 59 + ndk/build/toolchain/clang.gni | 126 + ndk/build/toolchain/gcc.gni | 132 + ndk/build/toolchain/riscv.gni | 20 + ndk/doc/BUILD.gn | 37 + ndk/doc/config/Doxyfile_C | 2321 +++++++++++++++++ ndk/doc/config/Doxyfile_CPP | 2321 +++++++++++++++++ ndk/doc/gen_doc.py | 98 + ndk/ndk.gni | 152 ++ ndk/sample/BUILD.gn | 31 + ndk/sample/src/hello_world.c | 24 + ohos_var.gni | 43 + platform/hi3516dv300_liteos_a/init.ld | 90 + platform/hi3516dv300_liteos_a/platform.json | 749 ++++++ platform/hi3518ev300_liteos_a/init.ld | 90 + platform/hi3518ev300_liteos_a/platform.json | 684 +++++ .../hi3861v100_liteos_riscv/platform.json | 307 +++ product/ipcamera_hi3516dv300.json | 152 ++ product/ipcamera_hi3518ev300.json | 145 + product/wifiiot.json | 90 + readme.md | 1 + toolchain/BUILD.gn | 51 + toolchain/clang.gni | 120 + toolchain/gcc.gni | 132 + utils.py | 114 + 66 files changed, 11414 insertions(+) create mode 100755 .gitee/ISSUE_TEMPLATE.zh-CN.md create mode 100755 .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md create mode 100755 .gitignore create mode 100755 .gn create mode 100755 BUILD.gn create mode 100755 LICENSE create mode 100755 __init__.py create mode 100755 __main__.py create mode 100755 build.py create mode 100755 build_ext_components.py create mode 100755 compile.py create mode 100755 compile_process.py create mode 100755 config.ini create mode 100755 config.py create mode 100755 config/BUILD.gn create mode 100755 config/BUILDCONFIG.gn create mode 100755 config/boards/hi3516dv300.gni create mode 100755 config/boards/hi3518ev300.gni create mode 100755 config/boards/hi3861v100.gni create mode 100755 config/component/lite_component.gni create mode 100755 config/kernel/liteos/cortex_a/BUILD.gn create mode 100755 config/kernel/liteos/cortex_m/BUILD.gn create mode 100755 config/subsystem/aafwk/config.gni create mode 100755 config/subsystem/lite_subsystem.gni create mode 100755 config/test.gni create mode 100755 config_convert.py create mode 100755 copy_files.py create mode 100755 filter.py create mode 100755 filter_process.py create mode 100755 gen_module_notice_file.py create mode 100755 gen_rootfs.py create mode 100755 gn_scripts.py create mode 100755 ndk/BUILD.gn create mode 100755 ndk/README.md create mode 100755 ndk/archive_ndk.py create mode 100755 ndk/build/.gn create mode 100755 ndk/build/BUILD.gn create mode 100755 ndk/build/build.py create mode 100755 ndk/build/config/BUILD.gn create mode 100755 ndk/build/config/BUILDCONFIG.gn create mode 100755 ndk/build/config/variable.gni create mode 100755 ndk/build/toolchain/BUILD.gn create mode 100755 ndk/build/toolchain/clang.gni create mode 100755 ndk/build/toolchain/gcc.gni create mode 100755 ndk/build/toolchain/riscv.gni create mode 100755 ndk/doc/BUILD.gn create mode 100755 ndk/doc/config/Doxyfile_C create mode 100755 ndk/doc/config/Doxyfile_CPP create mode 100755 ndk/doc/gen_doc.py create mode 100755 ndk/ndk.gni create mode 100755 ndk/sample/BUILD.gn create mode 100755 ndk/sample/src/hello_world.c create mode 100755 ohos_var.gni create mode 100755 platform/hi3516dv300_liteos_a/init.ld create mode 100755 platform/hi3516dv300_liteos_a/platform.json create mode 100755 platform/hi3518ev300_liteos_a/init.ld create mode 100755 platform/hi3518ev300_liteos_a/platform.json create mode 100755 platform/hi3861v100_liteos_riscv/platform.json create mode 100755 product/ipcamera_hi3516dv300.json create mode 100755 product/ipcamera_hi3518ev300.json create mode 100755 product/wifiiot.json create mode 100755 readme.md create mode 100755 toolchain/BUILD.gn create mode 100755 toolchain/clang.gni create mode 100755 toolchain/gcc.gni create mode 100755 utils.py diff --git a/.gitee/ISSUE_TEMPLATE.zh-CN.md b/.gitee/ISSUE_TEMPLATE.zh-CN.md new file mode 100755 index 0000000..f09d98d --- /dev/null +++ b/.gitee/ISSUE_TEMPLATE.zh-CN.md @@ -0,0 +1,13 @@ +### 该问题是怎么引起的? + + + +### 重现步骤 + + + +### 报错信息 + + + + diff --git a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md new file mode 100755 index 0000000..33948fd --- /dev/null +++ b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md @@ -0,0 +1,15 @@ +### 相关的Issue + + +### 原因(目的、解决的问题等) + + +### 描述(做了什么,变更了什么) + + +### 测试用例(新增、改动、可能影响的功能) + + + + + diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..029519e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +__pycache__/ +*.py[cod] \ No newline at end of file diff --git a/.gn b/.gn new file mode 100755 index 0000000..806ea8e --- /dev/null +++ b/.gn @@ -0,0 +1,18 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# The location of the build configuration file. +buildconfig = "//build/lite/config/BUILDCONFIG.gn" + +# The source root location. +root = "//build/lite" diff --git a/BUILD.gn b/BUILD.gn new file mode 100755 index 0000000..dbbddaf --- /dev/null +++ b/BUILD.gn @@ -0,0 +1,56 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/lite/toolchain/${ohos_build_compiler}.gni") +import("//build/lite/ndk/ndk.gni") + +group("ohos") { + deps = [] + product_cfg = read_file("//build/lite/product/${product}.json", "json") + foreach(subsystem, product_cfg.subsystem) { + foreach(component, subsystem.component) { + deps += [ component.dir ] + } + } +} + +group("ndk") { + # Add native API targets + deps = [] + if (ohos_build_ndk) { + deps += [ + "//build/lite/ndk:ndk" + ] + } +} + +action("gen_rootfs") { + deps = [ ":ohos" ] + + script = "//build/lite/gen_rootfs.py" + outputs = [ "$target_gen_dir/gen_rootfs.log" ] + out_dir = rebase_path(root_build_dir, ".") + + compiler_dir = ohos_build_compiler_dir + "/bin/" + + ohos_build_compiler_so_strip = compiler_dir + ohos_build_compiler_so_strip + ohos_build_compiler_bin_strip = compiler_dir + ohos_build_compiler_bin_strip + + args = [ + "--path=$out_dir", + "--board=$board_name", + "--kernel=$ohos_kernel_type", + "--compile_so=$ohos_build_compiler_so_strip", + "--compile_bin=$ohos_build_compiler_bin_strip" + ] +} \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..4a45986 --- /dev/null +++ b/LICENSE @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/__init__.py b/__init__.py new file mode 100755 index 0000000..deab585 --- /dev/null +++ b/__init__.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/__main__.py b/__main__.py new file mode 100755 index 0000000..7d40138 --- /dev/null +++ b/__main__.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import sys +import argparse +import importlib +import logging +import os + + +def main(): + if not __package__: + path = os.path.join(os.path.dirname(__file__), os.pardir) + sys.path.insert(0, path) + + parser = argparse.ArgumentParser(usage="lite [COMMAND]", + description='lite build system') + subparsers = parser.add_subparsers() + parser_list = [] + parser_list.append({ + 'name': 'compile', + 'help': 'Build source code' + }) + + parser_list.append({ + 'name': 'filter', + 'help': 'Filter out non-open source code' + }) + + for each in parser_list: + module_parser = subparsers.add_parser(name=each.get('name'), + help=each.get('help')) + module = importlib.import_module('.{}'.format(each.get('name')), + 'lite') + module.add_options(module_parser) + module_parser.set_defaults(command=module.exec_command) + + args = parser.parse_args() + + try: + status = args.command(args) + except KeyboardInterrupt: + logging.warning('interrupted') + status = -1 + except Exception as e: + logging.error(e) + status = -1 + + return status + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/build.py b/build.py new file mode 100755 index 0000000..3694155 --- /dev/null +++ b/build.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import sys +import argparse +import importlib +import logging +import os + + +def usage(): + msg = "\n python build.py ipcamera_hi3516dv300\n "\ + "python build.py ipcamera_hi3518ev300\n "\ + "python build.py wifiiot" + return msg + + +def main(): + if not __package__: + path = os.path.join(os.path.abspath(os.path.dirname(__file__)), + 'build') + sys.path.insert(0, path) + + parser = argparse.ArgumentParser(usage=usage()) + parser_list = [] + parser_list.append({ + 'name': 'compile', + 'help': 'Build source code' + }) + + for each in parser_list: + module = importlib.import_module('.{}'.format(each.get('name')), + 'lite') + module.add_options(parser) + parser.set_defaults(command=module.exec_command) + + args = parser.parse_args() + + try: + status = args.command(args) + except KeyboardInterrupt: + logging.warning('interrupted') + status = -1 + except Exception as e: + print(e) + parser.print_help() + status = -1 + + return status + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/build_ext_components.py b/build_ext_components.py new file mode 100755 index 0000000..512d46c --- /dev/null +++ b/build_ext_components.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import sys +from subprocess import Popen +import argparse +import shlex + + +def cmd_exec(command): + cmd = shlex.split(command) + proc = Popen(cmd) + proc.wait() + ret_code = proc.returncode + if ret_code != 0: + raise Exception("{} failed, return code is {}".format(cmd, ret_code)) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--path', help='Build path.') + parser.add_argument('--prebuilts', help='Build prebuilts.') + parser.add_argument('--command', help='Build command.') + parser.add_argument('--enable', help='enable python.', nargs='*') + args = parser.parse_args() + + if args.enable: + if args.enable[0] == 'false': + return + + if args.path: + curr_dir = os.getcwd() + os.chdir(args.path) + if args.prebuilts: + cmd_exec(args.prebuilts) + if args.command: + if '&&' in args.command: + command = args.command.split('&&') + for data in command: + cmd_exec(data) + else: + cmd_exec(args.command) + + os.chdir(curr_dir) + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/compile.py b/compile.py new file mode 100755 index 0000000..ca6d52a --- /dev/null +++ b/compile.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from utils import CallbackDict +from compile_process import config_create +from compile_process import run_build +from config import Config + + +def add_options(parser): + parser.add_argument('product', help='Name of the product', nargs='*') + parser.add_argument('-b', '--build_type', help='release or debug version.', + nargs=1, default=['release']) + parser.add_argument('-t', '--test', help='Compile test suit', nargs='*') + parser.add_argument('-n', '--ndk', help='Compile ndk', action='store_true') + + +def exec_command(args): + callback_dict = CallbackDict() + + # parse product + if args.product: + config = Config(args) + callback_dict.register(config.product, config_create) + callback_dict.register(config.product, run_build) + + callback_dict.excute(config.product, + config=config, + args=args) + else: + raise Exception("Error: product not found.") diff --git a/compile_process.py b/compile_process.py new file mode 100755 index 0000000..20cd651 --- /dev/null +++ b/compile_process.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import shutil +from utils import makedirs +from utils import read_json_file +from config import Compile + + +def run_build(**kwargs): + print("\n=== start build ===\n") + config = kwargs['config'] + compile = Compile() + compile.compile(config) + print("ohos {} build success!".format(config.product)) + + +def parse_product_json(config): + product = config.product + product_json = os.path.join(config.get_build_path(), 'product', + '{}.json'.format(product)) + json_content = read_json_file(product_json) + Compile.get_tool_path(config, json_content) + return load_subsystem_feature(json_content, config) + + +def check_build(config): + # Delete and create output directory + out_path = config.get_out_path() + if os.path.exists(out_path): + shutil.rmtree(out_path) + makedirs(out_path) + return parse_product_json(config) + + +def load_subsystem_feature(json_content, config): + for subsystem in json_content['subsystem']: + for component in subsystem['component']: + for feature in component['features']: + config.args_list.append(feature) + return True + + +def config_create(**kwargs): + config = kwargs['config'] + check_build(config) + return True diff --git a/config.ini b/config.ini new file mode 100755 index 0000000..fa49206 --- /dev/null +++ b/config.ini @@ -0,0 +1,25 @@ +[env] +build_path= +gn_path= +out_path= +gn_args= +gn_cmd=%(gn_path)s gen %(out_path)s --root=. --dotfile=build/lite/.gn --args='%(gn_args)s' +ninja_path= +ninja_cmd=%(ninja_path)s -w dupbuild=warn -C %(out_path)s + +[gn_args] +product= +product_args=product = "%(product)s" +ndk_args=ohos_build_ndk = true +build_type= +build_type_args=ohos_build_type = "%(build_type)s" +test= +test_args=ohos_xts_test_args = "%(test)s" +compiler_path= +compiler_args=ohos_build_compiler_dir="%(compiler_path)s" + +[ndk] +ndk_path= +clang_path=./prebuilts/clang/harmonyos/linux-x86_64/llvm/bin/clang +ninja_path=./prebuilts/build-tools/linux-x86/bin/ninja +gn_path=./prebuilts/build-tools/linux-x86/bin/gn \ No newline at end of file diff --git a/config.py b/config.py new file mode 100755 index 0000000..3c6aadc --- /dev/null +++ b/config.py @@ -0,0 +1,172 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import distutils.spawn +from utils import exec_command +from utils import check_output +try: + # Python3 + from configparser import ConfigParser +except ImportError: + # Python2 + from ConfigParser import ConfigParser + + +class Config(): + def __init__(self, args): + self.product = args.product[0] + self.build_type = args.build_type[0] + self.__set_path() + self.config = os.path.join(self.get_build_path(), 'config.ini') + self.log_path = os.path.join(self.get_out_path(), 'build.log') + self.cfg = ConfigParser() + self.cfg.read(self.config) + self.args_list = [] + self.__test_cmd_check(args.test) + self.__ndk_check(args.ndk) + + def __set_path(self): + self.__root_path = os.getcwd() + self.__build_path = os.path.join(self.__root_path, 'build', 'lite') + if not os.path.exists(self.__build_path): + raise Exception('Error: {} not exist, please check.'.format( + self.__build_path)) + self.__out_path = os.path.join(self.__root_path, 'out', self.product) + + def get_root_path(self): + if self.__root_path is None: + raise Exception('Error: set root_path first.') + + return self.__root_path + + def get_build_path(self): + if self.__build_path is None: + raise Exception('Error: set build_path first.') + + return self.__build_path + + def get_out_path(self): + if self.__out_path is None: + raise Exception('Error: set out_path first.') + + return self.__out_path + + def get_cmd(self, gn_path, ninja_path): + if not os.path.exists(self.config): + raise Exception('Error: {} not exist, please check.'.format( + self.config)) + return self.__parse_compile_config(gn_path, ninja_path) + + def __parse_compile_config(self, gn_path, ninja_path): + self.cfg.set('env', 'build_path', self.get_build_path()) + self.cfg.set('env', 'out_path', self.get_out_path()) + self.cfg.set('env', 'gn_path', gn_path) + self.cfg.set('env', 'ninja_path', ninja_path) + self.cfg.set('env', 'gn_args', self.get_gn_args()) + return [self.cfg.get('env', 'gn_cmd'), + self.cfg.get('env', 'ninja_cmd')] + + def __test_cmd_check(self, test_args): + if test_args: + cmd_list = ['xts'] + if test_args[0] in cmd_list: + if len(test_args) > 1: + self.cfg.set('gn_args', 'test', test_args[1]) + self.args_list.append(self.cfg.get('gn_args', 'test_args')) + else: + raise Exception('Error: wrong input of test') + + def __ndk_check(self, ndk): + if ndk: + self.args_list.append(self.cfg.get('gn_args', 'ndk_args')) + + def get_gn_args(self): + self.cfg.set('gn_args', 'product', self.product) + self.cfg.set('gn_args', 'build_type', self.build_type) + self.args_list.append(self.cfg.get('gn_args', 'product_args')) + self.args_list.append(self.cfg.get('gn_args', 'build_type_args')) + return " ".join(self.args_list) + + +class Compile(): + compiler_path = None + gn_path = None + ninja_path = None + sysroot_path = None + + def compile(self, config): + cmd_list = config.get_cmd(self.gn_path, self.ninja_path) + for cmd in cmd_list: + exec_command(cmd, log_path=config.log_path, shell=True) + + @classmethod + def get_tool_path(cls, config, json_content): + compiler = json_content['compiler'] + + if compiler == "clang": + compiler_bin = "clang" + elif compiler == "gcc": + compiler_bin = "riscv32-unknown-elf-gcc" + else: + raise Exception('Error: Unsupport compiler {}.'.format(compiler)) + + cls.compiler_path = distutils.spawn.find_executable(compiler_bin) + if cls.compiler_path is None: + compiler_cfg_path = config.cfg.get('ndk', '{}_path' + .format(compiler_bin)) + if os.path.exists(compiler_cfg_path): + cls.compiler_path = os.path.abspath(compiler_cfg_path) + else: + raise Exception('Error: Can\'t find compiler {}, ' + 'install it please.'.format(compiler_bin)) + cls.check_compiler(compiler, config) + + cls.gn_path = distutils.spawn.find_executable('gn') + if cls.gn_path is None: + gn_cfg_path = config.cfg.get('ndk', 'gn_path') + if os.path.exists(gn_cfg_path): + cls.gn_path = gn_cfg_path + else: + raise Exception('Error: Can\'t find gn, install it please.') + + cls.ninja_path = distutils.spawn.find_executable('ninja') + if cls.ninja_path is None: + ninja_cfg_path = config.cfg.get('ndk', 'ninja_path') + if os.path.exists(ninja_cfg_path): + cls.ninja_path = ninja_cfg_path + else: + raise Exception('Error: Can\'t find ninja, install it please.') + + @classmethod + def check_compiler(cls, compiler, config): + if compiler == 'gcc': + return True + + cmd = [cls.compiler_path, '-v'] + ret = check_output(cmd) + if 'OHOS' not in ret: + raise Exception('Error: {} is not OHOS compiler, please install' + ' compiler.'.format(cls.compiler_path)) + + compiler_path = os.path.join(os.path.dirname(cls.compiler_path), + os.pardir) + config.cfg.set('gn_args', 'compiler_path', compiler_path) + config.args_list.append(config.cfg.get('gn_args', 'compiler_args')) + + return True diff --git a/config/BUILD.gn b/config/BUILD.gn new file mode 100755 index 0000000..c82db17 --- /dev/null +++ b/config/BUILD.gn @@ -0,0 +1,215 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +config("cpu_arch") { + cflags = [] + if (target_cpu == "cortex-a7") { + cflags += [ + "-march=armv7-a", + "-mfloat-abi=softfp" + ] + } else if (target_cpu == "riscv32") { + cflags += [ + "-mabi=ilp32", + "-march=rv32imc" + ] + } + asmflags = cflags + cflags_cc = cflags + ldflags = cflags +} + +config("language_c") { + cflags_c = [ + "-std=c99" + ] +} + +config("language_cpp") { + cflags_cc = [ + "-std=c++11" + ] +} + +config("kernel_macros") { + if (ohos_kernel_type == "liteos_a") { + defines = [ + "__LITEOS__", + "__LITEOS_A__", + ] + } else if (ohos_kernel_type == "liteos_m") { + defines = [ + "__LITEOS__", + "__LITEOS_M__" + ] + } else if (ohos_kernel_type == "liteos_riscv") { + defines = [ + "__LITEOS__", + "__LITEOS_RISCV__" + ] + } else if (ohos_kernel_type == "linux") { + defines = [ "__LINUX__" ] + } +} + +config("werror") { + cflags = [ + "-Werror" + ] + cflags_cc = cflags +} + +config("common") { + defines = [ "_XOPEN_SOURCE=700" ] + cflags = [ + "-nostdlib", + "-fno-common", + "-fno-builtin", + "-fno-strict-aliasing", + ] + cflags_cc = cflags + ldflags = [ + "-lc" + ] + cflags += [ "-fsigned-char" ] +} + +config("security") { + defines = [ + "_FORTIFY_SOURCE=2" + ] + + cflags = [ + "-fstack-protector-all" + ] + cflags_cc = cflags + + ldflags = [ + "-Wl,-z,now", + "-Wl,-z,relro", + "-Wl,-z,noexecstack" + ] +} + +config("exceptions") { + cflags_cc = [ "-fexceptions" ] + cflags_objcc = cflags_cc +} + +config("no_exceptions") { + cflags_cc = [ "-fno-exceptions" ] + cflags_objcc = cflags_cc + ldflags = cflags_cc +} + +config("stack_protector") { + cflags = [ "-fstack-protector-all" ] + cflags_cc = cflags +} + +config("static_pie_config") { + cflags = [ "-fPIE" ] + cflags_cc = cflags +} + +config("shared_library_config") { + cflags = [ "-fPIC" ] + cflags_cc = cflags +} + +config("pie_executable_config") { + ldflags = [ "-pie" ] +} + +config("clang") { + include_dirs = [ + "${ohos_build_compiler_dir}/include/c++/v1", + "//prebuilts/lite/sysroot/usr/include/arm-liteos", + ] + + cflags = [ + "--target=arm-liteos", + "--sysroot=${ohos_root_path}prebuilts/lite/sysroot" + ] + cflags_cc = cflags + ldflags = cflags + + ldflags += [ + "-L${ohos_build_compiler_dir}/lib/arm-liteos/c++", + "-L${ohos_root_path}prebuilts/lite/sysroot/usr/lib/arm-liteos", + "-L${ohos_build_compiler_dir}/lib/clang/9.0.0/lib/arm-liteos", + "-L${ohos_build_compiler_dir}/lib/arm-liteos/c++", + "-lclang_rt.builtins", + "-lc++", + "-lc++abi" + ] +} + +config("release") { + defines = [ + "OHOS_RELEASE", + ] + cflags = [ + "-Oz", + "-flto" + ] + cflags_cc = cflags +} + +config("debug") { + defines = [ + "OHOS_DEBUG", + ] + cflags = [ + "-Oz", + "-flto" + ] + cflags_cc = cflags +} + +config("default_link_path") { + out_dir = rebase_path(root_build_dir) + ldflags = [ + "-L${out_dir}", + "-Wl,-rpath-link=${out_dir}" + ] +} + +config("liteos_a") { + configs = [ + ":common", + ":werror", + "kernel/liteos/cortex_a:default", + ":clang", + ":cpu_arch", + ":security", + ":exceptions", + ":default_link_path" + ] + + if (ohos_build_type == "release") { + configs += [ ":release" ] + } else if (ohos_build_type == "debug") { + configs += [ ":debug" ] + } +} + +config("liteos_riscv") { + configs = [ + ":common", + ":werror", + "kernel/liteos/cortex_m:riscv32", + ":cpu_arch", + ":default_link_path" + ] +} \ No newline at end of file diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn new file mode 100755 index 0000000..483257a --- /dev/null +++ b/config/BUILDCONFIG.gn @@ -0,0 +1,60 @@ +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import("//build/lite/ohos_var.gni") +import("//build/lite/config/boards/${board_name}.gni") + +if (target_os == "") { + target_os = "ohos" +} + +if (target_cpu == "") { + target_cpu = board_cpu +} + +if(target_os == "ohos") { + if(ohos_kernel_type == "liteos_a") { + set_default_toolchain("//build/lite/toolchain:linux_x86_64_clang") + default_target_configs = [ "//build/lite/config:liteos_a" ] + } else if (ohos_kernel_type == "liteos_riscv") { + set_default_toolchain("//build/lite/toolchain:linux_x86_64_riscv32_gcc") + default_target_configs = [ "//build/lite/config:liteos_riscv" ] + } + default_target_configs += [ + "//build/lite/config:language_c", + "//build/lite/config:language_cpp", + "//build/lite/config:kernel_macros" + ] +} + +default_shared_library_configs = default_target_configs + [ "//build/lite/config:shared_library_config" ] +default_static_library_configs = default_target_configs + [ "//build/lite/config:static_pie_config" ] +default_executable_configs = default_static_library_configs + [ "//build/lite/config:pie_executable_config" ] + +set_defaults("executable") { + configs = default_executable_configs +} + +set_defaults("static_library") { + configs = default_static_library_configs +} + +set_defaults("shared_library") { + configs = default_shared_library_configs +} + +set_defaults("source_set") { + configs = default_target_configs +} diff --git a/config/boards/hi3516dv300.gni b/config/boards/hi3516dv300.gni new file mode 100755 index 0000000..2dad515 --- /dev/null +++ b/config/boards/hi3516dv300.gni @@ -0,0 +1,15 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +board_arch = "armv7-a" +board_cpu = "cortex-a7" diff --git a/config/boards/hi3518ev300.gni b/config/boards/hi3518ev300.gni new file mode 100755 index 0000000..2dad515 --- /dev/null +++ b/config/boards/hi3518ev300.gni @@ -0,0 +1,15 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +board_arch = "armv7-a" +board_cpu = "cortex-a7" diff --git a/config/boards/hi3861v100.gni b/config/boards/hi3861v100.gni new file mode 100755 index 0000000..15ad3f9 --- /dev/null +++ b/config/boards/hi3861v100.gni @@ -0,0 +1,15 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +board_arch = "rv32imc" +board_cpu = "riscv32" diff --git a/config/component/lite_component.gni b/config/component/lite_component.gni new file mode 100755 index 0000000..fe12453 --- /dev/null +++ b/config/component/lite_component.gni @@ -0,0 +1,180 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +template("lite_library") { + assert(defined(invoker.target_type), "Library target_type is required.") + assert(defined(invoker.sources), "Library sources is required.") + target_type = invoker.target_type + shared_lib = (target_type == "shared_library") + + if (shared_lib && ohos_kernel_type == "liteos_riscv") { + group(target_name) { + if(defined(invoker.sources)) { + assert(invoker.sources != "") + } + if(defined(invoker.public_configs)) { + assert(invoker.public_configs != "") + } + if(defined(invoker.public_deps)) { + assert(invoker.public_deps != "") + } + if(defined(invoker.output_name)) { + assert(invoker.output_name!= "") + } + } + } else { + target(target_type, target_name) { + forward_variables_from(invoker, "*") + cflags = [] + cflags_cc = [] + ldflags = [] + if (defined(invoker.cflags)) { + cflags += invoker.cflags + } + if (defined(invoker.cflags_cc)) { + cflags_cc += invoker.cflags_cc + ldflags += ["-lstdc++"] + } + if (defined(invoker.ldflags)) { + ldflags += invoker.ldflags + } + shared_lib = (target_type == "shared_library") + if(shared_lib) { + cflags += [ "-fPIC" ] + cflags_cc += [ "-fPIC" ] + } else { + cflags += [ "-fPIE" ] + cflags_cc += [ "-fPIE" ] + } + } + } +} + +# Defines a component +# +# The lite_subsystem template defines all the modules contained in a subsystem +# +# Parameters +# +# component_features (required) +# [list of scopes] Defines all features in the component. +template("lite_component") { + assert(defined(invoker.features), "Component features is required.") + + forward_variables_from(invoker, "*") + + if (!defined(invoker.target_type)) { + target_type = "group" + } else if (invoker.target_type == "static_library") { + target_type = "group" + } else { + target_type = invoker.target_type + } + assert(target_type != "") + + target(target_type, target_name) { + deps = [] + # add component deps + if(defined(invoker.deps)) { + deps += invoker.deps + } + # add component features + foreach(feature_label, features) { + deps += [ feature_label ] + } + } +} + +template("build_ext_component") +{ + if(defined(invoker.version)) { + print(invoker.version) + } + action(target_name){ + deps = [] + if(defined(invoker.deps)) { + deps += invoker.deps + } + args = [] + if(defined(invoker.exec_path)) { + args += [ + "--path=${invoker.exec_path}" + ] + } + if(defined(invoker.enable)) { + args += [ + "--enable=${invoker.enable}" + ] + } + if(defined(invoker.prebuilts)) { + args += [ + "--prebuilts=${invoker.prebuilts}" + ] + } + if(defined(invoker.command)) { + args += [ + "--command=${invoker.command}" + ] + } + script = "//build/lite/build_ext_components.py" + outputs = [ "$target_out_dir/${target_name}_build_ext_components.txt" ] + } +} + +template("ohos_tools") { + target(invoker.target_type, target_name) { + forward_variables_from(invoker, "*") + output_dir = "$root_out_dir/tools/$target_name" + if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") { + configs -= [ "//build/lite/config:ohos" ] + } else if (ohos_kernel_type == "liteos_riscv") { + configs -= [ "//build/lite/config:liteos" ] + } + configs -= [ "//build/lite/config:pie_executable_config" ] + configs -= [ "//build/lite/config:static_pie_config" ] + configs += [ "//build/lite/config:tools" ] + } +} + +template("generate_notice_file") { + assert(defined(invoker.module_name), "module_name in required.") + assert(defined(invoker.module_source_dir_list), "module_source_dir_list in required.") + assert(target_name != "") + forward_variables_from(invoker, + [ + "module_name", + "module_source_dir_list", + ]) + gen_script = rebase_path("//build/lite/gen_module_notice_file.py") + + foreach(module_source_dir, module_source_dir_list) { + arguments = [] + arguments = [ + "--root-out-dir", + rebase_path(root_out_dir), + "--module-source-dir", + rebase_path(module_source_dir), + "--module-relative-source-dir", + rebase_path(module_source_dir, "//"), + "--target-name", + module_name, + ] + ret_msg = "" + ret_msg = exec_script(gen_script, arguments, "list lines") + if (ret_msg != "") { + foreach(msg, ret_msg) { + print(msg) + } + } + } +} diff --git a/config/kernel/liteos/cortex_a/BUILD.gn b/config/kernel/liteos/cortex_a/BUILD.gn new file mode 100755 index 0000000..e2049ac --- /dev/null +++ b/config/kernel/liteos/cortex_a/BUILD.gn @@ -0,0 +1,20 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +config("default") { + cflags = [ + "-mno-unaligned-access", + "-fno-omit-frame-pointer", + ] + cflags_cc = cflags +} diff --git a/config/kernel/liteos/cortex_m/BUILD.gn b/config/kernel/liteos/cortex_m/BUILD.gn new file mode 100755 index 0000000..9fc442a --- /dev/null +++ b/config/kernel/liteos/cortex_m/BUILD.gn @@ -0,0 +1,106 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +config("riscv32") { + defines = [] + cflags = [] + include_dirs = [] + + defines = [ + "LOS_COMPILE_LDM", + "PRODUCT_USR_SOFT_VER_STR=\"None\"", + "CYGPKG_POSIX_SIGNALS", + "__ECOS__", + "__RTOS_", + "PRODUCT_CFG_HAVE_FEATURE_SYS_ERR_INFO", + "__LITEOS__", + "LIB_CONFIGURABLE", + "LOSCFG_SHELL", + "LOSCFG_CACHE_STATICS", + "CUSTOM_AT_COMMAND", + "LOS_COMPILE_LDM", + "LOS_CONFIG_IPERF3", + "CMSIS_OS_VER=2", + "SECUREC_ENABLE_SCANF_FILE=0", + "CONFIG_AT_COMMAND", + "PRODUCT_CFG_CHIP_VER_STR=\"Hi3861V100\"", + "CHIP_VER_Hi3861", + "PRODUCT_CFG_SOFT_VER_STR=\"Hi3861\"", + "HI_BOARD_ASIC", + "HI_ON_FLASH", + "LITEOS_WIFI_IOT_VERSION", + ] + + cflags = [ + "-falign-functions=2", + "-msave-restore", + "-fno-optimize-strlen", + "-freorder-blocks-algorithm=simple", + "-fno-schedule-insns", + "-fno-inline-small-functions", + "-fno-inline-functions-called-once", + "-mtune=size", + "-mno-small-data-limit=0", + "-fno-aggressive-loop-optimizations", + "-std=c99", + "-Wpointer-arith", + "-Wstrict-prototypes", + "-fstack-protector-all", + "-Os", + "-ffunction-sections", + "-fdata-sections", + "-fno-exceptions", + "-fno-short-enums", + "-Wextra", + "-Wall", + "-Wundef", + "-U", + "PRODUCT_CFG_BUILD_TIME", + ] + + include_dirs += [ + "//vendor/hisi/hi3861/hi3861/include", + "//vendor/hisi/hi3861/hi3861/platform/include", + "//vendor/hisi/hi3861/hi3861/platform/system/include", + "//vendor/hisi/hi3861/hi3861/config", + "//vendor/hisi/hi3861/hi3861/config/nv", + "//utils/native/lite/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/kernel/base/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/targets/hi3861v100/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/kernel/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/arch/risc-v/rv32im", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libm/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libsec/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/net/wpa_supplicant-2.7/src/common", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/targets/hi3861v100/plat/riscv", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/kernel/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/kernel/extended/runstop", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/posix/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/linux/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/net/lwip_sack/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libc/musl/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libc/musl/arch/generic", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libc/musl/arch/riscv32", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libc/hw/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libc/nuttx/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libsec/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/targets/hi3861v100/config", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/targets/hi3861v100/user", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/targets/hi3861v100/plat", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/targets/hi3861v100/extend/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/arch", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libc/bionic/libm", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/shell/include", + "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/net/telnet/include", + ] +} diff --git a/config/subsystem/aafwk/config.gni b/config/subsystem/aafwk/config.gni new file mode 100755 index 0000000..1f80e6f --- /dev/null +++ b/config/subsystem/aafwk/config.gni @@ -0,0 +1,19 @@ +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +declare_args() { + # build feature ability, dependent window + enable_ohos_appexecfwk_feature_ability = true +} diff --git a/config/subsystem/lite_subsystem.gni b/config/subsystem/lite_subsystem.gni new file mode 100755 index 0000000..a64c95b --- /dev/null +++ b/config/subsystem/lite_subsystem.gni @@ -0,0 +1,99 @@ +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Defines a subsystem +# +# The lite_subsystem template defines all the modules contained in a subsystem +# +# Parameters +# +# subsystem_components (required) +# [list of scopes] Defines all modules in the subsystem. +# +template("lite_subsystem") { + assert(defined(invoker.subsystem_components), "subsystem_components in required.") + + lite_subsystem_components = invoker.subsystem_components + + group(target_name) { + deps = [] + if(defined(invoker.deps)) { + deps += invoker.deps + } + # add subsystem packages + foreach(pkg_label, lite_subsystem_components) { + deps += [ pkg_label ] + } + } +} + +template("lite_subsystem_test") { + assert(defined(invoker.subsystem_components), "subsystem_components in required.") + + lite_subsystem_components = invoker.subsystem_components + + group(target_name) { + deps = [] + if(defined(invoker.deps)) { + deps += invoker.deps + } + # add subsystem packages + foreach(pkg_label, lite_subsystem_components) { + deps += [ pkg_label ] + } + } +} + +template("lite_subsystem_sdk") { + assert(defined(invoker.interface_header), "interface_header in required.") + assert(defined(invoker.sdk_libs_path), "sdk_libs_path in required.") + assert(defined(invoker.subsystem_name), "subsystem_name in required.") + + interface_header = invoker.interface_header + sdk_libs_path = invoker.sdk_libs_path + subsystem_name = invoker.subsystem_name + deps = [ ":${subsystem_name}" ] + + outdir = rebase_path("$root_out_dir/${subsystem_name}") + prebuilts = "mkdir -p $outdir/interface $outdir/sdk_libs" + command = "cp -r $interface_header $outdir/interface && cp -r $sdk_libs_path $outdir/sdk_libs" + exec_path = rebase_path(".", root_build_dir) + action(target_name){ + args = [ + "--path=$exec_path", + "--prebuilts=$prebuilts", + "--command=$command", + "--enable=$LOSCFG_SDK_BUILD" + ] + script = "//build/lite/build_ext_components.py" + outputs = [ "$target_out_dir/sdk_build_file_log.txt" ] + } +} + +template("lite_vendor_sdk") { + prebuilts = invoker.prebuilts + command = invoker.command + exec_path = rebase_path(".", root_build_dir) + action(target_name){ + args = [ + "--path=$exec_path", + "--prebuilts=$prebuilts", + "--command=$command", + "--enable=$LOSCFG_SDK_BUILD" + ] + script = "//build/lite/build_ext_components.py" + outputs = [ "$target_out_dir/sdk_build_file_log.txt" ] + } +} diff --git a/config/test.gni b/config/test.gni new file mode 100755 index 0000000..e477b2e --- /dev/null +++ b/config/test.gni @@ -0,0 +1,102 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# liteos c test template + +test_common_include_dirs = [ + "//third_party/googletest/googletest/include", +] + +test_liteos_include_dirs = [ + "//utils/native/lite/include", + "//drivers/liteos/platform/board/hisi/common", + "//kernel/liteos_a/kernel/include", + "//third_party/bounds_checking_function/include", +] + +template("unittest") { + executable(target_name) { + output_dir = "${root_out_dir}/test/unittest" + forward_variables_from(invoker,"*") + if (!defined(include_dirs)) { + include_dirs = [] + } + include_dirs += test_common_include_dirs + if (ohos_kernel_type == "liteos_a") { + include_dirs += test_liteos_include_dirs + } + if (!defined(deps)) { + deps = [] + } + if (ohos_kernel_type == "liteos_a") { + deps += [ + "//test/developertest/third_party/lib/cpp:gtest_main", + ] + } + if (!defined(configs)) { + configs = [] + } + cflags = [ "-Wno-error" ] + ldflags = [] + if(defined(invoker.ldflags)) { + ldflags += invoker.ldflags + } + if (ohos_build_compiler != "clang") { + ldflags += [ "-lstdc++" ] + } + } +} + +template("moduletest") { + executable(target_name) { + output_dir = "${root_out_dir}/test/moduletest" + forward_variables_from(invoker, "*") + if (!defined(include_dirs)) { + include_dirs = [] + } + include_dirs += test_common_include_dirs + if (ohos_kernel_type == "liteos_a") { + include_dirs += test_liteos_include_dirs + } + if (!defined(deps)) { + deps = [] + } + if (ohos_kernel_type == "liteos_a") { + deps += [ + "//test/developertest/third_party/lib/cpp:gtest_main", + ] + } + if (!defined(configs)) { + configs = [] + } + cflags = [ "-Wno-error" ] + ldflags = [] + if(defined(invoker.ldflags)) { + ldflags += invoker.ldflags + } + if (ohos_build_compiler != "clang") { + ldflags += [ "-lstdc++" ] + } + } +} + +template("subsystem_test") { + assert(defined(invoker.test_components), "Test Components is required.") + group(target_name) { + deps = [] + if(defined(invoker.test_components)) { + deps += invoker.test_components + } + } +} diff --git a/config_convert.py b/config_convert.py new file mode 100755 index 0000000..d73a80d --- /dev/null +++ b/config_convert.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import shutil +from utils import file_write +from utils import CallbackDict, makedirs +from utils import read_json_file + + +def args_gn_create(config): + # Delete and create output directory + out_path = config.get_out_path() + if os.path.exists(out_path): + shutil.rmtree(out_path) + makedirs(out_path) + + +def args_gn_write(config): + product_args_path = os.path.join(config.get_out_path(), 'args.gn') + ndk = config.ndk + build_type = config.build_type + + file_write(product_args_path, 'at', 'product = "{}"\n'.format( + config.product)) + # Add import to the file header + if ndk is not None: + ndk_gn_args = ('ohos_build_ndk = true\n' + 'ohos_build_ndk_target_host = "{}"' + '\n'.format(ndk)) + file_write(product_args_path, 'at', ndk_gn_args) + if config.test_args: + file_write(product_args_path, 'at', + 'ohos_xts_test_args = "{}"\n'.format(config.test_args[1])) + file_write(product_args_path, 'at', + 'ohos_build_type = "{}"\n'.format(build_type)) + for feature in CallbackDict.args_list: + file_write(product_args_path, 'at', '{}\n'.format(feature)) + + +def load_subsystem_feature(config): + product = config.product + product_json = os.path.join(os.path.dirname(os.path.abspath(__file__)), + 'product', '{}.json'.format(product)) + json_content = read_json_file(product_json) + for subsystem in json_content['subsystem']: + for component in subsystem['component']: + for feature in component['features']: + CallbackDict.args_list.append(feature) + + +def config_create(**kwargs): + config = kwargs['config'] + args_gn_create(config) + load_subsystem_feature(config) + args_gn_write(config) + return True diff --git a/copy_files.py b/copy_files.py new file mode 100755 index 0000000..300bc40 --- /dev/null +++ b/copy_files.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import argparse +import os +import shutil +import sys +from utils import makedirs + + +def copytree(src, dst, symlinks=False, ignore=None): + for item in os.listdir(src): + if '.git' in item or '.repo' in item: + continue + src_path = os.path.join(src, item) + dst_path = os.path.join(dst, item) + if os.path.isdir(src_path): + try: + shutil.copytree(src_path, dst_path, symlinks) + except Exception as e: + print('Warning :{}\nIgnore invalid symlink!'.format( + str(e.args[0]))) + else: + shutil.copy2(src_path, dst_path) + + +def main(): + parser = argparse.ArgumentParser( + description='A common diretory and file copy.') + parser.add_argument( + '--src_type', + help='src tyepe to copy.') + parser.add_argument( + '--src', + help='List the sources to copy.', + required=True) + parser.add_argument( + '--dest_dir', + help='Path that the sources should be copied to.', + required=True) + + args = parser.parse_args() + + out_dir = args.dest_dir + if not os.path.exists(out_dir): + makedirs(out_dir) + + if args.src_type == "file" or os.path.isfile(args.src): + shutil.copy(args.src, out_dir) + return 0 + + source_dir = args.src + assert os.path.exists(source_dir) + + copytree(source_dir, out_dir) + + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/filter.py b/filter.py new file mode 100755 index 0000000..9c37e68 --- /dev/null +++ b/filter.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from utils import CallbackDict +from filter_process import code_filter + + +def add_options(parser): + parser.add_argument('-c', '--config', help='Config for code filtering', + nargs='*') + parser.add_argument('--no_commit_msg', help='Remove commit msg', + action='store_true') + parser.add_argument('-p', '--path', help='Code targer path after ' + 'filtering out', nargs='*') + + +def exec_command(args): + callback_dict = CallbackDict() + target = 'filter' + + if args.config: + callback_dict.config = args.config[0] + no_commit_msg = args.no_commit_msg + if args.path: + target_path = args.path[0] + else: + target_path = 'ohos_opensource' + + callback_dict.register(target, code_filter) + + callback_dict.excute(target, + callback_dict=callback_dict, + no_commit_msg=no_commit_msg, + target_path=target_path) diff --git a/filter_process.py b/filter_process.py new file mode 100755 index 0000000..589dca0 --- /dev/null +++ b/filter_process.py @@ -0,0 +1,156 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import sys +import os +import shutil +from utils import read_json_file +from xml.etree.ElementTree import parse +from utils import remove_path + + +def is_opensource(bundle): + """Get opensource infomation from bundle.json.""" + bundle_data = read_json_file(bundle) + bundle_publish = bundle_data.get('publishAs') + if not bundle_publish: + raise Exception('Could not find "publishAs" in {}'.format(bundle)) + + if bundle_publish == 'source': + return True + + return False + + +def filter_out_code(code_path): + if not os.path.exists(code_path): + raise Exception('Could not find code path: {}'.format(code_path)) + shutil.rmtree(code_path) + + +def get_source_list(tag): + if tag is None: + return None + + source_list = [] + for source in tag.iterfind('project'): + path = source.attrib['path'] + source_list.append(path) + + return source_list + + +def get_filter_list(xml): + """Parse the config xml and get selected code path.""" + filter_xml = parse(xml) + opensource_tag = filter_xml.find('opensource') + non_opensource_tag = filter_xml.find('non_opensource') + + opensource_list = get_source_list(opensource_tag) + non_opensource_list = get_source_list(non_opensource_tag) + + return opensource_list, non_opensource_list + + +def check_ignore(no_commit_msg): + if no_commit_msg: + ignore = shutil.ignore_patterns('.git', '.repo') + else: + ignore = None + + return ignore + + +def filter_by_bundle(config, path, no_commit_msg): + """Filter out code by bundle.json in every code repository.""" + cwd_path = os.getcwd() + ignore = check_ignore(no_commit_msg) + shutil.copytree(cwd_path, path, symlinks=False, ignore=ignore) + + for relpath, dirs, files in os.walk(path): + if config in files: + full_path = os.path.join(path, relpath, config) + bundle_path = os.path.normpath(os.path.abspath(full_path)) + if not is_opensource(bundle_path): + code_path = os.path.join(path, relpath) + filter_out_code(code_path) + + +def filter_by_path(config, path, no_commit_msg): + """Filter out code by the config.""" + if not os.path.exists(config): + raise Exception("Could not find config: {}".format(config)) + opensouce_list, non_opensource_list = get_filter_list(config) + + # remove target path if exsits + remove_path(path) + cwd_path = os.getcwd() + ignore = check_ignore(no_commit_msg) + + # copy opensource code directly + if opensouce_list: + for each in opensouce_list: + source_path = os.path.join(cwd_path, each) + dst_path = os.path.join(path, each) + if os.path.isfile(source_path): + shutil.copy(source_path, dst_path) + else: + try: + shutil.copytree(source_path, dst_path, symlinks=False, + ignore=ignore) + except Exception as e: + print(e.args[0]) + + if non_opensource_list: + for source_code in non_opensource_list: + source_path = os.path.join(path, source_code) + if os.path.exists(source_path): + shutil.rmtree(source_path) + # copy whole source code to target path and remove selected code in config + elif non_opensource_list: + shutil.copytree(cwd_path, path, symlinks=False, ignore=ignore) + for source_code in non_opensource_list: + source_path = os.path.join(path, source_code) + if os.path.exists(source_path): + shutil.rmtree(source_path) + + +def code_filter(**kwargs): + """ + description: Filter out code by config or bundle.json + param: + callback_dict: building class, contains the path of config + or bundle.json + no_commit_msg: true if remove git message, like .git and .repo + target_path: target code path after filtering out + return: NA + """ + callback_dict = kwargs['callback_dict'] + no_commit_msg = kwargs['no_commit_msg'] + target_path = kwargs['target_path'] + + if callback_dict.config is None: + target_config = 'bundle.json' + filter_by_bundle(target_config, target_path, no_commit_msg) + else: + target_config = callback_dict.config + filter_by_path(target_config, target_path, no_commit_msg) + + +if __name__ == "__main__": + sys.exit(0) diff --git a/gen_module_notice_file.py b/gen_module_notice_file.py new file mode 100755 index 0000000..d4284e3 --- /dev/null +++ b/gen_module_notice_file.py @@ -0,0 +1,181 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import sys +import argparse +import os +from utils import read_json_file +from utils import makedirs +from utils import encode +from utils import decode + + +def is_top_dir(src_path): + return os.path.exists(os.path.join(src_path, '.gn')) + + +def find_config_parent_file(src_dir, target_cfg): + if (not os.path.isdir(src_dir)) or is_top_dir(src_dir): + return '' + for file in os.listdir(src_dir): + file_path = os.path.join(src_dir, file) + if os.path.isfile(file_path): + if os.path.basename(file_path) == target_cfg: + return src_dir + return find_config_parent_file(os.path.dirname(src_dir), target_cfg) + + +def get_notice_file_name(readme_file_path, copyright_file, + module_relative_src_path): + if not os.path.exists(readme_file_path) or os.path.isdir(readme_file_path): + return '', '', '', '' + + opensource_config = read_json_file(readme_file_path) + if opensource_config is None: + return '', '', '', '' + + license_file = '' + license_name = None + software_name = None + for info in opensource_config: + license_file = info.get('License File') + license_name = info.get('License') + software_name = '{} {}'.format(info.get('Name'), info.get('Version Number')) + + license_file_path = os.path.join(os.path.dirname(readme_file_path), + license_file.strip()) + if not os.path.exists(license_file_path): + return '', '', '', '' + + copyright_file_path = os.path.join(os.path.dirname(copyright_file), + copyright_file.strip()) + if not os.path.exists(copyright_file_path): + return '', '', '', '' + + return license_file_path, license_name, software_name, copyright_file_path + + +def get_opensource_config_file(module_source_dir, root_out_dir, target_cfg): + config_file = '' + + expect_file = os.path.join(module_source_dir, target_cfg) + if os.path.exists(expect_file): + config_file = expect_file + else: + relpath = os.path.relpath(module_source_dir, root_out_dir) + parent_cfg_dir = find_config_parent_file(os.path.dirname(relpath), + target_cfg) + if parent_cfg_dir != '': + config_file = os.path.join(parent_cfg_dir, target_cfg) + + return config_file + + +def get_notice_file(module_source_dir, root_out_dir, + module_relative_source_dir): + cfg_file = get_opensource_config_file(module_source_dir, root_out_dir, + 'README.OpenSource') + copyright_file = get_opensource_config_file(module_source_dir, + root_out_dir, + 'COPYRIGHT.OpenSource') + + if cfg_file == '': + return '', '', '', '' + if copyright_file == '': + return '', '', '', '' + return get_notice_file_name(cfg_file, copyright_file, + module_relative_source_dir) + + +def get_notice_file_dest_path(root_out_dir, target_name): + nf_dest_list = [] + nf_dest_dir = os.path.join(root_out_dir, 'NOTICE_FILE', target_name) + + license_num = 1 + while os.path.exists(os.path.join(nf_dest_dir, + "LICENSE{}.txt".format(license_num))): + license_num += 1 + + nf_dest_list.append(os.path.join(nf_dest_dir, + "LICENSE{}.txt".format(license_num))) + return nf_dest_list + + +def create_dest_file(filename): + dir_name = os.path.dirname(filename) + if not os.path.exists(dir_name): + makedirs(dir_name) + + +def gen_license(target_path, nf_dict, nf_src, cp_src): + target_license_path = os.path.join(target_path, 'NOTICE') + makedirs(target_path) + + with open(nf_src, 'rt') as f: + nf_dict["license_content"] = decode(f.read()) + with open(cp_src, 'rt') as f: + nf_dict["copyright"] = decode(f.read()) + + with open(target_license_path, 'at') as f: + f.write("Software: {}\n\n".format(encode(nf_dict["software"]))) + f.write("Copyright notice: \n{}\n".format( + encode(nf_dict["copyright"]))) + f.write("License: {}\n{}\n\n".format( + encode(nf_dict["license_name"]), + encode(nf_dict["license_content"]))) + + +def generate_notice_file(root_out_dir, module_source_dir, + module_relative_source_dir, target_name): + nf_src = '' + nf_dict = { + "software": '', + "copyright": '', + "license_name": '', + "license_content": '' + } + + nf_src, nf_dict["license_name"], nf_dict["software"], cp_src = \ + get_notice_file(module_source_dir, root_out_dir, + module_relative_source_dir) + target_path = os.path.join(root_out_dir, 'NOTICE_FILE', target_name) + if os.path.exists(nf_src) and os.path.exists(cp_src): + gen_license(target_path, nf_dict, nf_src, cp_src) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--root-out-dir', help='', required=True) + parser.add_argument('--module-source-dir', help='', required=True) + parser.add_argument('--module-relative-source-dir', help='', required=True) + parser.add_argument('--target-name', help='', required=True) + args = parser.parse_args() + + if 'third_party/' not in args.module_relative_source_dir: + return 0 + + generate_notice_file(args.root_out_dir, + args.module_source_dir, + args.module_relative_source_dir, + args.target_name) + + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/gen_rootfs.py b/gen_rootfs.py new file mode 100755 index 0000000..ff8d49e --- /dev/null +++ b/gen_rootfs.py @@ -0,0 +1,352 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys +import os +import shutil +import argparse +from utils import exec_command +from utils import makedirs +import platform +import tarfile + + +def move_file(old_path, new_path): + if os.path.exists(old_path): + shutil.copytree(old_path, new_path) + + +def is_needed_copy(file, ignore_list): + for ignore in ignore_list: + if file.endswith(ignore): + return False + + return True + + +def copy(source, target, ignore_list): + for file in os.listdir(source): + if is_needed_copy(file, ignore_list) and \ + os.path.isfile(os.path.join(source, file)): + source_file = os.path.join(source, file) + shutil.copy(source_file, target) + + +def mv_usr_libs(path): + libs = [lib for lib in os.listdir(path) if lib.startswith('lib') and + lib.endswith('.so')] + target_path = os.path.join(path, 'libs/usr') + if not os.path.exists(target_path): + makedirs(target_path) + for lib in libs: + source_file = os.path.join(path, lib) + shutil.move(source_file, target_path) + + +def check_strip(path, strip_cmd, log): + if strip_cmd == "": + return + strip_cmd_list = strip_cmd.split(" ") + for relpath, _, files in os.walk(path): + for file in files: + full_path = os.path.join(path, relpath, file) + if os.path.isfile(full_path): + cmd = strip_cmd_list + [full_path] + exec_command(cmd, log_path=log) + + +def tee_into_userfs(output_path, userfs): + vendor_bin_source_dir = os.path.join(output_path, 'vendor/bin') + if not os.path.exists(vendor_bin_source_dir): + return + sec_storage_dir = os.path.join(userfs, 'data/sec_storage_data') + makedirs(sec_storage_dir) + + sec_storage_root_dir = os.path.join(userfs, 'sec_storage') + makedirs(sec_storage_root_dir) + + +def list_all_files(rootdir): + _files = [] + filelist = os.listdir(rootdir) + for i in filelist: + path = os.path.join(rootdir, i) + if os.path.isdir(path): + _files.append(path) + _files.extend(list_all_files(path)) + if os.path.isfile(path): + _files.append(path) + + return _files + + +def chmod_files_mode(root_dir, dir_mode, file_mode): + if os.path.isdir(root_dir): + os.chmod(root_dir, dir_mode) + filelist = list_all_files(root_dir) + for i in filelist: + if os.path.isdir(i): + os.chmod(i, dir_mode) + if os.path.isfile(i): + os.chmod(i, file_mode) + + +def change_rootfs_filemode(path): + # change all files filemode + chmod_files_mode(path, 493, 365) + # change special dirs filemode + tmppath = os.path.join(path, "bin") + if os.path.exists(tmppath): + chmod_files_mode(tmppath, 365, 365) + tmppath = os.path.join(path, "usr") + if os.path.exists(tmppath): + chmod_files_mode(tmppath, 365, 365) + tmppath = os.path.join(path, "lib") + if os.path.exists(tmppath): + chmod_files_mode(tmppath, 365, 365) + tmppath = os.path.join(path, "vendor") + if os.path.exists(tmppath): + chmod_files_mode(tmppath, 365, 292) + tmppath = os.path.join(path, "system") + if os.path.exists(tmppath): + chmod_files_mode(tmppath, 365, 292) + tmppath = os.path.join(path, "etc") + if os.path.exists(tmppath): + chmod_files_mode(tmppath, 365, 292) + tmppath = os.path.join(path, "vendor/bin") + if os.path.exists(tmppath): + chmod_files_mode(tmppath, 365, 365) + # change special files filemode + tmppath = os.path.join(path, "etc/init.cfg") + if os.path.exists(tmppath): + os.chmod(tmppath, 256) + tmppath = os.path.join(path, "bin/init") + if os.path.exists(tmppath): + os.chmod(tmppath, 320) + tmppath = os.path.join(path, "bin/shell") + if os.path.exists(tmppath): + os.chmod(tmppath, 320) + + +def create_file_symlink(file_name, src_dir, dst_dir): + src = os.path.join(src_dir, file_name) + dst = os.path.join(dst_dir, file_name) + tmppath = os.path.join("/usr/lib/", file_name) + if os.path.exists(src): + os.symlink(tmppath, dst) + + +def create_symlinks_for_dv(path): + src_path = os.path.join(path, "usr/lib") + dst_path = os.path.join(path, "lib") + create_file_symlink("libmbedtls_shared.so", src_path, dst_path) + create_file_symlink("libcjson_shared.so", src_path, dst_path) + create_file_symlink("libsys_parameter.so", src_path, dst_path) + create_file_symlink("libsec_shared.so", src_path, dst_path) + create_file_symlink("libsamgr.so", src_path, dst_path) + create_file_symlink("libliteipc_adapter.so", src_path, dst_path) + create_file_symlink("libhilog_a_shared.so", src_path, dst_path) + + +def change_rootfs_filemode_linux(path): + tmppath = os.path.join(path, "lib") + chmod_files_mode(tmppath, 493, 420) + tmppath = os.path.join(path, "lib/ld-uClibc-0.9.33.2.so") + if os.path.exists(tmppath): + os.chmod(tmppath, 365) + tmppath = os.path.join(path, "lib/ld-2.24.so") + if os.path.exists(tmppath): + os.chmod(tmppath, 365) + tmppath = os.path.join(path, "usr") + os.chmod(tmppath, 493) + tmppath = os.path.join(path, "usr/lib") + chmod_files_mode(tmppath, 493, 420) + tmppath = os.path.join(path, "etc/init.cfg") + os.chmod(tmppath, 256) + if "dv300" in path: + create_symlinks_for_dv(path) + + +def change_userfs_filemode(path): + # change all files filemode + chmod_files_mode(path, 493, 365) + # change special files filemode + tmppath = os.path.join(path, "etc/cameradev.ini") + if os.path.exists(tmppath): + os.chmod(tmppath, 420) + + +def remove_file_in_rootfs(output_path): + rootfs_app = os.path.join(output_path, 'rootfs/app') + rootfs_data = os.path.join(output_path, 'rootfs/data') + if os.path.exists(rootfs_app): + shutil.rmtree(rootfs_app) + if os.path.exists(rootfs_data): + shutil.rmtree(rootfs_data) + + +def make_rootfs_tar(tar_filename, source_dir): + with tarfile.open(tar_filename, "w") as tar: + tar.add(source_dir, arcname=os.path.basename(source_dir)) + + +def gen_rootfs(mkfs, fstype, output_path, rootfs_dirs_dict, kernel): + mv_usr_libs(output_path) + rootfs = os.path.join(output_path, 'rootfs') + rootfs_tar = os.path.join(output_path, 'rootfs.tar') + if not os.path.exists(rootfs): + print('rootfs dir not exist in {}'.format(rootfs)) + return 0 + + log = os.path.join(output_path, 'build.log') + for path_part, value_list in rootfs_dirs_dict.items(): + source_path = os.path.join(output_path, path_part) + target_path = os.path.join(rootfs, value_list[0]) + strip_cmd = value_list[2] + if os.path.exists(source_path): + if not os.path.exists(target_path): + makedirs(target_path) + ignore_list = value_list[1] + copy(source_path, target_path, ignore_list) + + check_strip(target_path, strip_cmd, log) + + if kernel == "linux": + change_rootfs_filemode_linux(rootfs) + cmd = [mkfs, rootfs, "jffs2"] + exec_command(cmd, log_path=log) + if kernel == "liteos_a": + remove_file_in_rootfs(output_path) + change_rootfs_filemode(rootfs) + cmd = [mkfs, rootfs, fstype] + exec_command(cmd, log_path=log) + make_rootfs_tar(rootfs_tar, rootfs) + if os.path.exists(rootfs): + chmod_files_mode(rootfs, 511, 511) + shutil.rmtree(rootfs) + + return 0 + + +def make_userfs_dir(dir_path): + if not os.path.exists(dir_path): + makedirs(dir_path) + if not os.path.exists(dir_path): + print('make' + str(dir_path) + 'fail') + return -1 + + +def move_rootfs_to_userfs(output_path): + rootfs_app = os.path.join(output_path, 'rootfs/app') + rootfs_data = os.path.join(output_path, 'rootfs/data') + userfs_app = os.path.join(output_path, 'userfs/app') + userfs_data = os.path.join(output_path, 'userfs/data') + move_file(rootfs_app, userfs_app) + move_file(rootfs_data, userfs_data) + + +def gen_userfs(mkfs, fstype, output_path, userfs_dirs_dict): + userfs = os.path.join(output_path, 'userfs') + userfs_etc = os.path.join(output_path, 'userfs/etc') + if make_userfs_dir(userfs): + return 0 + if make_userfs_dir(userfs_etc): + return 0 + move_rootfs_to_userfs(output_path) + log = os.path.join(output_path, 'build.log') + tee_into_userfs(output_path, userfs) + for path_part, value_list in userfs_dirs_dict.items(): + source_path = os.path.join(output_path, path_part) + target_path = os.path.join(userfs, value_list[0]) + strip_cmd = value_list[2] + if os.path.exists(source_path): + if not os.path.exists(target_path): + makedirs(target_path) + ignore_list = value_list[1] + copy(source_path, target_path, ignore_list) + + check_strip(target_path, strip_cmd, log) + change_userfs_filemode(userfs) + if fstype == "vfat": + cmd = [mkfs, userfs, fstype, '52428800'] + else: + cmd = [mkfs, userfs, fstype] + exec_command(cmd, log_path=log) + return 0 + + +def main(): + parser = argparse.ArgumentParser(description='Generate rootfs') + parser.add_argument('--path', help='Build output path') + parser.add_argument('--board', help='Board type') + parser.add_argument('--kernel', help='OHOS kernel type') + parser.add_argument('--compile_so', help='So strip command') + parser.add_argument('--compile_bin', help='Bin strip command') + args = parser.parse_args() + + if args.board == 'hi3861v100': + return + + if args.path: + output_path = os.path.abspath(args.path) + mkfs = os.path.join( + output_path, + '../../kernel/liteos_a/tools/scripts/make_rootfs/rootfsimg.sh') + if not os.path.exists(mkfs): + print('mkfs not exist in {}'.format(mkfs)) + return -1 + else: + return -1 + + if args.board: + if args.board == 'hi3516dv300': + fstype = 'vfat' + else: + fstype = 'jffs2' + else: + return -1 + + so_strip_cmd = args.compile_so + bin_strip_cmd = args.compile_bin + kernel = args.kernel + + rootfs_dirs_dict = { + 'bin': ['bin', ['Test.bin', 'TestSuite.bin'], bin_strip_cmd], + 'libs': ['lib', ['.a'], so_strip_cmd], + 'libs/usr': ['usr/lib', ['.a'], so_strip_cmd], + 'bin/usr': ['usr/bin', [], bin_strip_cmd], + 'vendor/bin': ['vendor/bin', [], ""], + 'vendor/lib': ['vendor/lib', [], ""], + 'vendor/firmware/hisilicon': ['vendor/firmware/hisilicon', [], ""], + 'obj/vendor/huawei/camera/init_configs/config': ['etc', [], ""], + 'system/internal': ['system/internal', [], ""], + 'etc': ['etc', [], ""] + } + userfs_dirs_dict = { + 'obj/base/security/services/app_verify/config': + ['data/verify', [], ""], + 'storage/etc': ['etc', [], ""], + 'data': ['data', [], ""] + } + if kernel == "liteos_a": + ret = gen_userfs(mkfs, fstype, output_path, userfs_dirs_dict) + if ret: + return -1 + return gen_rootfs(mkfs, fstype, output_path, rootfs_dirs_dict, kernel) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/gn_scripts.py b/gn_scripts.py new file mode 100755 index 0000000..d0bf250 --- /dev/null +++ b/gn_scripts.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import argparse +from datetime import datetime +import time +import sys + + +def get_build_time(): + build_time = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S,%f") + time_seconds, micro_seconds = build_time.split(',') + time_array = time.strptime(time_seconds, "%Y-%m-%d %H:%M:%S") + print(int(time.mktime(time_array) * 1000 + int(micro_seconds) * 10)) + return 0 + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('-t', '--time', help='Get build time', + action='store_true') + + args = parser.parse_args() + + if args.time: + return get_build_time() + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/ndk/BUILD.gn b/ndk/BUILD.gn new file mode 100755 index 0000000..c185a13 --- /dev/null +++ b/ndk/BUILD.gn @@ -0,0 +1,113 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/lite/ndk/ndk.gni") + +ndk_toolchains("build_script") +{ + src_type = "file" + src_dir = [ + "//build/lite/ndk/build/BUILD.gn", + "//build/lite/ndk/build/build.py", + "//build/lite/ndk/README.md", + "//build/lite/ndk/build/.gn", + ] + dest_dir = [ + "$root_out_dir/ndk", + "$root_out_dir/ndk", + "$root_out_dir/ndk", + "$root_out_dir/ndk/build", + ] +} + +ndk_toolchains("source") { + src_dir = [ + "//build/lite/ndk/sample", + "//build/lite/ndk/build/config", + "//build/lite/ndk/build/toolchain" + ] + dest_dir = [ + "$root_out_dir/ndk/sample", + "$root_out_dir/ndk/build/config", + "$root_out_dir/ndk/build/toolchain" + ] + if (ohos_build_compiler == "clang") { + src_dir += [ + "//prebuilts/lite/sysroot/usr/lib", + "//prebuilts/lite/sysroot/usr/include" + ] + dest_dir += [ + "$root_out_dir/ndk/sysroot/usr/lib", + "$root_out_dir/ndk/sysroot/usr/include" + ] + } +} + +group("ndk_build") { + deps = [ + ":source", + ":build_script", + "//foundation/communication/services/softbus_lite:softbus_lite_ndk", + "//base/startup/services/bootstrap_lite:bootstrap_lite_ndk", + "//utils/native/lite:native_api", + "//base/startup/frameworks/syspara_lite/parameter:parameter_notes", + ] + if (ohos_kernel_type != "liteos_riscv") { + deps += [ + "//base/security/interfaces/kits/iam_lite:permission_notes", + "//base/hiviewdfx/frameworks/hilog_lite/featured:hilog_ndk", + "//foundation/distributedschedule/services/samgr_lite:samgr_lite_ndk", + "//foundation/graphic/lite:ndk_build", + "//foundation/aafwk/frameworks/ability_lite:ability_notes", + "//foundation/appexecfwk/frameworks/bundle_lite:bundle_notes", + "//foundation/multimedia/services/media_lite:media_ndk", + "//base/startup/frameworks/syspara_lite/token:token_notes", + "//foundation/communication/frameworks/ipc_lite:liteipc_ndk", + "//third_party/mbedtls:mbedtls_ndk", + "//third_party/cJSON:cjson_ndk", + "//drivers/hdf/lite/hdi:native_api", + "//third_party/wpa_supplicant/wpa_supplicant-2.9:wpa_supplicant", + ] + if (ohos_build_type == "debug") { + deps += [ + "//prebuilts/lite/sysroot/apidoc:lite_kernel_ndk" + ] + } + } else { + deps += [ + "$ohos_vendor_adapter_dir/hals/communication/wifi_lite/wifiservice:wifiservice_ndk", + "//base/iot_hardware/frameworks/wifiiot_lite/src:iothardware_ndk", + "//prebuilts/lite/sysroot/apidoc:lite_kernel_ndk", + "//base/hiviewdfx/frameworks/hilog_lite/mini:hilog_lite_ndk", + ] + } +} + +action("ndk") { + if (ohos_build_ndk) { + deps = ["doc"] + script = "//build/lite//ndk/archive_ndk.py" + depfile = "${target_gen_dir}/${target_name}.d" + ndk_name = + "$ohos_build_ndk_target_host-$ohos_build_compiler-$ohos_build_ndk_version" + args = [ + "--src_dir", + rebase_path("$root_build_dir/ndk"), + "--name", + ndk_name, + "--dest_dir", + rebase_path("$root_build_dir/packages/ndk") + ] + outputs = [ "$root_build_dir/packages/ndk/$ndk_name.zip" ] + } +} diff --git a/ndk/README.md b/ndk/README.md new file mode 100755 index 0000000..eee5cc2 --- /dev/null +++ b/ndk/README.md @@ -0,0 +1,128 @@ +# 轻鸿蒙NDK使用指南 + +## 简介 + +NDK = Native Development Kit, 主要包括系统提供的c/c++接口库文件,编译工具链,工具和接口描述文档。 + +## 目录结构 + +├── build **编译框架** +│ ├── config +│ └── toolchain +├── doc **native api接口描述文档** +├── gcc **编译工具链** +│ ├── arm-linux-ohoseabi -> arm-linux-musleabi +│ ├── arm-linux-musleabi +│ ├── bin +│ ├── host_bin +│ ├── lib +│ ├── libexec +│ ├── runtime_musl +│ └── target +├── prebuilts **构建工具** +│ └── build-tools +├── sample **用户编译样例** +│ ├── include +│ └── src +└── sysroot **Native API** + └── usr + +## 编译框架 + +### 编译命令 + +编译使用gn构建系统,在根目录执行:`python build.py`即可启动编译。支持的命令如下: + +**build:** `python build.py ` 或 ``python build.py build` + +**clean:** `python build.py clean` + +**debug/release**:`python build.py -v debug/release` + +debug和release版本的区别: + +debug版本:-g + +release版本:-O2 + strip符号表 + +### 默认编译选项 + +1、安全编译选项:-fstack-protector-all,PIE,PIC,_FORTIFY_SOURCE=2,-Wl,-z,now,-Wl,-z,relro,-Wl,-z,noexecstack + +2、告警级别:-Werror + +### 应用编译示例 + +1、创建应用目录,并在目录下创建BUILD.gn: + +``` +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +static_library("hello_world") { # 应用库文件target,也可是shared_library + sources = [ + "src/hello_world.c", + ] + + include_dirs = [ + "include", + ] +} + +executable("sample") { # 应用可执行文件target + ldflags = [ + "-lsys_parameter", # 应用需要使用的库 + "-lsec_shared" + ] + deps = [ + ":hello_world", + ] +} + +``` + +2、将sample加入到编译入口,编译入口为根目录下的BUILD.gn: + +``` +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/toolchain/${ohos_build_compiler}.gni") + +group("ohos") { + deps = [] + if (target_os == "ohos") { + deps += [ + "//sample" # 新加的应用 + ] + } +} +``` + +3、编译输出:out/bin + +## 烧录和运行 + +1、请先烧录内核和文件系统 + +2、将应用程序nfs或者tftp到usr/bin目录下, 运行即可 \ No newline at end of file diff --git a/ndk/archive_ndk.py b/ndk/archive_ndk.py new file mode 100755 index 0000000..1167461 --- /dev/null +++ b/ndk/archive_ndk.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import argparse +import os +import sys +import shutil +sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir)) +from utils import makedirs # noqa: E402 + + +def make_archive(source, destination): + base = os.path.basename(destination) + fields = base.split('.') + name = fields[0] + '.' + fields[1] + '.' + fields[2] + file_format = fields[3] + archive_from = os.path.dirname(source) + archive_to = os.path.basename(source.strip(os.sep)) + print('Zipping: ', source, destination, archive_from, archive_to) + shutil.make_archive(name, file_format, archive_from, archive_to) + shutil.move('%s.%s' % (name, file_format), destination) + + +def main(): + parser = argparse.ArgumentParser( + description='NDK archive tool.') + parser.add_argument( + '--src_dir', + help='NDK source path.', + required=True) + parser.add_argument( + '--name', + help='NDK name.', + required=True) + parser.add_argument( + '--dest_dir', + help='NDK zip dest path.', + required=True) + args = parser.parse_args() + + src = args.src_dir + assert os.path.exists(src), \ + 'NDK build diretory not exist, please confirm NDK build result.' + + dest = args.dest_dir + if not os.path.exists(dest): + makedirs(dest) + else: + shutil.rmtree(dest) + + name = args.name + print(dest, name) + make_archive(src, dest + '-' + name + '.zip') + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/ndk/build/.gn b/ndk/build/.gn new file mode 100755 index 0000000..f2d72b4 --- /dev/null +++ b/ndk/build/.gn @@ -0,0 +1,15 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# The location of the build configuration file. +buildconfig = "//build/config/BUILDCONFIG.gn" diff --git a/ndk/build/BUILD.gn b/ndk/build/BUILD.gn new file mode 100755 index 0000000..efa7238 --- /dev/null +++ b/ndk/build/BUILD.gn @@ -0,0 +1,23 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/toolchain/${ohos_build_compiler}.gni") + +group("ohos") { + deps = [] + if (target_os == "ohos") { + deps += [ + "//sample" + ] + } +} \ No newline at end of file diff --git a/ndk/build/build.py b/ndk/build/build.py new file mode 100755 index 0000000..2f555b9 --- /dev/null +++ b/ndk/build/build.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import sys +import argparse +import platform +import subprocess +import time + + +def exec_command(cmd, log_path='out/build.log', **kwargs): + process = subprocess.Popen(cmd) + process.wait() + ret_code = process.returncode + + if ret_code != 0: + raise Exception("{} failed, return code is {}".format(cmd, ret_code)) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('action', help='action, build or clean path.', + nargs='*') + parser.add_argument('-v', '--build_type', help='Release or debug version.', + nargs='*') + args = parser.parse_args() + + product_path = './out/' + log_path = os.path.join(product_path, 'compile.log') + + args.action = ['build'] if not args.action else args.action + + if args.action[0] == 'build': + gn_cmd = '' + ninja_cmd = '' + print("\n=== start build ===\n") + if platform.system().find('Windows') == 0: + gn_cmd = ['gn.exe', 'gen', product_path, '--root=.', + '--dotfile=build/.gn'] + + ninja_cmd = ['ninja.exe', + '-C', product_path] + else: + gn_cmd = ['gn', 'gen', product_path, '--root=.', + '--dotfile=build/.gn'] + if args.build_type == 'debug': + gn_cmd += ['--args=ohos_build_type=\"debug\"'] + + ninja_cmd = ['ninja', '-C', product_path] + print("=== gn working ===\n") + exec_command(gn_cmd, log_path) + time.sleep(2) + print("\n=== ninja working ===") + exec_command(ninja_cmd, log_path) + print("build success!") + elif args.action[0] == 'clean': + clean_cmd = '' + if not os.path.exists(product_path): + print('Nothing to clean! No build found.') + return 0 + print("\n=== start clean ===\n") + if platform.system().find('Windows') == 0: + clean_cmd = ['ninja.exe', '-C', product_path, '-t', 'clean'] + else: + clean_cmd = ['ninja', '-C', product_path, '-t', 'clean'] + print("=== clean working ===\n") + exec_command(clean_cmd, log_path) + print("clean success!") + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/ndk/build/config/BUILD.gn b/ndk/build/config/BUILD.gn new file mode 100755 index 0000000..d8fa953 --- /dev/null +++ b/ndk/build/config/BUILD.gn @@ -0,0 +1,206 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +config("cpu_arch") { + cflags = [] + if (target_cpu == "cortex-a7") { + cflags += [ + "-mcpu=cortex-a7", + "-mfloat-abi=softfp", + "-mfpu=neon-vfpv4" + ] + } else if (target_cpu == "cortex-m4") { + cflags += [ + "-mcpu=cortex-m4", + "-march=armv7e-m", + "-mthumb" + ] + } + asmflags = cflags + cflags_cc = cflags +} + +config("base") { + defines = [ + "_FORTIFY_SOURCE=2" + ] + + if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "liteos_m" || ohos_kernel_type == "liteos_riscv") { + defines += [ + "__LITEOS__", + ] + } else if (ohos_kernel_type == "linux_4_9") { + defines += [ + "__LINUX__", + ] + } + + cflags = [ + "-fno-omit-frame-pointer", + "-nostdlib", + "-mno-unaligned-access", + "-fno-builtin", + "-Werror", + ] + + cflags_cc = cflags + cflags += [ + "-std=c99" + ] + + ldflags = [ + "-lc", + "-Wl,-z,now", + "-Wl,-z,relro", + "-Wl,-z,noexecstack" + ] +} + +config("exceptions") { + cflags_cc = [ "-fexceptions" ] + cflags_objcc = cflags_cc +} + +config("no_exceptions") { + cflags_cc = [ "-fno-exceptions" ] + cflags_objcc = cflags_cc + ldflags = cflags_cc +} + +config("stack_protector") { + cflags = [ "-fstack-protector-all" ] + cflags_cc = cflags +} + +config("static_pie_config") { + cflags = [ "-fPIE" ] + cflags_cc = cflags +} + +config("shared_library_config") { + cflags = [ "-fPIC" ] + cflags_cc = cflags +} + +config("pie_executable_config") { + ldflags = [ "-pie" ] +} + +config("clang") { + include_dirs = [ + "//llvm/include/c++/v1", + "//sysroot/usr/include/arm-liteos", + ] + + cflags = [ + "--target=arm-liteos", + "-mcpu=cortex-a7", + "-march=armv7-a", + "-mfloat-abi=softfp", + "--sysroot=${ohos_root_path}sysroot" + ] + cflags_cc = cflags + + ldflags = cflags + + ldflags += [ + "-L../llvm/lib/arm-liteos/c++", + "-L../sysroot/usr/lib/arm-liteos", + "-L../llvm/lib/clang/9.0.0/lib/arm-liteos", + "-L../llvm/lib/arm-liteos/c++", + "-lclang_rt.builtins", + "-lc", + "-lc++", + "-lc++abi", + "--sysroot=${ohos_root_path}sysroot" + ] +} + +config("clang_release") { + cflags = [ + "-Oz", + "-flto" + ] + cflags_cc = cflags +} + +config("release") { + defines = [ + "OHOS_RELEASE", + ] + cflags = [ + "-O2" + ] + cflags_cc = cflags +} + +config("debug") { + defines = [ + "OHOS_DEBUG", + ] + cflags = [ + "-g" + ] + cflags_cc = cflags +} + +config("gcc") { + include_dirs = [] + if (ohos_kernel_type == "liteos_a") { + include_dirs += [ + "//gcc/target/usr/include", + ] + ldflags = [ + "-L$ohos_root_path/gcc/target/usr/lib" + ] + } +} + +config("sysroot") { + include_dirs = [ + "//sysroot/usr/include" + ] + ldflags = [ + "-L$ohos_root_path/sysroot/usr/lib" + ] +} + +config("ohos") { + configs = [ + ":base", + ":cpu_arch", + ":stack_protector", + ":exceptions", + ":sysroot" + ] + + if (ohos_build_type == "release") { + configs += [ ":release" ] + } else if (ohos_build_type == "debug") { + configs += [ ":debug" ] + } + + if (ohos_build_compiler == "gcc") { + configs += [ ":gcc" ] + } else if (ohos_build_compiler == "clang") { + configs += [":clang"] + + if(ohos_build_type == "release") { + configs += [":clang_release"] + } + } +} + +config("tools") { + # Add tools configs if any +} \ No newline at end of file diff --git a/ndk/build/config/BUILDCONFIG.gn b/ndk/build/config/BUILDCONFIG.gn new file mode 100755 index 0000000..8b78e34 --- /dev/null +++ b/ndk/build/config/BUILDCONFIG.gn @@ -0,0 +1,66 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/config/variable.gni") + +if (target_os == "") { + target_os = "ohos" +} +if (target_cpu == "") { + target_cpu = "cortex-a7" +} + +host_toolchains = [ + "//build/toolchain:host_linux_x86_64_gcc" +] + +if(target_os == "ohos") { + if(ohos_kernel_type == "liteos_a") { + if(ohos_build_compiler == "gcc") { + set_default_toolchain("//build/toolchain:linux_x86_64_ohos_gcc") + } else { + set_default_toolchain("//build/toolchain:linux_x86_64_clang") + } + default_target_configs = [ "//build/config:ohos" ] + } else if (ohos_kernel_type == "liteos_riscv") { + set_default_toolchain("//build/config:liteos") + } else if (ohos_kernel_type == "linux" && board_name == "hi3518ev300") { + set_default_toolchain("//build/toolchain:linux_x86_64_himix100_gcc") + default_target_configs = [ "//build/config:ohos" ] + } else if (ohos_kernel_type == "linux" && board_name == "hi3516dv300") { + set_default_toolchain("//build/lite/toolchain:linux_x86_64_himix200_gcc") + default_target_configs = [ "//build/config:ohos" ] + } +} else if (target_os == "linux") { + set_default_toolchain("//build/toolchain:host_linux_x86_64_gcc") +} + +default_shared_library_configs = default_target_configs + [ "//build/config:shared_library_config" ] +default_static_library_configs = default_target_configs + [ "//build/config:static_pie_config" ] +default_executable_configs = default_static_library_configs + [ "//build/config:pie_executable_config" ] + +set_defaults("executable") { + configs = default_executable_configs +} + +set_defaults("static_library") { + configs = default_static_library_configs +} + +set_defaults("shared_library") { + configs = default_shared_library_configs +} + +set_defaults("source_set") { + configs = default_target_configs +} diff --git a/ndk/build/config/variable.gni b/ndk/build/config/variable.gni new file mode 100755 index 0000000..56e5506 --- /dev/null +++ b/ndk/build/config/variable.gni @@ -0,0 +1,33 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Description: Define the global variables for all components +declare_args() { + # "debug" or "release" + ohos_build_type = "release" +} + +declare_args() { + # Supported board: "hi3516dv300", "hi3518ev300", "hi3861v100" + board_name = "hi3518ev300" + target_arch = "" + + # Supported compiler: gcc, clang + ohos_build_compiler = "clang" + + # Supported kernel: + # cortex-m(liteos_m), liteos for cortex-a(liteos_a), liteos for riscv(liteos_riscv), linux kernel(linux_4_9) + ohos_kernel_type = "liteos_a" + + ohos_root_path = rebase_path("//") +} \ No newline at end of file diff --git a/ndk/build/toolchain/BUILD.gn b/ndk/build/toolchain/BUILD.gn new file mode 100755 index 0000000..11b7fd3 --- /dev/null +++ b/ndk/build/toolchain/BUILD.gn @@ -0,0 +1,59 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/toolchain/${ohos_build_compiler}.gni") + +if(ohos_build_compiler == "gcc") { + gcc_toolchain("linux_x86_64_ohos_gcc") { + cc = "$ohos_build_compiler_dir/arm-linux-ohoseabi-gcc" + cxx = "$ohos_build_compiler_dir/arm-linux-ohoseabi-g++" + ar = "$ohos_build_compiler_dir/arm-linux-ohoseabi-ar" + ld = cc + if (ohos_build_type == "release") { + strip = "$ohos_build_compiler_dir/arm-linux-ohoseabi-strip --strip-unneeded" + } + } + + gcc_toolchain("host_linux_x86_64_gcc") { + cc = "gcc" + cxx = "g++" + ar = "ar" + ld = cxx + strip = "strip" + } +} + +if (ohos_build_compiler == "clang") { + clang_toolchain("linux_x86_64_clang") { + cc = "$ohos_build_compiler_dir/clang" + cxx = "$ohos_build_compiler_dir/clang++" + ar = "$ohos_build_compiler_dir/llvm-ar" + as = "$ohos_build_compiler_dir/llvm-as" + ld = cc + if (ohos_build_type == "release") { + strip = "$ohos_build_compiler_dir/llvm-objcopy --strip-all" + } + } + + clang_toolchain("win_x86_64_clang") { + cc = "$ohos_build_compiler_dir/clang" + cxx = "$ohos_build_compiler_dir/clang++" + ar = "$ohos_build_compiler_dir/llvm-ar" + as = "$ohos_build_compiler_dir/llvm-as" + ld = cc + if (ohos_build_type == "release") { + strip = "$ohos_build_compiler_dir/llvm-objcopy --strip-all" + } + } +} + diff --git a/ndk/build/toolchain/clang.gni b/ndk/build/toolchain/clang.gni new file mode 100755 index 0000000..3f0f319 --- /dev/null +++ b/ndk/build/toolchain/clang.gni @@ -0,0 +1,126 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ohos_build_compiler = "clang" +ohos_build_compiler_dir = rebase_path("//llvm/bin", root_build_dir) +ohos_build_compiler_prefix = "clang" +ohos_build_compiler_so_strip = "llvm-objcopy --strip-all" +ohos_build_compiler_bin_strip = "llvm-objcopy --strip-all" + +template("clang_toolchain") { + toolchain(target_name) { + assert(defined(invoker.cc), "clang toolchain must specify a \"cc\" value") + assert(defined(invoker.cxx), "clang toolchain must specify a \"cxx\" value") + assert(defined(invoker.ar), "clang toolchain must specify a \"ar\" value") + assert(defined(invoker.as), "clang toolchain must specify a \"as\" value") + assert(defined(invoker.ld), "clang toolchain must specify a \"ld\" value") + + cc = invoker.cc + cxx = invoker.cxx + ar = invoker.ar + as = invoker.as + ld = invoker.ld + + need_strip = false + if(defined(invoker.strip)) { + strip = invoker.strip + need_strip = true + } + + tool("cc") { + command = "$cc {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "clang {{output}}" + outputs = [ + "{{source_out_dir}}/{{source_name_part}}.o", + ] + } + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx {{defines}} {{include_dirs}} {{cflags_cc}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "clang++ {{output}}" + outputs = [ + "{{source_out_dir}}/{{source_name_part}}.o", + ] + } + tool("asm") { + depfile = "{{output}}.d" + command = "$as {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "ASM {{output}}" + outputs = [ + "{{source_out_dir}}/{{source_name_part}}.o", + ] + } + tool("alink") { + outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" + rspfile = "{{output}}.rsp" + rspfile_content = "{{inputs}}" + command = "$ar -r {{output}} @\"$rspfile\"" + description = "AR {{output}}" + outputs = [ + outfile, + ] + default_output_dir = "{{root_out_dir}}/libs" + default_output_extension = ".a" + output_prefix = "lib" + } + tool("solink") { + outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + rspfile_content = "{{inputs}}" + command = "$ld -shared {{ldflags}} {{inputs}} -o $outfile" + if (need_strip) { + unstripped_outfile = outfile + command += " && $strip" + " \"$unstripped_outfile\" \"$outfile\"" + } + default_output_extension = ".so" + description = "SOLINK $outfile" + default_output_dir = "{{root_out_dir}}" + output_prefix = "lib" + outputs = [ + outfile + ] + } + tool("link") { + outfile = "bin/{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + custom_ld_flags = " " + command = "$cc {{ldflags}} {{inputs}} $custom_ld_flags -o $outfile" + if (need_strip) { + command += " && $strip $outfile" + } + + description = "LLVM LINK $outfile" + default_output_dir = "{{root_out_dir}}/bin" + rspfile_content = "{{inputs}}" + outputs = [ + outfile + ] + } + tool("stamp") { + if (host_os == "win") { + command = "cmd /c type nul > \"{{output}}\"" + } else { + command = "/usr/bin/touch {{output}}" + } + description = "STAMP {{output}}" + } + + tool("copy") { + command = "cp -afd {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } + } +} \ No newline at end of file diff --git a/ndk/build/toolchain/gcc.gni b/ndk/build/toolchain/gcc.gni new file mode 100755 index 0000000..a7b90c8 --- /dev/null +++ b/ndk/build/toolchain/gcc.gni @@ -0,0 +1,132 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ohos_build_compiler = "gcc" +ohos_build_compiler_dir = rebase_path("//gcc/bin", root_build_dir) +ohos_build_compiler_prefix = "arm-linux-ohoseabi" +ohos_build_compiler_so_strip = "$ohos_build_compiler_prefix-strip --strip-unneeded" +ohos_build_compiler_bin_strip = "$ohos_build_compiler_prefix-strip --strip-unneeded" + +template("gcc_toolchain") { + toolchain(target_name) { + assert(defined(invoker.ar), "gcc toolchain must specify a \"ar\" value") + assert(defined(invoker.cc), "gcc toolchain must specify a \"cc\" value") + assert(defined(invoker.cxx), "gcc toolchain must specify a \"cxx\" value") + assert(defined(invoker.ld), "gcc toolchain must specify a \"ld\" value") + + cc = invoker.cc + cxx = invoker.cxx + ar = invoker.ar + ld = invoker.ld + + need_strip = false + if(defined(invoker.strip)) { + strip = invoker.strip + need_strip = true + } + + if (defined(invoker.extra_ldflags) && invoker.extra_ldflags != "") { + extra_ldflags = " " + invoker.extra_ldflags + } else { + extra_ldflags = "" + } + + tool("cc") { + command = "$cc {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "cross compiler {{output}}" + outputs = [ + "{{source_out_dir}}/{{source_name_part}}.o", + ] + } + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx {{defines}} {{include_dirs}} {{cflags_cc}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "CXX {{output}}" + outputs = [ + "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", + ] + } + tool("asm") { + depfile = "{{output}}.d" + command = "$cc {{defines}} {{include_dirs}} {{asmflags}} {{source}} -c -o {{output}}" + depsformat = "gcc" + description = "cross compiler {{output}}" + outputs = [ + "{{source_out_dir}}/{{source_name_part}}.o" + ] + } + tool("alink") { + outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" + rspfile = "{{output}}.rsp" + rspfile_content = "{{inputs}}" + command = "$ar cr {{output}} @\"$rspfile\"" + + description = "AR {{output}}" + outputs = [ + outfile + ] + + default_output_dir = "{{root_out_dir}}/libs" + default_output_extension = ".a" + output_prefix = "lib" + } + tool("solink") { + outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" + rspfile = "{{output}}.rsp" + rspfile_content = "{{inputs}}" + command = "$ld -shared {{ldflags}} $extra_ldflags " + + "-Wl,--start-group {{inputs}} {{libs}} -Wl,--end-group -o $outfile" + if(need_strip) { + command += "&& $strip $outfile" + } + description = "SOLINK $outfile" + outputs = [ + outfile + ] + + default_output_dir = "{{root_out_dir}}" + default_output_extension = ".so" + output_prefix = "lib" + } + tool("link") { + outfile = "{{output_dir}}/bin/{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + command = "$ld {{ldflags}} $extra_ldflags " + + "-Wl,--start-group {{inputs}} {{libs}} -Wl,--end-group -o $outfile " + if(need_strip) { + command += "&& $strip $outfile" + } + + description = "LINK $outfile" + default_output_dir = "{{root_out_dir}}" + rspfile_content = "{{inputs}}" + outputs = [ + outfile + ] + } + tool("stamp") { + if (host_os == "win") { + command = "cmd /c type nul > \"{{output}}\"" + } else { + command = "/usr/bin/touch {{output}}" + } + description = "STAMP {{output}}" + } + tool("copy") { + command = "cp -afd {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } + } +} \ No newline at end of file diff --git a/ndk/build/toolchain/riscv.gni b/ndk/build/toolchain/riscv.gni new file mode 100755 index 0000000..d3b7ee2 --- /dev/null +++ b/ndk/build/toolchain/riscv.gni @@ -0,0 +1,20 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ohos_build_compiler = "riscv" +ohos_build_compiler_prefix = "riscv32-unknown-elf" +ohos_build_compiler_dir_linux = "" +ohos_build_compiler_dir_win = "" +ohos_build_compiler_so_strip = "" +ohos_build_compiler_bin_strip = "" +# NOTE: riscv compiler not available, need install on host manually diff --git a/ndk/doc/BUILD.gn b/ndk/doc/BUILD.gn new file mode 100755 index 0000000..eb4af4e --- /dev/null +++ b/ndk/doc/BUILD.gn @@ -0,0 +1,37 @@ +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +action("doc") { + deps = ["//build/lite/ndk:ndk_build"] + script = "//build/lite/ndk/doc/gen_doc.py" + depfile = "${target_gen_dir}/${target_name}.d" + + exclude_dir = "*/gcc/* \ */arm-liteos/*" + doxygen_file = "//build/lite/ndk/doc/config/Doxyfile_C" + + args = [ + "--exclude_dir", + exclude_dir, + "--working-dir", + rebase_path("$root_build_dir/ndk"), + "--version", + ohos_version, + "--output", + rebase_path("$root_build_dir/ndk/doc"), + "--doxygen-file", + rebase_path(doxygen_file, root_build_dir), + ] + outputs = [ "$root_build_dir/ndk/doc/index.html" ] +} \ No newline at end of file diff --git a/ndk/doc/config/Doxyfile_C b/ndk/doc/config/Doxyfile_C new file mode 100755 index 0000000..c8f77a2 --- /dev/null +++ b/ndk/doc/config/Doxyfile_C @@ -0,0 +1,2321 @@ +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Doxyfile 1.8.6 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "HarmonyOS" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = %VERSION% + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify an logo or icon that is included in +# the documentation. The maximum height of the logo should not exceed 55 pixels +# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo +# to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a +# new page for each member. If set to NO, the documentation of a member will be +# part of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. +# +# Note For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by by putting a % sign in front of the word +# or globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = NO + +# This flag is only useful for Objective-C code. When set to YES local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = YES + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO these classes will be included in the various overviews. This option has +# no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = YES + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the +# todo list. This list is created by putting \todo commands in the +# documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the +# test list. This list is created by putting \test commands in the +# documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES the list +# will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. Do not use file names with spaces, bibtex cannot handle them. See +# also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO doxygen will only warn about wrong or incomplete parameter +# documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. +# Note: If this tag is empty the current directory is searched. + +INPUT = + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank the +# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, +# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, +# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, +# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, +# *.qsf, *.as and *.js. + +FILE_PATTERNS = *.h + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = %EXCLUDE_DIR% + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER ) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES, then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = %OUTPUT_DIR% + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- +# defined cascading style sheet that is included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefor more robust against future updates. +# Doxygen will copy the style sheet file to the output directory. For an example +# see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the stylesheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler ( hhc.exe). If non-empty +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated ( +# YES) or that it should be included in the master .chm file ( NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated ( +# YES) or a normal table of contents ( NO) in the .chm file. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = YES + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using prerendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /