From a3b1bf65830ab5b03f2d38740061e2771c605e19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delabre=20=E2=9C=8F?= Date: Mon, 30 May 2016 00:33:42 +0200 Subject: [PATCH] Ajout des instructions de packaging pour les .deb --- CMakeLists.txt | 74 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 65 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 151fb60..9f4ee7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,25 +27,81 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) elseif(COMPILER_SUPPORTS_CXX0X) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") else() - message(STATUS "Votre version de gcc/g++ ne supporte pas C++11. Le projet ne compilera probablement pas.") + message(STATUS "Votre version de gcc ne supporte pas C++11. \ + Le projet ne compilera probablement pas. Les versions de gcc \ + compatibles sont 4.6 et supérieures.") endif() endif() # Recherche des librairies -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}" ${CMAKE_MODULE_PATH}) -add_executable(skizzle ${SOURCES}) +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) +add_executable(${CMAKE_PROJECT_NAME} ${SOURCES}) find_package(SFML 2.3.2 REQUIRED system window graphics network audio) -find_package(Boost 1.60.0 COMPONENTS system filesystem) +find_package(Boost 1.58.0 COMPONENTS system filesystem) find_package(SFGUI 0.2.3 REQUIRED) include_directories(${SFML_INCLUDE_DIR}) include_directories(${Boost_INCLUDE_DIRS}) include_directories(${SFGUI_INCLUDE_DIR}) -target_link_libraries(skizzle ${SFML_LIBRARIES}) -target_link_libraries(skizzle ${Boost_LIBRARIES}) -target_link_libraries(skizzle ${SFGUI_LIBRARY}) +target_link_libraries(${CMAKE_PROJECT_NAME} ${SFML_LIBRARIES}) +target_link_libraries(${CMAKE_PROJECT_NAME} ${Boost_LIBRARIES}) +target_link_libraries(${CMAKE_PROJECT_NAME} ${SFGUI_LIBRARY}) -# Installation de l'exécutable -install(TARGETS skizzle DESTINATION bin) +# Informations pour la création des packages +set(CPACK_PACKAGE_CONTACT "Maëlle Beuret, Rémi Cérès, Mattéo Delabre") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Skizzle est un jeu inspiré des jeux de \ +plateformes, des jeux de réflexion et de coopération.") +set(CPACK_DEBIAN_PACKAGE_DEPENDS) +set(CPACK_PACKAGE_VERSION_MAJOR "0") +set(CPACK_PACKAGE_VERSION_MINOR "1") +set(CPACK_PACKAGE_VERSION_PATCH "0") + +# Création des packages en fonction du système actuel +if(WIN32) + set(CPACK_GENERATOR "NSIS") + + ############################################# + # TODO: ajout des instructions pour Windows # + ############################################# + +elseif(UNIX AND NOT APPLE) + set(CPACK_GENERATOR "DEB") + set(CPACK_DEBIAN_PACKAGE_SECTION "games") + + # Installation de l'exécutable + install(TARGETS ${CMAKE_PROJECT_NAME} DESTINATION games) + + # Installation de la documentation et des ressources + install(FILES README.md DESTINATION share/${CMAKE_PROJECT_NAME}) + install(DIRECTORY res docs DESTINATION share/${CMAKE_PROJECT_NAME}) + + # Installation des icônes + install(FILES cmake/${CMAKE_PROJECT_NAME}.svg DESTINATION share/pixmaps) + install( + FILES cmake/${CMAKE_PROJECT_NAME}-128.png + RENAME ${CMAKE_PROJECT_NAME}.png + DESTINATION share/pixmaps + ) + + foreach(ICON_SIZE 16 32 48 64 128 256 512) + install( + FILES cmake/${CMAKE_PROJECT_NAME}-${ICON_SIZE}.png + RENAME ${CMAKE_PROJECT_NAME}.png + DESTINATION share/icons/hicolor/${ICON_SIZE}x${ICON_SIZE}/apps + ) + endforeach(ICON_SIZE) + + # Installation du fichier d'application + install( + FILES cmake/${CMAKE_PROJECT_NAME}.desktop + DESTINATION share/applications + ) +else() + message(STATUS "Votre plateforme n'a pas été configurée pour produire \ + des packages. La commande 'make package' ne fonctionnera pas, mais le \ + projet peut compiler et vous serez en mesure de l'exécuter.") +endif() + +include(CPack)