INCLUDE(InstallRequiredSystemLibraries)

IF (WIN32)
  SET(CPACK_GENERATOR "NSIS")
  SET(CPACK_SOURCE_GENERATOR "ZIP")
ENDIF (WIN32)

IF (UNIX)
  SET(CPACK_GENERATOR "TGZ;DEB;RPM")
  SET(CPACK_SOURCE_GENERATOR "ZIP;TGZ;TBZ2")
ENDIF (UNIX)

IF (APPLE)
  SET(CPACK_GENERATOR "OSXX11")
ENDIF (APPLE)

SET(CPACK_STRIP_FILES "1")
SET(CPACK_PACKAGE_NAME "VLE")
SET(CPACK_PACKAGE_VENDOR "VLE Development Team")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "VLE - Virtual Laboratory Environment")
SET(CPACK_PACKAGE_CONTACT "Gauthier Quesnel <quesnel@users.sourceforge.net>")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README")
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
SET(CPACK_PACKAGE_FILE_NAME "${VLE_NAME_COMPLETE}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
SET(CPACK_PACKAGE_VERSION_MAJOR "${VLE_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${VLE_MINOR}")

IF ("${VLE_EXTRA}" STREQUAL "")
  SET(CPACK_PACKAGE_VERSION_PATCH "${VLE_PATCH}")
ELSE ("${VLE_EXTRA}" STREQUAL "")
  SET(CPACK_PACKAGE_VERSION_PATCH "${VLE_PATCH}-${VLE_EXTRA}")
ENDIF ("${VLE_EXTRA}" STREQUAL "")

SET(CPACK_PACKAGE_INSTALL_DIRECTORY ${VLE_NAME_COMPLETE})
SET(CPACK_PACKAGE_EXECUTABLES "vle" "VLE" "oov" "OOV" "eov" "EOV" "gvle" "GVLE")

# CPack source configuration
SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${VLE_NAME_COMPLETE})
SET(CPACK_SOURCE_IGNORE_FILES "\\\\.swp$;/\\\\.gitignore;/build/;/\\\\.git/")

# CPack DEB configuration
SET(CPACK_DEBIAN_PACKAGE_NAME ${VLE_NAME}-${VLE_MAJOR}.${VLE_MINOR})
SET(CPACK_DEBIAN_PACKAGE_VERSION ${VLE_COMPLETE})
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "")
SET(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS "")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Gauthier Quesnel <quesnel@users.sourceforge.net>")
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "VLE, a framework for multi-modeling, simulation and analysis of complex dynamical systems.")
SET(CPACK_DEBIAN_PACKAGE_SECTION "libs")
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "extra")

# CPack RPM configuration
SET(CPACK_RPM_PACKAGE_SUMMARY "VLE, a framework for multi-modeling, simulation and analysis of complex dynamical systems.")
SET(CPACK_RPM_PACKAGE_NAME ${VLE_NAME}-${VLE_MAJOR}.${VLE_MINOR})
SET(CPACK_RPM_PACKAGE_VERSION ${VLE_MAJOR}.${VLE_MINOR}.${VLE_PATCH})
SET(CPACK_RPM_PACKAGE_RELEASE "1")
SET(CPACK_RPM_PACKAGE_VENDOR "Gauthier Quesnel <quesnel@users.sourceforge.net>")
SET(CPACK_RPM_PACKAGE_LICENSE "GNU General Public License (GPL)")
SET(CPACK_RPM_PACKAGE_DESCRIPTION "VLE, a framework for multi-modeling, simulation and analysis of complex dynamical systems.")

# CPack NSIS configuration
IF (CPACK_GENERATOR MATCHES "NSIS")
  SET(CMAKE_MODULE_PATH "share")
  SET(VLE_BOOST_INCLUDE_DIR CACHE PATH "Boost include directory")
  SET(VLE_BOOST_LIBRARY_DIR CACHE PATH "Boost library directory")
  SET(VLE_MINGW_PATH CACHE PATH "Mingw Boost directory")
  SET(VLE_GTK_PATH CACHE PATH "Gtk directory")
  SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/share)

  INSTALL(DIRECTORY "${VLE_BOOST_INCLUDE_DIR}/" DESTINATION include)
  INSTALL(DIRECTORY "${VLE_BOOST_LIBRARY_DIR}/" DESTINATION bin
    FILES_MATCHING PATTERN "libboost*.dll")
  INSTALL(DIRECTORY "${VLE_BOOST_LIBRARY_DIR}/" DESTINATION lib
    FILES_MATCHING PATTERN "libboost*.a")

  INSTALL(FILES "${VLE_MINGW_PATH}/bin\\\\mingwm10.dll" DESTINATION bin)

  INSTALL(DIRECTORY "${VLE_GTK_PATH}/include/" DESTINATION include)
  INSTALL(DIRECTORY "${VLE_GTK_PATH}/redist/" DESTINATION bin)

  INSTALL(FILES "${VLE_GTK_PATH}/bin\\\\pkg-config.exe" DESTINATION bin)

  INSTALL(DIRECTORY "${VLE_GTK_PATH}/lib/" DESTINATION lib
    PATTERN "*.def" EXCLUDE
    PATTERN "*.lib" EXCLUDE)

  INSTALL(DIRECTORY "${VLE_GTK_PATH}/etc\\\\gtk-2.0" DESTINATION etc)
  INSTALL(DIRECTORY "${VLE_GTK_PATH}/etc\\\\pango" DESTINATION etc)

  INSTALL(DIRECTORY "${VLE_GTK_PATH}/share\\\\doc" DESTINATION share)
  INSTALL(DIRECTORY "${VLE_GTK_PATH}/share\\\\locale" DESTINATION share)
  INSTALL(DIRECTORY "${VLE_GTK_PATH}/share\\\\themes" DESTINATION share)

  SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/share/pixmaps\\\\vle.ico")
  SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/share/pixmaps\\\\vle.ico")
  SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/share/pixmaps\\\\logo.bmp")
  SET(CPACK_NSIS_MENU_LINKS "${VLE_SHARE_DIRS}/doc/vle.chm" "VLE API" "http://www.sourceforge.net/projects/vle" "VLE Web Site")
  SET(CPACK_CREATE_DESKTOP_LINKS gvle)
  SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\vle.exe")
  SET(CPACK_NSIS_DISPLAY_NAME "VLE - Virtual Laboratory Environment")
  SET(CPACK_NSIS_HELP_LINK "http://www.sourceforge.net/projects/vle")
  SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.sourceforge.net/projects/vle")
  SET(CPACK_NSIS_CONTACT "Gauthier Quesnel <quesnel@users.sourceforge.net>")
  SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME} ${VLE_VERSION_SHORT}.0")
  SET(CPACK_NSIS_MODIFY_PATH ON)
ENDIF (CPACK_GENERATOR MATCHES "NSIS")

INCLUDE(CPack)

# vim:tw=0:ts=8:tw=0:sw=2:sts=2
