Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable GINKGO_DEVEL_TOOLS by default #442

Merged
merged 2 commits into from
Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include(cmake/hip_path.cmake)
include(cmake/autodetect_executors.cmake)

# Ginkgo configuration options
option(GINKGO_DEVEL_TOOLS "Add development tools to the build system" ON)
option(GINKGO_DEVEL_TOOLS "Add development tools to the build system" OFF)
option(GINKGO_BUILD_TESTS "Generate build files for unit tests" ON)
option(GINKGO_BUILD_EXAMPLES "Build Ginkgo's examples" ON)
option(GINKGO_BUILD_BENCHMARKS "Build Ginkgo's benchmarks" ON)
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Ginkgo adds the following additional switches to control what is being built:

* `-DGINKGO_DEVEL_TOOLS={ON, OFF}` sets up the build system for development
(requires clang-format, will also download git-cmake-format),
default is `ON`.
default is `OFF`.
* `-DGINKGO_BUILD_TESTS={ON, OFF}` builds Ginkgo's tests
(will download googletest), default is `ON`.
* `-DGINKGO_BUILD_BENCHMARKS={ON, OFF}` builds Ginkgo's benchmarks
Expand Down
2 changes: 2 additions & 0 deletions third_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ endif()
if(GINKGO_DEVEL_TOOLS)
set(GCF_IGNORE_LIST "third_party" CACHE STRING "Ignore directories for GCF")
add_subdirectory(git-cmake-format)
else()
add_subdirectory(dummy-hook)
endif()

if(GINKGO_BUILD_BENCHMARKS)
Expand Down
18 changes: 18 additions & 0 deletions third_party/dummy-hook/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
if(EXISTS "${Ginkgo_SOURCE_DIR}/.git")
set(ADD_HOOK FALSE)
set(HOOK_LOCATION "${Ginkgo_SOURCE_DIR}/.git/hooks/pre-commit")
if(NOT EXISTS "${HOOK_LOCATION}")
set(ADD_HOOK TRUE)
else()
# check if the correct hook is installed
execute_process(COMMAND grep git-cmake-format.py "${HOOK_LOCATION}"
RESULT_VARIABLE res OUTPUT_QUIET)
# return value =/= 0 means the pattern was not found
if(NOT res EQUAL 0)
set(ADD_HOOK TRUE)
endif()
endif()
if(ADD_HOOK)
configure_file(dummy_hook "${HOOK_LOCATION}" COPYONLY)
endif()
endif()
5 changes: 5 additions & 0 deletions third_party/dummy-hook/dummy_hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
echo "Please only commit to Ginkgo when GINKGO_DEVEL_TOOLS is enabled in CMake."
echo "This can be set in your initial invocation of CMake by using"
echo " -DGINKGO_DEVEL_TOOLS=ON or by editing the CMakeCache.txt file."
exit 1