Cmake changes.

This commit is contained in:
Shaun Reed 2025-03-14 15:04:49 -04:00
parent ea25ba312a
commit eef00632d4
8 changed files with 82 additions and 49 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.

View File

@ -52,7 +52,7 @@ Key features that are planned:
- [ ] Runtime reloading of modified GLSL shaders attached to objects within scenes.
- [ ] Multiple views of a scene at one time.
- [ ] Camera control modes such as panning, orbiting, or following objects.
- [ ] Save / load for scene data. The current inheritance model is temporary.
- [ ] Save / load scene data. The current model requires writing C++ code.
- [ ] Basic text editor for quickly modifying shaders attached to objects.
- [ ] Reduce size of application resources and git references.
@ -226,6 +226,11 @@ Ubuntu clang-format version 18.1.3 (1ubuntu1)
CLion has integration for IDE code reformatting actions with `clang-format`.
If you're using CLion, the `.clang-format` configuration will be picked up by CLion automatically.
This repository provides the [`tools/format.sh`](./tools/format.sh) helper script to run `clang-tidy` and `clang-format` on Ubuntu 24.04.
Running the script will build Qtk, so it's important to ensure you can manually build from source first.
If you'd still like to run these tools manually, see the instructions below.
`clang-tidy` can be run with the following commands.
```bash
@ -303,7 +308,7 @@ To generate packages for Qtk desktop application, we should
set `-DQTK_GUI=ON`. If this option is not set we will only package libqtk.
The NSIS installer will allow component-specific path modification for all of
these installation components through a GUI install application.
these installation components through a Windows GUI install application.
##### Resources

View File

@ -1,13 +0,0 @@
```bash
sudo apt install icnsutils
```
```bash
convert icon.png -resize 32x32 kilroy_32.png
convert icon.png -resize 16x16 kilroy_16.png
convert icon.png -resize 48x48 kilroy_48.png
convert icon.png -resize 128x128 kilroy_128.png
convert icon.png -resize 256x256 kilroy_256.png
png2icns png2icns kilroy.icns kilroy_*.png
```

View File

@ -17,7 +17,7 @@
<file>fontawesome-free-6.2.1-desktop/svgs/regular/folder-open.svg</file>
<file>fontawesome-free-6.2.1-desktop/svgs/regular/floppy-disk.svg</file>
<file>fontawesome-free-6.2.1-desktop/svgs/brands/git-alt.svg</file>
<file>icon.png</file>
<file alias="icon.png">icons/icon.png</file>
</qresource>
<qresource prefix="/shaders">
<file alias="model.frag">shaders/fragment/model.frag</file>

View File

@ -103,15 +103,19 @@ configure_package_config_file(
)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
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")
@ -122,6 +126,47 @@ if (QTK_SUBMODULES)
list(REMOVE_ITEM CPACK_COMPONENTS_ALL Unspecified)
endif()
if(APPLE)
# OSX
# Set icon for the splash image used in OSX DMG installers.
set(CPACK_PACKAGE_ICON "${QTK_RESOURCES}/icons/osx/kilroy_splash.bmp")
# Set additional options for the OSX bundle.
set(CPACK_BUNDLE_NAME ${PROJECT_NAME})
set(CPACK_BUNDLE_PLIST $<TARGET_BUNDLE_CONTENT_DIR:qtk_gui>/Info.plist)
set(CPACK_BUNDLE_ICON ${QTK_OSX_ICONS})
else(UNIX)
# Linux
# Install icons for qtk.
install(FILES ${QTK_RESOURCES}/icons/linux/kilroy-16.png
DESTINATION /usr/share/icons/hicolor/16x16/apps
RENAME qtk.png)
install(FILES ${QTK_RESOURCES}/icons/linux/kilroy-32.png
DESTINATION /usr/share/icons/hicolor/32x32/apps
RENAME qtk.png)
install(FILES ${QTK_RESOURCES}/icons/linux/kilroy-48.png
DESTINATION /usr/share/icons/hicolor/48x48/apps
RENAME qtk.png)
install(FILES ${QTK_RESOURCES}/icons/linux/kilroy-64.png
DESTINATION /usr/share/icons/hicolor/64x64/apps
RENAME qtk.png)
install(FILES ${QTK_RESOURCES}/icons/linux/kilroy-128.png
DESTINATION /usr/share/icons/hicolor/128x128/apps
RENAME qtk.png)
install(FILES ${QTK_RESOURCES}/icons/linux/kilroy-256.png
DESTINATION /usr/share/icons/hicolor/256x256/apps
RENAME qtk.png)
# Install the desktop file for qtk.
install(FILES ${QTK_RESOURCES}/qtk.desktop
DESTINATION /usr/share/applications)
# Set additional options for the debian APT package.
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_PACKAGE_HOMEPAGE_URL})
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
endif()
# Windows
set(CPACK_NSIS_MODIFY_PATH ON)
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
@ -134,20 +179,7 @@ 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")
# Debian
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_PACKAGE_HOMEPAGE_URL})
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
# OSX
set(CPACK_BUNDLE_NAME ${PROJECT_NAME})
set(CPACK_BUNDLE_PLIST $<TARGET_BUNDLE_CONTENT_DIR:qtk_gui>/Info.plist)
set(CPACK_BUNDLE_ICON ${QTK_OSX_ICONS})
# Platform defaults for source bundles.
if(WIN32)
set(CPACK_SOURCE_GENERATOR ZIP)
else()

View File

@ -57,15 +57,14 @@ set(
qt_add_executable(qtk_gui ${QTK_GUI_SOURCES})
target_link_libraries(qtk_gui PRIVATE qtk_plugin_library)
set_target_properties(
qtk_gui PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_BUNDLE_NAME Qtk
MACOSX_BUNDLE_ICON_FILE ${QTK_OSX_ICONS}
MACOSX_BUNDLE_GUI_IDENTIFIER ${CMAKE_PROJECT_NAME}
MACOSX_BUNDLE_INFO_STRING ${CMAKE_PROJECT_DESCRIPTION}
MACOSX_BUNDLE_COPYRIGHT "All Content (c) 2023 Shaun Reed, all rights reserved"
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)
set_target_properties(qtk_gui PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_BUNDLE_NAME Qtk
MACOSX_BUNDLE_ICON_FILE ${QTK_OSX_ICONS}
MACOSX_BUNDLE_GUI_IDENTIFIER ${CMAKE_PROJECT_NAME}
MACOSX_BUNDLE_INFO_STRING ${CMAKE_PROJECT_DESCRIPTION}
MACOSX_BUNDLE_COPYRIGHT ${QTK_COPYRIGHT}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)

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