summaryrefslogtreecommitdiff
path: root/zephyr/CMakeLists.txt
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-08-20 10:23:55 -0600
committerCommit Bot <commit-bot@chromium.org>2021-08-20 17:36:11 +0000
commit4c1cdd23cb35964608f0a2666f933987b4573899 (patch)
tree52a8b6531745e8893839d2c5a8f36331a882f061 /zephyr/CMakeLists.txt
parent93adb802c1a626fbb73d762124e90be4fee08a8b (diff)
downloadchrome-ec-4c1cdd23cb35964608f0a2666f933987b4573899.tar.gz
Reland "zephyr: pull in the version string from zmake"
This reverts commit 93adb802c1a626fbb73d762124e90be4fee08a8b. This commit was reverted due to build failures with the chromeos-zephyr ebuild. The root cause of the build failures was that the ebuild uses different working directories between the configure and build phases, and so the path to the include directory we generate during the configure phase won't work in the build phase. Use the full path here so that we can run the diffrerent phases in different working directories. Diff from original commit: Change-Id: Idcbd0c0546f9fcb12fcd66c617e024b8aa2a893a > --- a/zephyr/zmake/zmake/zmake.py > +++ b/zephyr/zmake/zmake/zmake.py > @@ -235,7 +235,7 @@ class Zmake: > self.logger.info("Clearing old build directory %s", build_dir) > shutil.rmtree(build_dir) > > - generated_include_dir = build_dir / "include" > + generated_include_dir = (build_dir / "include").resolve() > base_config = zmake.build_config.BuildConfig( > environ_defs={"ZEPHYR_BASE": str(zephyr_base), "PATH": "/usr/bin"}, > cmake_defs={ BUG=b:197287679 BRANCH=none TEST=emerge-volteer chromeos-zephyr Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I80cec7a1622edcecc670b7dbeed56dadcdf71555 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3111305 Commit-Queue: Yuval Peress <peress@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
Diffstat (limited to 'zephyr/CMakeLists.txt')
-rw-r--r--zephyr/CMakeLists.txt30
1 files changed, 4 insertions, 26 deletions
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt
index af577cdc34..171ab973d2 100644
--- a/zephyr/CMakeLists.txt
+++ b/zephyr/CMakeLists.txt
@@ -25,33 +25,11 @@ if(NOT EXISTS "${PLATFORM_EC}/zephyr/module.yml")
assert_exists("${PLATFORM_EC}/zephyr/module.yml")
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")
+if(DEFINED ZMAKE_INCLUDE_DIR)
+ zephyr_include_directories("${ZMAKE_INCLUDE_DIR}")
+endif()
+if(DEFINED CONFIG_PLATFORM_EC)
# 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.