From ee90f02bc4f45ff0b68099e47245869236bcbbfd Mon Sep 17 00:00:00 2001 From: Didier 'OdyX' Raboud Date: Tue, 29 Oct 2013 14:30:58 +0100 Subject: Add an icon and executable information to the colobot.exe when build in MXE --- CMakeLists.txt | 6 +- desktop/CMakeLists.txt | 144 ++++++++++++++++++++++++----------------------- desktop/colobot.ico | Bin 0 -> 353118 bytes desktop/colobot.rc.cmake | 25 ++++++++ src/CMakeLists.txt | 7 +++ 5 files changed, 108 insertions(+), 74 deletions(-) create mode 100644 desktop/colobot.ico create mode 100644 desktop/colobot.rc.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 250211f..70244bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -321,11 +321,7 @@ add_subdirectory(src) add_subdirectory(po) if(DESKTOP) - if(PLATFORM_WINDOWS) - message("Desktop files ignored on Windows") - else() - add_subdirectory(desktop) - endif() + add_subdirectory(desktop) endif() diff --git a/desktop/CMakeLists.txt b/desktop/CMakeLists.txt index 6d2ece0..bf9be06 100644 --- a/desktop/CMakeLists.txt +++ b/desktop/CMakeLists.txt @@ -1,75 +1,81 @@ cmake_minimum_required(VERSION 2.8) -# Install Desktop Entry file -set(COLOBOT_DESKTOP_FILE colobot.desktop) -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE} - COMMAND ./create_desktop_file.sh > ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE} - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - COMMENT "Build ${COLOBOT_DESKTOP_FILE}" - ) -add_custom_target(desktopfile ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE}) -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE} - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications/ - ) - -# Install Icon -set(COLOBOT_ICON_FILE colobot.svg) -install( - FILES ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE} - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/ - ) - -# Render SVG icon in various sizes -find_program(RSVG_CONVERT rsvg-convert) -if(RSVG_CONVERT) - foreach(PNGSIZE "48" "32" "16") - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}) - add_custom_target(resize_icon_${PNGSIZE} ALL - COMMAND ${RSVG_CONVERT} -w ${PNGSIZE} -h ${PNGSIZE} ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE} - > ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png - ) - install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNGSIZE}x${PNGSIZE}/apps/ - ) - endforeach() -endif() - -# Create manpage from pod-formatted file -find_program(POD2MAN pod2man) -if(POD2MAN) - set(COLOBOT_MANPAGE_SECTION 6) - - macro(podman) - cmake_parse_arguments(PM "" "PODFILE;LOCALE;" "" ${ARGN}) - if(PM_LOCALE) - # This copes with the fact that english has no "/LANG" in the paths and filenames. - set(SLASHLOCALE /${PM_LOCALE}) - endif() - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}) - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PM_PODFILE} - COMMAND ${POD2MAN} ARGS --section=${COLOBOT_MANPAGE_SECTION} - --center="Colobot" --stderr --utf8 - --release="${COLOBOT_VERSION_FULL}" - ${CMAKE_CURRENT_SOURCE_DIR}/${PM_PODFILE} - ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION} - COMMENT "Create ${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION} manpage" - ) - add_custom_target(man${PM_LOCALE} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}) - - install( - FILES ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION} - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man${SLASHLOCALE}/man${COLOBOT_MANPAGE_SECTION}/ ) - - add_dependencies(man man${PM_LOCALE}) - endmacro() - - # Create the english manpage - podman(PODFILE colobot.pod) +if(NOT PLATFORM_WINDOWS) + # Install Desktop Entry file + set(COLOBOT_DESKTOP_FILE colobot.desktop) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE} + COMMAND ./create_desktop_file.sh > ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "Build ${COLOBOT_DESKTOP_FILE}" + ) + add_custom_target(desktopfile ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE}) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${COLOBOT_DESKTOP_FILE} + DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications/ + ) + + # Install Icon + set(COLOBOT_ICON_FILE colobot.svg) + install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE} + DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/ + ) + + # Render SVG icon in various sizes + find_program(RSVG_CONVERT rsvg-convert) + if(RSVG_CONVERT) + foreach(PNGSIZE "48" "32" "16") + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}) + add_custom_target(resize_icon_${PNGSIZE} ALL + COMMAND ${RSVG_CONVERT} -w ${PNGSIZE} -h ${PNGSIZE} ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE} + > ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png + ) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png + DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNGSIZE}x${PNGSIZE}/apps/ + ) + endforeach() + endif() + + # Create manpage from pod-formatted file + find_program(POD2MAN pod2man) + if(POD2MAN) + set(COLOBOT_MANPAGE_SECTION 6) + + macro(podman) + cmake_parse_arguments(PM "" "PODFILE;LOCALE;" "" ${ARGN}) + if(PM_LOCALE) + # This copes with the fact that english has no "/LANG" in the paths and filenames. + set(SLASHLOCALE /${PM_LOCALE}) + endif() + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PM_PODFILE} + COMMAND ${POD2MAN} ARGS --section=${COLOBOT_MANPAGE_SECTION} + --center="Colobot" --stderr --utf8 + --release="${COLOBOT_VERSION_FULL}" + ${CMAKE_CURRENT_SOURCE_DIR}/${PM_PODFILE} + ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION} + COMMENT "Create ${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION} manpage" + ) + add_custom_target(man${PM_LOCALE} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION}) + + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}${SLASHLOCALE}/colobot.${COLOBOT_MANPAGE_SECTION} + DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man${SLASHLOCALE}/man${COLOBOT_MANPAGE_SECTION}/ ) + + add_dependencies(man man${PM_LOCALE}) + endmacro() + + # Create the english manpage + podman(PODFILE colobot.pod) + + endif() +else() # if(NOT PLATFORM_WINDOWS) + set(COLOBOT_VERSION_4COMMAS "${COLOBOT_VERSION_MAJOR},${COLOBOT_VERSION_MINOR},${COLOBOT_VERSION_REVISION},0") + configure_file(colobot.rc.cmake ${CMAKE_CURRENT_BINARY_DIR}/colobot.rc) endif() # Translate translatable material diff --git a/desktop/colobot.ico b/desktop/colobot.ico new file mode 100644 index 0000000..54ab418 Binary files /dev/null and b/desktop/colobot.ico differ diff --git a/desktop/colobot.rc.cmake b/desktop/colobot.rc.cmake new file mode 100644 index 0000000..40860e5 --- /dev/null +++ b/desktop/colobot.rc.cmake @@ -0,0 +1,25 @@ +id ICON "@CMAKE_CURRENT_SOURCE_DIR@/colobot.ico" + +1 VERSIONINFO +FILEVERSION @COLOBOT_VERSION_4COMMAS@ +PRODUCTVERSION @COLOBOT_VERSION_4COMMAS@ +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "OriginalFilename", "colobot.exe\0" + VALUE "InternalName", "colobot\0" + VALUE "FileDescription", "Colobot - Colonize with Bots\0" + VALUE "ProductName", "Colobot\0" + VALUE "CompanyName", "Polish Portal of Colobot\0" + VALUE "LegalCopyright", "Copyright (c) 2012-2013 Polish Portal of Colobot\0" + VALUE "FileVersion", "@COLOBOT_VERSION_FULL@\0" + VALUE "ProductVersion", "@COLOBOT_VERSION_FULL@\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c01fe0f..2fab853 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -50,6 +50,12 @@ if(OPENAL_SOUND) ) endif() +set(RES_FILES "") + +if(PLATFORM_WINDOWS) + set(RES_FILES "../desktop/colobot.rc") +endif() + # Platform-dependent implementation of system.h if(PLATFORM_WINDOWS) set(SYSTEM_CPP_MODULE "system_windows.cpp") @@ -182,6 +188,7 @@ ui/studio.cpp ui/target.cpp ui/window.cpp ${OPENAL_SRC} +${RES_FILES} ) -- cgit v1.2.3-1-g7c22 From 9e9a9937ba94a3d800fce33c7f74cc32e2fef14c Mon Sep 17 00:00:00 2001 From: Didier 'OdyX' Raboud Date: Tue, 29 Oct 2013 14:43:24 +0100 Subject: Revert "Include SDL.h in main.cpp to make sure the main loop is SDL's main loop" This was the wrong fix for the problem. This reverts commit f31a570d96e1a0ee28baecefa18b7e8c586c201c. --- src/app/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index 1e70beb..5c0afd3 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -28,7 +28,6 @@ #include "common/misc.h" #include "common/restext.h" -#include /* Doxygen main page */ -- cgit v1.2.3-1-g7c22 From 4680137ca4c4941947e53def97a0f5eadbbe9f2e Mon Sep 17 00:00:00 2001 From: Didier 'OdyX' Raboud Date: Tue, 29 Oct 2013 14:54:11 +0100 Subject: On MacOSX, use SDL_Main --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70244bd..173fb1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,8 @@ elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") set(PLATFORM_LINUX 0) set(PLATFORM_MACOSX 1) set(PLATFORM_OTHER 0) + + set(USE_SDL_MAIN 1) # fixes SDL_main else() message(STATUS "Build for other system") set(PLATFORM_WINDOWS 0) -- cgit v1.2.3-1-g7c22