diff options
author | Rob Barnes <robbarnes@google.com> | 2021-08-20 14:36:21 +0000 |
---|---|---|
committer | Rob Barnes <robbarnes@google.com> | 2021-08-20 15:25:53 +0000 |
commit | 93adb802c1a626fbb73d762124e90be4fee08a8b (patch) | |
tree | 8ba2b19cf7a2ec4d24dde1424bfcd46d4865e231 /zephyr/CMakeLists.txt | |
parent | 8270698e589f14239b4942a42b27132af497410b (diff) | |
download | chrome-ec-93adb802c1a626fbb73d762124e90be4fee08a8b.tar.gz |
Revert "zephyr: pull in the version string from zmake"
This reverts commit 10809eb023d475681b45863e68d906fae4667eda.
Reason for revert: Causing build errors b/197287679
Original change's description:
> zephyr: pull in the version string from zmake
>
> Zmake computes a version string and stores it in FRID/FWID, but this
> was never plumbed all the way out into the version functionality in
> the OS, which was reporting the version generated by
> util/getversion.sh.
>
> Add a mechanism to generate the version header from zmake and replace
> the getversion.sh generation with that.
>
> BUG=b:184832251
> BRANCH=none
> TEST=provided unit tests
> TEST=get this version string on posix-ec:
> posix-ec_v2.6.73347-cmsis:c3bd20,ec:c814a9,hal_stm32:f8ff8d,os:efe095
> 2021-08-18 14:10:18 jrosenth@germania
>
> Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
> Change-Id: Idec1c5f8b5f014126706e4fdc1f3d158edf40a63
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3104625
> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Bug: b:184832251
Change-Id: Ifcc4830e3097c8dc8126bb76adfeb3ce75a7a667
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3110293
Auto-Submit: Rob Barnes <robbarnes@google.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Diffstat (limited to 'zephyr/CMakeLists.txt')
-rw-r--r-- | zephyr/CMakeLists.txt | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 171ab973d2..af577cdc34 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -25,11 +25,33 @@ if(NOT EXISTS "${PLATFORM_EC}/zephyr/module.yml") assert_exists("${PLATFORM_EC}/zephyr/module.yml") endif() -if(DEFINED ZMAKE_INCLUDE_DIR) - zephyr_include_directories("${ZMAKE_INCLUDE_DIR}") -endif() - if(DEFINED CONFIG_PLATFORM_EC) + # Build the EC's expected ec_version.h file. + set(ec_version_file "${CMAKE_BINARY_DIR}/ec/include/generated/ec_version.h") + # Create the command used to generate the ec_version.h file. + add_custom_command( + OUTPUT ${ec_version_file} + # TODO(b/185249526): zephyr: add project name to the version output + COMMAND BOARD=${BOARD}_zephyr ${PLATFORM_EC}/util/getversion.sh > ${ec_version_file} + WORKING_DIRECTORY ${PLATFORM_EC} + ) + # Create a custom target that will depend on the file. + add_custom_target(generate_ec_version DEPENDS ${ec_version_file}) + + # Create a local library (ec_version) that will be a pure interface library + # and will depend on the custom target that generates the ec_version.h file. + add_library(ec_version INTERFACE) + add_dependencies(ec_version generate_ec_version) + + # Ensure the EC version file is generated before trying to build the app + # library, which includes compiling version.c + add_dependencies(app ec_version) + + # Register the library with zephyr so that it generates the file at build + # time. Also, append the include directory so we can include ec_version.h. + zephyr_append_cmake_library(ec_version) + zephyr_include_directories("${CMAKE_BINARY_DIR}/ec/include/generated") + # Add CHROMIUM_EC definition, which is used by ec_commands.h to # determine that the header is being compiled for the EC instead of # by another third-party C codebase. |