cmake: add git hooks

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
This commit is contained in:
Janusz Jankowski 2019-03-20 12:57:10 +01:00 committed by Liam Girdwood
parent e54087caa4
commit dbf43b290a
2 changed files with 25 additions and 0 deletions

View File

@ -42,6 +42,9 @@ project(SOF C ASM)
set(SOF_ROOT_SOURCE_DIRECTORY "${PROJECT_SOURCE_DIR}")
set(SOF_ROOT_BINARY_DIRECTORY "${PROJECT_BINARY_DIR}")
# check git hooks
include(scripts/cmake/git-hooks.cmake)
# most of other options are set on per-arch and per-target basis
set(CMAKE_ASM_FLAGS -DASSEMBLY)

View File

@ -0,0 +1,22 @@
# Links git hooks, if there are no other hooks already
if(NOT EXISTS "${SOF_ROOT_SOURCE_DIRECTORY}/.git")
return()
endif()
if(NOT CMAKE_HOST_UNIX)
return()
endif()
set(pre_commit_hook "${SOF_ROOT_SOURCE_DIRECTORY}/.git/hooks/pre-commit")
set(post_commit_hook "${SOF_ROOT_SOURCE_DIRECTORY}/.git/hooks/post-commit")
if(NOT EXISTS ${pre_commit_hook})
message(STATUS "Linking git pre-commit hook")
execute_process(COMMAND ln -s -f -T ../../scripts/sof-pre-commit-hook.sh ${pre_commit_hook})
endif()
if(NOT EXISTS ${post_commit_hook})
message(STATUS "Linking git post-commit hook")
execute_process(COMMAND ln -s -f -T ../../scripts/sof-post-commit-hook.sh ${post_commit_hook})
endif()