#!/usr/bin/make -f

export DEB_CXXFLAGS_MAINT_APPEND := -Wno-error=range-loop-construct -Wno-error=deprecated-declarations

%:
	dh $@ --with autoreconf

override_dh_auto_build:
	cd tools/Vitis-AI-Runtime/VART/unilog; \
	    ./cmake.sh --type=release \
	        --cmake-options -DIS_EDGE=TRUE \
	        --build-dir=$(CURDIR)/debian/build-unilog/ \
	        --install-prefix=$(CURDIR)/debian/tmp/usr/ \
	        --cmake-options='-DBUILD_TEST=OFF'
	cd tools/Vitis-AI-Runtime/VART/xir; \
	    ./cmake.sh --type=release \
	        --cmake-options -DIS_EDGE=TRUE \
	        --build-dir=$(CURDIR)/debian/build-xir/ \
	        --install-prefix=$(CURDIR)/debian/tmp/usr/ \
	        --cmake-options='-DBUILD_TEST=OFF' \
	        --build-python
	cd tools/Vitis-AI-Runtime/VART/target_factory; \
	    ./cmake.sh --type=release \
	        --cmake-options -DIS_EDGE=TRUE \
	        --build-dir=$(CURDIR)/debian/build-target_factory/ \
                --install-prefix=$(CURDIR)/debian/tmp/usr/ \
	        --cmake-options='-DBUILD_TEST=OFF'
	cd tools/Vitis-AI-Runtime/VART/vart; \
	    ./cmake.sh --type=release \
	        --cmake-options -DIS_EDGE=TRUE \
	        --build-dir=$(CURDIR)/debian/build-vart/ \
                --install-prefix=$(CURDIR)/debian/tmp/usr/ \
	        --cmake-options='-DBUILD_TEST=OFF -DENABLE_DPU_RUNNER=ON -DENABLE_CPU_RUNNER=OFF -DENABLE_SIM_RUNNER=OFF' \
	        --build-python
	cd tools/Vitis-AI-Library; \
	    ./cmake.sh --type=release \
	        --cmake-options '-DBUILD_TEST=OFF -DIS_EDGE=TRUE' \
	        --build-dir=$(CURDIR)/debian/build-library/ \
	        --install-prefix=$(CURDIR)/debian/tmp/usr/ \
	        --build-python

override_dh_auto_clean:
	rm -rf $(CURDIR)/debian/build-*

# dh_prep removes debian/tmp, and we do not want that
override_dh_prep:
