-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake: update git submodules when cmake is run
This adds the necessary bits to update git submodules when cmake is run, with the option to turn this behavior off if needed. This is in preparation to use fw.h and manifest.h from the rimage repo to prevent having two copies of each file in two different repos. Obviously, the files in the submodules must exist before building the firmware, so run git submodule update to checkout the files. Signed-off-by: Daniel Leung <[email protected]>
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
find_package(Git) | ||
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") | ||
# Update submodules by default | ||
option(GIT_SUBMODULE "Check submodules during build" ON) | ||
|
||
if(GIT_SUBMODULE) | ||
message(STATUS "Git submodule update") | ||
|
||
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
RESULT_VARIABLE GIT_SUBMOD_RESULT) | ||
|
||
if(NOT GIT_SUBMOD_RESULT EQUAL "0") | ||
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") | ||
endif() | ||
endif() | ||
endif() | ||
|
||
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/rimage/CMakeLists.txt") | ||
message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.") | ||
endif() |