Windows cmake changes.

This commit is contained in:
Shaun Reed 2025-03-14 14:56:09 -04:00
parent ea25ba312a
commit 16b20e3808
18 changed files with 72 additions and 12 deletions

View File

@ -83,6 +83,8 @@ endif ()
set(QTK_RESOURCES "${CMAKE_SOURCE_DIR}/resources")
set(QTK_OSX_ICONS ${CMAKE_SOURCE_DIR}/resources/icons/osx/kilroy.icns)
string(TIMESTAMP YEAR "%Y")
set(QTK_COPYRIGHT "All Content © 2021-${YEAR} Shaun Reed, all rights reserved.")
# Point CMAKE_PREFIX_PATH to Qt6 install directory
# If Qtk is built within Qt Creator this is not required.

BIN
resources/icons/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
# $1: Input path to an image to use for generating icons.
# Helper script to generate qtk's icons for Linux given a path to an input PNG.
sudo apt install imagemagick
convert "$1" -resize 256x256 kilroy-256.png
convert "$1" -resize 128x128 kilroy-128.png
convert "$1" -resize 64x64 kilroy-64.png
convert "$1" -resize 48x48 kilroy-48.png
convert "$1" -resize 32x32 kilroy-32.png
convert "$1" -resize 16x16 kilroy-16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# $1: Input path to an image to use for generating icons.
# Helper script to generate qtk's icons for OSX given a path to an input PNG.
sudo apt install icnsutils imagemagick
convert "$1" -resize 32x32 kilroy_32.png
convert "$1" -resize 16x16 kilroy_16.png
convert "$1" -resize 48x48 kilroy_48.png
convert "$1" -resize 128x128 kilroy_128.png
convert "$1" -resize 256x256 kilroy_256.png
# For the application bundle in OSX.
png2icns png2icns kilroy.icns kilroy_*.png
# For the splash image in DMG installers.
convert "$1" -resize 800x600! kilroy_splash.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
# $1: Input path to an image to use for generating icons.
# Helper script to generate qtk's icons for OSX given a path to an input PNG.
sudo apt install imagemagick
# For the NSIS (un)installer executable shortcut icon.
convert "$1" -resize 256x256,128x128,64x64,48x48,32x32,16x16 -background transparent -colors 256 kilroy.ico
# For the NSIS installer splash screen.
convert "$1" -resize 164x314! -background white -flatten kilroy_splash.bmp

6
resources/qtk.desktop Normal file
View File

@ -0,0 +1,6 @@
[Desktop Entry]
Name=Qtk
Exec=/usr/bin/qtk_gui
Icon=qtk
Type=Application
Categories=Utility;

View File

@ -106,37 +106,45 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VENDOR "Shaun Reed")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Qt OpenGL 3D graphics library.")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/shaunrd0/qtk")
if (QTK_GUI)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Qt OpenGL 3D graphics renderer.")
else()
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Qt OpenGL 3D graphics library.")
endif()
set(CPACK_PACKAGE_HOMEPAGE_URL "https://git.shaunreed.com/shaunrd0/qtk")
set(CPACK_SOURCE_IGNORE_FILES build*;install;\.git;\.github;\.idea)
set(CPACK_PACKAGE_DIRECTORY packages/)
set(CPACK_PACKAGE_CONTACT "shaunreed.com")
#set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/icon.png")
set(CPACK_THREADS 0)
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Qtk")
# Remove any assimp components if defined by submodule.
if (QTK_SUBMODULES)
if(QTK_SUBMODULES)
get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
list(FILTER CPACK_COMPONENTS_ALL EXCLUDE REGEX .*assimp.*)
list(REMOVE_ITEM CPACK_COMPONENTS_ALL Unspecified)
endif()
# Windows
set(CPACK_PACKAGE_ICON "${QTK_RESOURCES}/icons/win/kilroy_splash.bmp")
set(CPACK_NSIS_MODIFY_PATH ON)
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
# https://nsis.sourceforge.io/Reference/CreateShortCut
set(
CPACK_NSIS_CREATE_ICONS_EXTRA
"CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Qtk.lnk' '$INSTDIR\\\\bin\\\\qtk_gui.exe'"
)
set(
CPACK_NSIS_DELETE_ICONS_EXTRA
"Delete '$SMPROGRAMS\\\\$START_MENU\\\\Qtk.lnk'"
)
# TODO: Icons for NSIS installer.
#set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/resources/icon.png")
#set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/resources/icon.png")
# Set icon for the installer executable.
set(CPACK_NSIS_MUI_ICON "${QTK_RESOURCES}/icons/win/kilroy.ico")
# Set icon for uninstaller executable.
set(CPACK_NSIS_MUI_UNIICON "${QTK_RESOURCES}/icons/win/kilroy.ico")
# Debian
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_PACKAGE_HOMEPAGE_URL})

View File

@ -21,7 +21,7 @@
</property>
<property name="windowIcon">
<iconset>
<normaloff>../resources/icon.png</normaloff>../resources/icon.png</iconset>
<normaloff>../resources/icons/icon.png</normaloff>../resources/icons/icon.png</iconset>
</property>
<property name="unifiedTitleAndToolBarOnMac">
<bool>true</bool>

View File

@ -1,7 +1,15 @@
#!/usr/bin/env bash
# Helper script to run clang-tidy and clang-format.
# This should be executed from the root of the repository:
#
# git clone https://git.shaunreed.com/shaunrd0/qtk
# cd qtk
# ./tools/format.sh
# Configure and build qtk
cmake -B build && cmake --build build -- -j $(nproc --ignore=1)
clang-tidy -p build/ --fix --config-file=.clang-tidy \
src/**/*.cpp src/**/*.h example-app/*.cpp example-app/*.h
clang-format -i --style=file:.clang-format \
src/**/*.cpp src/**/*.h example-app/*.cpp example-app/*.h
# Run clang-tidy and clang-format
SOURCES="src/**/*.cpp src/**/*.h example-app/*.cpp example-app/*.h"
clang-tidy -p build/ --fix --config-file=.clang-tidy $SOURCES
clang-format -i --style=file:.clang-format $SOURCES