diff --git a/CMakeLists.txt b/CMakeLists.txt index 99edb4af..2c40a9ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,8 +109,16 @@ set(CMAKE_PREFIX_PATH "$ENV{QT_DIR}/") find_package(Qt5Widgets) find_package(Qt5PrintSupport) - -add_executable(${APP_PROJECT_NAME} ${APP_FILES}) +if (WIN32) + file(WRITE ${CMAKE_SOURCE_DIR}/build/Coati.rc + "// Icon with lowest ID value placed first to ensure application icon\n" + "// remains consistent on all systems.\n" + "IDI_ICON1 ICON \"${CMAKE_SOURCE_DIR}/build/coati.ico\"\n" + ) + add_executable(${APP_PROJECT_NAME} ${APP_FILES} ${CMAKE_SOURCE_DIR}/build/Coati.rc) +else () + add_executable(${APP_PROJECT_NAME} ${APP_FILES}) +endif () create_source_groups(${APP_FILES}) diff --git a/script/create_windows_icon.sh b/script/create_windows_icon.sh new file mode 100644 index 00000000..6b8686d5 --- /dev/null +++ b/script/create_windows_icon.sh @@ -0,0 +1,20 @@ +MY_PATH=`dirname "$0"` + +ICON_INPUT_PATH=$MY_PATH/../bin/app/data/gui/icon +ICON_OUTPUT_PATH=$MY_PATH/../build +ICON_SIZES_PATH=$ICON_INPUT_PATH/sizes + +mkdir -p $ICON_SIZES_PATH + +convert $ICON_INPUT_PATH/logo_1024_1024.png -resize 16x16 $ICON_SIZES_PATH/icon_16.png +convert $ICON_INPUT_PATH/logo_1024_1024.png -resize 24x24 $ICON_SIZES_PATH/icon_24.png +convert $ICON_INPUT_PATH/logo_1024_1024.png -resize 32x32 $ICON_SIZES_PATH/icon_32.png +convert $ICON_INPUT_PATH/logo_1024_1024.png -resize 40x40 $ICON_SIZES_PATH/icon_40.png +convert $ICON_INPUT_PATH/logo_1024_1024.png -resize 48x48 $ICON_SIZES_PATH/icon_48.png +convert $ICON_INPUT_PATH/logo_1024_1024.png -resize 64x64 $ICON_SIZES_PATH/icon_64.png +convert $ICON_INPUT_PATH/logo_1024_1024.png -resize 128x128 $ICON_SIZES_PATH/icon_128.png +convert $ICON_INPUT_PATH/logo_1024_1024.png -resize 256x256 $ICON_SIZES_PATH/icon_256.png + +convert $ICON_SIZES_PATH/icon_16.png $ICON_SIZES_PATH/icon_24.png $ICON_SIZES_PATH/icon_32.png $ICON_SIZES_PATH/icon_40.png $ICON_SIZES_PATH/icon_48.png $ICON_SIZES_PATH/icon_64.png $ICON_SIZES_PATH/icon_128.png $ICON_SIZES_PATH/icon_256.png -colors 256 $ICON_OUTPUT_PATH/coati.ico + +rm -rf $ICON_SIZES_PATH diff --git a/script/setup.sh b/script/setup.sh index 958624c8..adaedde1 100755 --- a/script/setup.sh +++ b/script/setup.sh @@ -48,6 +48,9 @@ if [ $PLATFORM == "Windows" ]; then echo -e $INFO "copy test_main file" cp -u setup/cxx_test/windows/test_main.cpp build + + echo -e $INFO "creating program icon" + sh script/create_windows_icon.sh fi # Setup both Debug and Release configuration