#!/usr/bin/make -f

%:
	dh $@ --parallel --builddirectory=Build

CMAKE_EXTRA_FLAGS += \
	-DSTATIC_BUILD:BOOL=OFF \
	-DSTANDALONE_BUILD:BOOL=ON \
	-DUSE_DYNAMIC_JSONCPP:BOOL=ON \
	-DUSE_DYNAMIC_LUA:BOOL=ON \
	-DUSE_DYNAMIC_MONGOOSE:BOOL=OFF \
	-DDEBIAN_USE_GTEST_SOURCE_PACKAGE:BOOL=ON \
	-DCMAKE_BUILD_TYPE=RelWithDebInfo \
	-DDCMTK_LIBRARIES="wrap;oflog"

override_dh_auto_configure:
	# Put 3rd party packages where the cmake build system expects them
	mkdir -p ThirdPartyDownloads
	( cd ThirdPartyDownloads; cp ../debian/ThirdPartyDownloads/* . )
	dh_auto_configure -- $(CMAKE_EXTRA_FLAGS)

override_dh_auto_test:
	( cd Build; ./UnitTests )

override_dh_clean:
	rm -rf ThirdPartyDownloads
	dh_clean

override_dh_auto_install:
	dh_install Build/Orthanc usr/sbin

override_dh_installchangelogs:
	dh_installchangelogs -k NEWS

get-orig-source:
	uscan --verbose --force-download --rename
