From 474e8a65538f51f41218e5fe844bd34a227986b3 Mon Sep 17 00:00:00 2001 From: Armando Montanez Date: Mon, 21 Oct 2024 20:29:00 -0700 Subject: [PATCH] [Bazel] Infer PICOTOOL_VERSION define from module version Makes the PICOTOOL_VERSION define use the value of module_version() to reduce duplication of version strings in the Bazel build. --- BUILD.bazel | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 05b355f..2f9aa94 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -2,6 +2,8 @@ load("//bazel:defs.bzl", "otp_header_parse", "picotool_binary_data_header") package(default_visibility = ["//visibility:public"]) +PICOTOOL_SDK_VERSION_STRING = module_version() if module_version() != None else "0.0.1-WORKSPACE" + picotool_binary_data_header( name = "rp2350_rom", src = "bootrom.end.bin", @@ -71,8 +73,7 @@ cc_binary( ], }), defines = [ - # TODO: There's probably a nicer way to share the version with CMake. - 'PICOTOOL_VERSION=\\"2.0.0\\"', + 'PICOTOOL_VERSION=\\"{}\\"'.format(PICOTOOL_VERSION_STRING), 'SYSTEM_VERSION=\\"host\\"', 'COMPILER_INFO=\\"local\\"', "SUPPORT_A0=0",