PROJECT(WINPACKAGE)

SET(WINPACKAGEDIR "${CMAKE_BINARY_DIR}/winpackage"
	CACHE STRING "Staging location for Windows package (relative to CMAKE_BINARY_DIR)"
	)

SET(CMAKE_PROJECT_NAME "${AQSIS_PROJECT_NAME_SHORT}"
	CACHE STRING "Package name for Windows"
	)

SET(AQSIS_PACKAGE_NAME "${AQSIS_PROJECT_NAME_BASIC}-setup-${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}.exe"
	CACHE STRING "Package filename for Windows"
	)

CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/setup.nsi.in.cmake" "${WINPACKAGEDIR}/setup.nsi" @ONLY)
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../header.bmp" "${WINPACKAGEDIR}/header.bmp" COPYONLY)
IF(${VERSION_MINOR} EQUAL 1 OR ${VERSION_MINOR} EQUAL 3 OR ${VERSION_MINOR} EQUAL 5 OR ${VERSION_MINOR} EQUAL 7 OR ${VERSION_MINOR} EQUAL 9)
	CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../wizard.bmp" "${WINPACKAGEDIR}/wizard.bmp" COPYONLY)
ELSE(${VERSION_MINOR} EQUAL 1 OR ${VERSION_MINOR} EQUAL 3 OR ${VERSION_MINOR} EQUAL 5 OR ${VERSION_MINOR} EQUAL 7 OR ${VERSION_MINOR} EQUAL 9)
	CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../wizard-${VERSION_MAJOR}.${VERSION_MINOR}.bmp" "${WINPACKAGEDIR}/wizard.bmp" COPYONLY)
ENDIF(${VERSION_MINOR} EQUAL 1 OR ${VERSION_MINOR} EQUAL 3 OR ${VERSION_MINOR} EQUAL 5 OR ${VERSION_MINOR} EQUAL 7 OR ${VERSION_MINOR} EQUAL 9)

IF(AQSIS_NSIS_EXECUTABLE_FOUND)
	ADD_CUSTOM_TARGET(winpackage
		WORKING_DIRECTORY ${WINPACKAGEDIR}
		COMMAND "${AQSIS_NSIS_EXECUTABLE}" setup.nsi
		)
ENDIF(AQSIS_NSIS_EXECUTABLE_FOUND)

ADD_DEPENDENCIES(winpackage aqsis aqsl aqsltell eqsl miqser piqsl teqser file_display piqsl_display all_shaders)
