Commit 66bb6b9b authored by Alexis Girault's avatar Alexis Girault
Browse files

ENH: Get rid of KWStyle

parent f036fab2
#-----------------------------------------------------------------------------
# Find KWStyle executable
#-----------------------------------------------------------------------------
find_program(
KWSTYLE_EXECUTABLE
NAMES KWStyle
DOC "Path to the KWStyle executable"
)
mark_as_advanced(KWSTYLE_EXECUTABLE)
#-----------------------------------------------------------------------------
# Check KWstyle version
#-----------------------------------------------------------------------------
if(KWSTYLE_EXECUTABLE)
execute_process(
COMMAND ${KWSTYLE_EXECUTABLE} -version
OUTPUT_VARIABLE KWSTYLE_VERSION_STRING
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(KWSTYLE_VERSION_STRING)
# string(REPLACE ..) fails if the input is an empty string
string(REPLACE
"Version: "
""
KWSTYLE_VERSION_STRING
${KWSTYLE_VERSION_STRING}
)
else()
# CMake's find_package_handle_standard_args has a bug where the
# version empty string ("") is always acceptable
set(KWSTYLE_VERSION_STRING "?")
endif()
endif()
#-----------------------------------------------------------------------------
# Find package
#-----------------------------------------------------------------------------
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
KWStyle
REQUIRED_VARS KWSTYLE_EXECUTABLE
VERSION_VAR KWSTYLE_VERSION_STRING
)
#-----------------------------------------------------------------------------
# Define configuration files
#-----------------------------------------------------------------------------
set(kwstyle_configuration_file "Utilities/KWStyle/${PROJECT_NAME}.kws.xml")
set(kwstyle_overwrite_file "Utilities/KWStyle/KWStyleOverwrite.txt")
#-----------------------------------------------------------------------------
# Setup git hook for KWStyle executable path
#-----------------------------------------------------------------------------
find_package(Git)
if(GIT_FOUND)
if(EXISTS "${KWSTYLE_EXECUTABLE}")
message(STATUS "KWStyle found: enabling in git hook")
execute_process(COMMAND ${GIT_EXECUTABLE} config kws.path "${KWSTYLE_EXECUTABLE}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
execute_process(COMMAND ${GIT_EXECUTABLE} config kws.conf "${kwstyle_configuration_file}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
execute_process(COMMAND ${GIT_EXECUTABLE} config kws.overwriteRulesConf "${kwstyle_overwrite_file}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
execute_process( COMMAND ${GIT_EXECUTABLE} config kws.enabled true
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
else()
message(STATUS "KWStyle not found: disabling in git hook")
execute_process(COMMAND ${GIT_EXECUTABLE} config --unset kws.path
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
execute_process(COMMAND ${GIT_EXECUTABLE} config --unset kws.conf
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
execute_process(COMMAND ${GIT_EXECUTABLE} config --unset kws.overwriteRulesConf
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
execute_process(COMMAND ${GIT_EXECUTABLE} config kws.enabled false
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
endif()
endif()
\ No newline at end of file
......@@ -4,7 +4,7 @@
set(UNCRUSTIFY_CONFIG "${CMAKE_SOURCE_DIR}/Utilities/Uncrustify/${PROJECT_NAME}Uncrustify.cfg")
#-----------------------------------------------------------------------------
# Setup git hook for KWStyle executable path
# Setup git hook for Uncrustify executable path
#-----------------------------------------------------------------------------
find_package(Git)
if(GIT_FOUND)
......
include(ExternalProject)
#-----------------------------------------------------------------------------
# Set KWStyle Git info
#-----------------------------------------------------------------------------
set(KWStyle_GIT_REPOSITORY "${git_protocol}://github.com/Kitware/KWStyle.git")
set(KWStyle_GIT_TAG "ef373a1ece313e9d096948e639bfb575f052f581")
#-----------------------------------------------------------------------------
# Set KWStyle directories
#-----------------------------------------------------------------------------
set(KWStyle_SOURCE_DIR ${CMAKE_BINARY_DIR}/Superbuild/KWStyle)
set(KWStyle_DIR ${CMAKE_BINARY_DIR}/Superbuild/KWStyle-build)
set(KWSTYLE_EXECUTABLE ${KWStyle_DIR}/KWStyle)
#-----------------------------------------------------------------------------
# Always build KWStyle on release mode
#-----------------------------------------------------------------------------
set(_build_configuration_arg -DCMAKE_BUILD_TYPE=Release)
#-----------------------------------------------------------------------------
# Download and build KWStyle
#-----------------------------------------------------------------------------
ExternalProject_add(KWStyle
GIT_REPOSITORY ${KWStyle_GIT_REPOSITORY}
GIT_TAG ${KWStyle_GIT_TAG}
UPDATE_COMMAND ""
INSTALL_COMMAND ""
DOWNLOAD_DIR ${KWStyle_SOURCE_DIR}
SOURCE_DIR ${KWStyle_SOURCE_DIR}
BINARY_DIR ${KWStyle_DIR}
INSTALL_DIR ${KWStyle_DIR}
LOG_DOWNLOAD 1
LOG_UPDATE 0
LOG_CONFIGURE 0
LOG_BUILD 0
LOG_TEST 0
LOG_INSTALL 0
CMAKE_GENERATOR ${gen}
CMAKE_ARGS
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_COMPILER_ARG1:STRING=${CMAKE_CXX_COMPILER_ARG1}
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
-DCMAKE_C_COMPILER_ARG1:STRING=${CMAKE_C_COMPILER_ARG1}
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
${_build_configuration_arg}
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
-DBUILD_TESTING:BOOL=OFF
)
......@@ -73,11 +73,6 @@ endif()
#-----------------------------------------------------------------------------
# Define ThirdParty dependencies
#-----------------------------------------------------------------------------
# KWStyle
option(${PROJECT_NAME}_USE_KWSTYLE "Use KWStyle to check for coding standards violations." OFF)
option(USE_SYSTEM_KWSTYLE "Exclude KWStyle from superbuild and use an existing build." OFF)
mark_as_advanced(USE_SYSTEM_KWSTYLE)
# Uncrustify
option(${PROJECT_NAME}_USE_UNCRUSTIFY "Use Uncrustify to check for coding standards violations." ON)
option(USE_SYSTEM_UNCRUSTIFY "Exclude Uncrustify from superbuild and use an existing build." OFF)
......@@ -92,10 +87,6 @@ set(${PROJECT_NAME}_BINARY_INNER_SUBDIR ${PROJECT_NAME}-build)
if(${PROJECT_NAME}_SUPERBUILD)
if(${PROJECT_NAME}_USE_KWSTYLE)
include(External_KWStyle)
endif()
if(${PROJECT_NAME}_USE_UNCRUSTIFY)
include(External_Uncrustify)
endif()
......@@ -105,11 +96,6 @@ endif()
#-----------------------------------------------------------------------------
# Include ThirdParty dependencies
#-----------------------------------------------------------------------------
# KWStyle
if(${PROJECT_NAME}_USE_KWSTYLE)
include(SetupKWStyleHook)
endif()
# Uncrustify
if(${PROJECT_NAME}_USE_UNCRUSTIFY)
include(SetupUncrustifyHook)
......
<?xml version="1.0" encoding="iso-8859-1"?>
<Description>
<LineLength>100</LineLength>
<DeclarationOrder>
<public>0</public>
<protected>1</protected>
<private>2</private>
</DeclarationOrder>
<Typedefs>
<regex>[A-Z]</regex>
</Typedefs>
<InternalVariables>
<regex>m_[a-z]</regex>
<alignment>1</alignment>
</InternalVariables>
<Functions>
<regex>[a-z]</regex>
<length>100</length>
</Functions>
<SemicolonSpace>0</SemicolonSpace>
<EndOfFileNewLine>true</EndOfFileNewLine>
<Tabs>true</Tabs>
<Spaces>0</Spaces>
<Indent>
<type>SPACE</type>
<size>4</size>
<noHeader>true</noHeader>
<allowBlockLine>true</allowBlockLine>
</Indent>
<Operator>
<spaceBefore>1</spaceBefore>
<spaceAfter>1</spaceAfter>
</Operator>
<Comments>
<begin>/**</begin>
<middle> *</middle>
<end>*/<end>
<emptyLineBeforeClass>true</emptyLineBeforeClass>
<checkWrongComment>true</checkWrongComment>
<checkMissingComment>true</checkMissingComment>
</Comments>
<Namespace>imstk</Namespace>
<IfNDefDefine>[NameOfClass]_[Extension]</IfNDefDefine>
<EmptyLines>2</EmptyLines>
<Header>Utilities/KWStyle/iMSTKHeader.h,false,false</Header>
<StatementPerLine>1,true</StatementPerLine>
<BadCharacters>true</BadCharacters>
</Description>
/*=========================================================================
Library: iMSTK
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment