#!/usr/bin/make -f

DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)

# SSE support enabled only for amd64
SSE_FLAGS =

ifeq ($(DEB_HOST_ARCH),amd64)
SSE_FLAGS = -mfpmath=sse -msse -msse2 -msse3 -mssse3 -DSSE
endif

.PHONY: override_dh_auto_configure	\
	override_dh_auto_build-indep	\
	override_dh_install		\
	override_dh_strip		\
	override_dh_auto_test

override_dh_auto_configure:
	dh_auto_configure -- \
                -DENABLE_TESTS_COMPILATION:BOOL=False \
                -DUSE_HOST_CFLAGS:BOOL=False \
                -DUSE_UPSTREAM_CFLAGS:BOOL=False \
                -DCMAKE_BUILD_TYPE=RelWithDebInfo \
                -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="$(SSE_FLAGS)"

override_dh_auto_build-indep:
	dh_auto_build -- doc # Generate Doxygen HTML documentation.

override_dh_install:
	dh_install -- # Install

        # Get rid of fonts already packaged elsewhere.
	rm -f debian/gazebo7-common/usr/share/gazebo-*/media/gui/fonts/DejaVuSans.ttf

override_dh_auto_test:
	# Tests needs an X server running and GPU acceleration
	true

%:
	dh $@ --parallel --buildsystem=cmake --with bash-completion
