Working on formatting.

This commit is contained in:
jgoppert 2015-11-04 23:19:20 -05:00
parent f23bed6823
commit a703c8169e
3 changed files with 18 additions and 8 deletions

View File

@ -25,4 +25,3 @@ addons:
apt:
packages:
- cmake
- astyle

View File

@ -63,16 +63,26 @@ endif()
add_subdirectory(test)
add_custom_target(format
COMMAND scripts/format.sh 1
set(astyle_exe ${CMAKE_BINARY_DIR}/astyle/src/bin/astyle)
add_custom_command(OUTPUT ${astyle_exe}
COMMAND wget http://sourceforge.net/projects/astyle/files/astyle/astyle%202.05.1/astyle_2.05.1_linux.tar.gz -O /tmp/astyle.tar.gz
COMMAND tar -xvf /tmp/astyle.tar.gz
COMMAND cd astyle/src && make -f ../build/gcc/Makefile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
add_custom_target(check_format
COMMAND scripts/format.sh ${astyle_exe} 0
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS ${astyle_exe}
VERBATIM
)
add_custom_target(check_format
COMMAND scripts/format.sh
add_custom_target(format
COMMAND scripts/format.sh ${astyle_exe} 1
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM
DEPENDS ${astyle_exe}
)
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})

View File

@ -1,6 +1,7 @@
#!/bin/bash
echo pwd:$PWD
format=$1
astyle=$1
format=$2
format_wildcards="""
./matrix/*.*pp
./test/*.*pp
@ -9,10 +10,10 @@ format_wildcards="""
if [[ $format ]]
then
echo formatting
astyle ${format_wildcards}
$astyle ${format_wildcards}
else
echo checking format
astyle --dry-run ${format_wildcards} | grep Formatted
$astyle --dry-run ${format_wildcards} | grep Formatted
if [[ $? -eq 0 ]]
then
echo need to format