Skip to content

Commit

Permalink
[UPDATE] README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
janstrohbeck committed Feb 18, 2019
1 parent 5213aa3 commit 9898789
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,7 @@ Setup
- CMake: `pip install --user cmake_format`
- Python: `pip install --user python-autopep8 pylint`
1. Ensure that `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` is included in the `cmake_args` of your catkin profile. It is already added to the default profile, but if you have created your own catkin profile, you need to add the flag with `catkin config -a --cmake-args "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"`)
2. If you use `aduulm_cmake_tooks`, you can include the git hooks in any of your packages' toplevel `CMakeList.txt` with a call to `setup_git_hooks()`. Otherwise, you may add the following code block explicitly (not recommended):
```cmake
set(HOOKS_PATH "${CMAKE_BINARY_DIR}/../../root/git_hooks")
if(EXISTS "${HOOKS_PATH}")
add_subdirectory("${HOOKS_PATH}" "${CMAKE_CURRENT_BINARY_DIR}/.hooks")
create_git_hook()
else()
message(WARNING "Could not find git hooks. Git hooks are not active.")
endif()
```
2. If you use `aduulm_cmake_tooks`, you can include the git hooks in any of your packages' toplevel `CMakeList.txt` with a call to `setup_git_hooks()`. Otherwise, you may add the git_hooks repository as a submodule of your own repository with ` git submodule add "ssh://[email protected]:7678/aduulm/source/git_hooks.git" git_hooks` and then include it with `add_subdirectory("git_hooks")` and `setup_git_hooks()`.
3. Run `catkin build` or `catkin build PROJECT_NAME`
4. Check that `./run_hooks` and `$(git rev-parse --git-dir)/hooks/pre-commit` exist
5. Add `run_hooks` to your .gitignore file
Expand Down
3 changes: 2 additions & 1 deletion init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ HOOKSPATH="$( cd "$(dirname "$0")" ; pwd -P )"
GIT_DIR=`readlink -f $(git rev-parse --git-dir)`
REPOPATH=`realpath "$1"`
PROJECT_NAME=${REPOPATH##*/}
HOOKSPATH_REL=`realpath --relative-to="$REPOPATH" "$HOOKSPATH"`

if [ -f "$REPOPATH/CMakeLists.txt" ]; then
echo "Folder already contains CMakeLists.txt!" >&2
Expand All @@ -18,7 +19,7 @@ cat <<EOF >"$REPOPATH/CMakeLists.txt"
cmake_minimum_required(VERSION 2.8.3)
project($PROJECT_NAME)
add_subdirectory("$HOOKSPATH" ".hooks")
add_subdirectory("$HOOKSPATH_REL" ".hooks")
create_git_hook()
EOF

Expand Down

0 comments on commit 9898789

Please sign in to comment.