#!/bin/sh
set -eu

WVER=${WVER:-w64}

CBUILD=`uname -p`-unknown-linux-gnu
if [ ${WVER} = "w64" ]; then
	CHOST="x86_64-w64-mingw32"
	CMAKE_TOOLCHAIN_FILE="../windows64.cmake"
elif [ ${WVER} = "w32" ]; then
	CHOST="i686-w64-mingw32"
	CMAKE_TOOLCHAIN_FILE="../windows32.cmake"
else
	echo "ERROR: unsupport WVER provided"
	exit 1
fi

# -fstack-protector-strong adds libssp which is needed for -D_FORTIFY_SOURCE=2.
# The -Bstatic option ensures that the library is statically linked so that we
# don't have to distribute the DLL.
HARDENING_FLAGS="-D_FORTIFY_SOURCE=2 -Wl,-Bstatic,--dynamicbase,--nxcompat -fstack-protector-strong"
