Добавить общие графики, декодер KONOR и порт STM32 bxCAN
This commit is contained in:
@@ -17,9 +17,10 @@ from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
INCLUDE = ROOT / "include"
|
||||
JNI_INCLUDES: list[Path] = []
|
||||
SOURCES = [
|
||||
ROOT / "src" / name for name in (
|
||||
"set_protocol.c", "set_can.c", "set_firmware.c", "set_telemetry.c",
|
||||
"set_protocol.c", "set_can.c", "set_firmware.c", "set_telemetry.c", "set_plot.c", "set_trends.c", "set_spectrum.c",
|
||||
"gui_catalog.c", "gui_frame.c", "pcan_abi.c", "pcan_crc.c",
|
||||
"pcan_frame.c", "pcan_id.c", "pcan_link.c", "pcan_ring.c",
|
||||
"pcan_gas.c",
|
||||
@@ -51,9 +52,10 @@ def _build_msvc(output: Path, build_dir: Path) -> None:
|
||||
raise SystemExit("Visual Studio C++ tools were not found")
|
||||
quoted_sources = " ".join(f'"{source}"' for source in SOURCES)
|
||||
import_library = build_dir / "setprotocol.lib"
|
||||
jni_flags = " ".join(f'/I"{path}"' for path in JNI_INCLUDES)
|
||||
command = (
|
||||
f'call "{vcvars}" && cl /nologo /W4 /std:c11 '
|
||||
f'/DPCAN_ABI_BUILD_DLL /I"{INCLUDE}" /LD {quoted_sources} '
|
||||
f'/DPCAN_ABI_BUILD_DLL /I"{INCLUDE}" {jni_flags} /LD {quoted_sources} '
|
||||
f'/Fe"{output}" /link /IMPLIB:"{import_library}"'
|
||||
)
|
||||
# shell=True is intentional on Windows: ``call`` must run the batch file
|
||||
@@ -66,15 +68,23 @@ def _build_cc(output: Path, build_dir: Path) -> None:
|
||||
if compiler is None:
|
||||
raise SystemExit("C compiler was not found")
|
||||
command = [compiler, "-std=c99", "-Wall", "-Wextra", "-Wpedantic",
|
||||
"-fPIC", "-shared", f"-I{INCLUDE}", *map(str, SOURCES),
|
||||
"-o", str(output)]
|
||||
"-fPIC", "-shared", f"-I{INCLUDE}",
|
||||
*(f"-I{path}" for path in JNI_INCLUDES), *map(str, SOURCES),
|
||||
"-o", str(output), "-lm"]
|
||||
subprocess.run(command, cwd=build_dir, check=True)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--output", type=Path, required=True)
|
||||
parser.add_argument("--java-home", type=Path, help="Include the plot JNI adapter for host JVM tests")
|
||||
args = parser.parse_args()
|
||||
if args.java_home:
|
||||
include = args.java_home.resolve() / "include"
|
||||
if not (include / "jni.h").is_file():
|
||||
parser.error("--java-home must contain include/jni.h")
|
||||
JNI_INCLUDES.extend([include, include / {"Windows": "win32", "Darwin": "darwin"}.get(platform.system(), "linux")])
|
||||
SOURCES.append(ROOT / "ports" / "android" / "set_plot_jni.c")
|
||||
output = args.output.resolve()
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
build_dir = output.parent / ".setprotocol-build"
|
||||
|
||||
Reference in New Issue
Block a user