1
#######################################################################
2
# A convenience target that carries out the following steps:
3
# - Apply astyle to all source files of interest.
4
# - Build & test in a chroot, comparable setup to CI/Autolanding
5
# and ppa builders. Will fail if new files have not been added.
6
# - Build & test for android.
8
# NOTE: This target is very sensitive to the availability of all
9
# all required dependencies. For that, we prefer to fail the
10
# target if deps are missing to make the problem very visible.
13
# - Wire up the style-check target once we have reached a state
14
# where trunk actually passes the style check.
15
#######################################################################
19
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
22
#######################################################################
23
# Add target for running astyle with the correct options #
24
#######################################################################
25
find_program(ASTYLE_EXECUTABLE astyle)
27
if (ASTYLE_EXECUTABLE)
30
${ASTYLE_EXECUTABLE} --style=allman -s4 --indent=spaces=4 --pad-header --align-pointer=type --recursive ${CMAKE_SOURCE_DIR}/include/*.h
31
COMMAND ${ASTYLE_EXECUTABLE} --recursive --style=allman -s4 --indent=spaces=4 --pad-header --align-pointer=type ${CMAKE_SOURCE_DIR}/tests/*.cpp
32
COMMAND ${ASTYLE_EXECUTABLE} --recursive --style=allman -s4 --indent=spaces=4 --pad-header --align-pointer=type ${CMAKE_SOURCE_DIR}/examples/*.h ${CMAKE_CURRENT_SOURCE_DIR}/examples/*.cpp
35
endif (ASTYLE_EXECUTABLE)
37
#######################################################################
38
# Add target for creating a source tarball with bzr export #
39
#######################################################################
41
pre-push-source-tarball
43
COMMAND rm -rf pre-push-build-area
44
COMMAND mkdir pre-push-build-area
45
COMMAND bzr export --root pre-push pre-push-build-area/${PROJECT_NAME}_${DBUS_CPP_VERSION_MAJOR}.${DBUS_CPP_VERSION_MAJOR}.${DBUS_CPP_VERSION_MAJOR}.orig.tar.bz2 ${CMAKE_SOURCE_DIR}
46
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
47
COMMENT "Preparing source tarball for pre-push build & test"
50
#######################################################################
51
# Add target for extracting source tarball for pdebuild #
52
#######################################################################
54
extract-pre-push-tarball
55
COMMAND tar -xf {PROJECT_NAME}_${DBUS_CPP_VERSION_MAJOR}.${DBUS_CPP_VERSION_MAJOR}.${DBUS_CPP_VERSION_MAJOR}.orig.tar.bz2
56
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/pre-push-build-area VERBATIM
59
#######################################################################
60
# Builds & tests the last committed revision of the current branch #
61
#######################################################################
62
find_program(PDEBUILD_EXECUTABLE pdebuild)
63
if(NOT PDEBUILD_EXECUTABLE)
64
message(STATUS "pdebuild NOT found, pre-push is going to FAIL")
69
COMMAND ${PDEBUILD_EXECUTABLE}
70
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/pre-push-build-area/pre-push
71
COMMENT "Building & testing in chroot'd environment"
75
#######################################################################
76
# pdebuild: make tarball -> extract to build area -> pdebuild #
77
# android-build: invoke cross-compile script #
78
#######################################################################
79
add_dependencies(extract-pre-push-tarball pre-push-source-tarball)
80
add_dependencies(pdebuild extract-pre-push-tarball)
82
add_dependencies(pre-push pdebuild android-build)