#OPTION(HTTRAQT_INSTALL_AQSIS "Include Aqsis in the K-3D installer" OFF)
#OPTION(HTTRAQT_INSTALL_CGKIT "Include cgkit in the K-3D installer" OFF)
#OPTION(HTTRAQT_INSTALL_PYGTK "Include PyGTK in the K-3D installer" OFF)
#OPTION(HTTRAQT_INSTALL_PYOPENGL "Include PyOpenGL in the K-3D installer" OFF)
#OPTION(HTTRAQT_INSTALL_PYTHON "Include Python in the K-3D installer" ON)
OPTION(HTTRAQT_CREATE_PACKAGEMAKER_PACKAGE "Include an option to build a MacOSX PackageMaker package." OFF)

SET(HTTRAQT_BINARY_LOCATIONS )
LIST(APPEND HTTRAQT_BINARY_LOCATIONS "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/httraqt")
LIST(APPEND HTTRAQT_BINARY_LOCATIONS "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/httraqt-make-module-proxy")
LIST(APPEND HTTRAQT_BINARY_LOCATIONS "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/httraqt-renderframe")
LIST(APPEND HTTRAQT_BINARY_LOCATIONS "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/httraqt-renderjob")
LIST(APPEND HTTRAQT_BINARY_LOCATIONS "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/httraqt-resource-compiler")
LIST(APPEND HTTRAQT_BINARY_LOCATIONS "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/httraqt-sl2xml")
LIST(APPEND HTTRAQT_BINARY_LOCATIONS "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/httraqt-uuidgen")

FILE(GLOB_RECURSE HTTRAQT_PLUGIN_BINARIES "${HTTRAQT_BINARY_DIR}/${HTTRAQT_LIBDIR}/httraqt/plugins/*.module")
LIST(APPEND HTTRAQT_BINARY_LOCATIONS ${HTTRAQT_PLUGIN_BINARIES})

# Enable automatic installation of library dependencies ...
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/dependencies.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/dependencies.cmake" @ONLY)
INSTALL(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/dependencies.cmake")

# Install some runtime dependencies that can't be detected via static analysis ...

# This is an ugly hack, we should be able to detect this automatically, but I'm feeling lazy ...
SET(HTTRAQT_MACPORTS_DIR "/opt/local" CACHE PATH "Root directory containing installed MacPorts packages")
MARK_AS_ADVANCED(HTTRAQT_MACPORTS_DIR)

INSTALL(
	PROGRAMS
		${HTTRAQT_MACPORTS_DIR}/lib/libgailutil.18.dylib
	DESTINATION
		lib
	)

INSTALL(
	DIRECTORY
		${HTTRAQT_MACPORTS_DIR}/lib/gtk-2.0/2.10.0
	DESTINATION
		lib/gtk-2.0
	USE_SOURCE_PERMISSIONS
	)

INSTALL(
	DIRECTORY
		${HTTRAQT_MACPORTS_DIR}/lib/gtk-2.0/modules
	DESTINATION
		lib/gtk-2.0/2.10.0
	USE_SOURCE_PERMISSIONS
	)

INSTALL(
	DIRECTORY
		${HTTRAQT_MACPORTS_DIR}/lib/pango
	DESTINATION
		lib
	USE_SOURCE_PERMISSIONS
	)

INSTALL(
	DIRECTORY
		${HTTRAQT_MACPORTS_DIR}/etc/gtk-2.0
		${HTTRAQT_MACPORTS_DIR}/etc/fonts
		${HTTRAQT_MACPORTS_DIR}/etc/pango
	DESTINATION
		etc
	)

# Bundle packaging is always available ...
ADD_SUBDIRECTORY(bundle)

# We optionally support creating packagemaker packages ...
IF(HTTRAQT_CREATE_PACKAGEMAKER_PACKAGE)
	ADD_SUBDIRECTORY(packagemaker)
ENDIF(HTTRAQT_CREATE_PACKAGEMAKER_PACKAGE)

