blob: bdd43a36bc79f0a6e0747e7b175e1b1adf1e85d8 [file] [log] [blame]
Kshitij Sisodiaf9efe0d2022-09-30 16:42:50 +01001# SPDX-FileCopyrightText: Copyright 2021-2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
2# SPDX-License-Identifier: Apache-2.0
3"""
4This script executes SWIG commands to generate C++ library wrappers.
5"""
6import subprocess
7from pathlib import Path
8
9__current_dir = Path(__file__).parent.absolute()
10
11
12def generate_wrap(name, extr_includes):
13 print('Generating wrappers for {}'.format(name))
14 subprocess.check_output("swig -v -c++ -python" +
15 " -Wall" +
16 " -o {}/src/ethosu_driver/_generated/{}_wrap.cpp ".format(__current_dir, name) +
17 "-outdir {}/src/ethosu_driver/_generated ".format(__current_dir) +
18 "{} ".format(extr_includes) +
19 "-I{}/src/ethosu_driver/swig ".format(__current_dir) +
20 "{}/src/ethosu_driver/swig/{}.i".format(__current_dir, name),
21 shell=True,
22 stderr=subprocess.STDOUT)
23
24
25if __name__ == "__main__":
26 includes = ["{}/../../driver_library/include".format(__current_dir)]
27 generate_wrap('driver', "-I{} ".format(' -I'.join(includes)))