mirror of https://github.com/thesofproject/sof.git
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 <daniel.leung@intel.com>
This commit is contained in:
parent
c00d39c71b
commit
d53778f372
|
@ -47,6 +47,9 @@ set(SOF_ROOT_BINARY_DIRECTORY "${PROJECT_BINARY_DIR}")
|
||||||
# check git hooks
|
# check git hooks
|
||||||
include(scripts/cmake/git-hooks.cmake)
|
include(scripts/cmake/git-hooks.cmake)
|
||||||
|
|
||||||
|
# checkout submodules
|
||||||
|
include(scripts/cmake/git-submodules.cmake)
|
||||||
|
|
||||||
# most of other options are set on per-arch and per-target basis
|
# most of other options are set on per-arch and per-target basis
|
||||||
set(CMAKE_ASM_FLAGS -DASSEMBLY)
|
set(CMAKE_ASM_FLAGS -DASSEMBLY)
|
||||||
|
|
||||||
|
@ -55,6 +58,7 @@ set(CMAKE_ASM_FLAGS -DASSEMBLY)
|
||||||
add_library(sof_public_headers INTERFACE)
|
add_library(sof_public_headers INTERFACE)
|
||||||
|
|
||||||
target_include_directories(sof_public_headers INTERFACE ${PROJECT_SOURCE_DIR}/src/include)
|
target_include_directories(sof_public_headers INTERFACE ${PROJECT_SOURCE_DIR}/src/include)
|
||||||
|
target_include_directories(sof_public_headers INTERFACE ${PROJECT_SOURCE_DIR}/rimage/src/include/sof)
|
||||||
|
|
||||||
# interface library that is used only as container for sof binary options
|
# interface library that is used only as container for sof binary options
|
||||||
# other targets can use it to build with the same options
|
# other targets can use it to build with the same options
|
||||||
|
@ -162,6 +166,8 @@ install(
|
||||||
${PROJECT_SOURCE_DIR}/src/include/ipc
|
${PROJECT_SOURCE_DIR}/src/include/ipc
|
||||||
${PROJECT_SOURCE_DIR}/src/include/kernel
|
${PROJECT_SOURCE_DIR}/src/include/kernel
|
||||||
${PROJECT_SOURCE_DIR}/src/include/user
|
${PROJECT_SOURCE_DIR}/src/include/user
|
||||||
|
${PROJECT_SOURCE_DIR}/rimage/src/include/sof/kernel
|
||||||
|
${PROJECT_SOURCE_DIR}/rimage/src/include/sof/user
|
||||||
DESTINATION include/sof
|
DESTINATION include/sof
|
||||||
PATTERN "*.h"
|
PATTERN "*.h"
|
||||||
)
|
)
|
||||||
|
|
|
@ -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()
|
Loading…
Reference in New Issue