Add instructions to install with qt-base-dev.

This commit is contained in:
Shaun Reed 2025-03-22 08:19:42 -04:00
parent a3e7dc47d8
commit 310f337f57
5 changed files with 82 additions and 43 deletions

View File

@ -4,7 +4,7 @@
## Author: Shaun Reed | Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
## All Content (c) 2025 Shaun Reed, all rights reserved ##
################################################################################
cmake_minimum_required(VERSION 3.23)
cmake_minimum_required(VERSION 3.28)
################################################################################
# Constants
@ -84,7 +84,7 @@ endif()
set(QT_INSTALL_DIR "$ENV{HOME}/Qt/6.5.0/gcc_64/lib/cmake" CACHE PATH "Path to Qt6 install.")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install")
endif ()
endif()
set(QTK_RESOURCES "${CMAKE_SOURCE_DIR}/resources")
set(QTK_OSX_ICONS ${CMAKE_SOURCE_DIR}/resources/icons/osx/kilroy.icns)
@ -205,3 +205,25 @@ foreach(VAR_NAME IN LISTS VAR_NAMES VAR_PATHS)
message(STATUS "[Qtk] ${VAR_NAME}=${${VAR_NAME}}")
endif()
endforeach()
message(STATUS "[Qtk] Installation prefix: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "[Qtk] Found Qt6: ${Qt6Core_VERSION}")
# qt_generate_deploy_app_script is supported on Linux in QtCore >= 6.5.0.
# qt_generate_deploy_app_script supports Windows and OSX in QtCore >= 6.3.
# https://doc.qt.io/qt-6.5/qt-generate-deploy-app-script.html
# https://doc.qt.io/archives/qt-6.4/qt-generate-deploy-app-script.html
# The application can still build and run, we just can't install.
if(QTK_GUI OR QTK_EXAMPLE)
if(UNIX AND NOT APPLE)
# Ubuntu 24.04 provides QtCore 6.4.2 in qt-base-dev.
# This version of qt_generate_deploy_app_script does not support Linux.
if (Qt6_VERSION VERSION_LESS "6.5.0")
message(WARNING "[Qtk] Installation is only supported on Qt >=6.5.\n")
endif()
elseif(APPLE OR WIN32)
# Predates qt_generate_deploy_app_script.
if (Qt6_VERSION VERSION_LESS "6.3.0")
message(WARNING "[Qtk] Installation is only supported on Qt >=6.5.\n")
endif()
endif()
endif()

View File

@ -67,7 +67,7 @@ Key features that are planned:
- [ ] Basic text editor for quickly modifying shaders attached to objects.
- [ ] Reduce size of application resources and git references.
For examples of using the libqtk API, see the [example-app](./example-app)
For examples of using libqtk, see the [example-app](./example-app)
project in the root of this repository.
To get textures loading on models look
@ -82,13 +82,19 @@ Simply open the root `CMakeLists.txt` with either of these editors and default
configurations will be loaded. To simplify providing Qt to the build, Qt Creator
is the recommended option.
This project has been ported to **Qt 6.6.0**, which is not yet available in
Ubuntu apt repositories.
To run this project, you will *need* to
install [Qt6 Open Source Binaries](https://www.qt.io/download-qt-installer) for
your system, **version 6.6.0** or later.
Be sure to take note of the Qt6 installation directory, as we will need it to
correctly set our `CMAKE_PREFIX_PATH` in the next steps.
If you have manually installed [Qt6 Open Source Binaries](https://www.qt.io/download-qt-installer)
for your system, be sure to correctly set your `CMAKE_PREFIX_PATH` in the next steps.
On Ubuntu 24.04 the default installation directory to use for this path using Qt 6.5.0 is `$HOME/Qt/6.5.0/gcc_64/lib/cmake`.
The Ubuntu apt repositories contain all the packages we need to build all targets.
To build Qtk desktop application with the scene in the screenshots below run the following commands.
```bash
sudo apt update && sudo apt install cmake build-essential git ccache libxkbcommon-dev libassimp-dev qt6-base-dev qt6-tools-dev
cmake -DQTK_GUI_SCENE=ON -B build
cmake --build build
./build/bin/qtk_gui
```
#### Build Options
@ -146,7 +152,7 @@ For this example we will configure the build with all options enabled.
In the separate sections below we can install individual components with cmake.
```bash
sudo apt update -y && sudo apt install libassimp-dev cmake build-essential git ccache libgl1-mesa-dev libglvnd-dev zlib1g-dev -y
sudo apt update -y && sudo apt install cmake build-essential git ccache libxkbcommon-dev libassimp-dev qt6-base-dev qt6-tools-dev -y
git clone https://github.com/shaunrd0/qtk
cd qtk
# Configure the build with all components enabled
@ -265,7 +271,7 @@ This project is using `clang-format` version `>=15.0.5`.
On Ubuntu 24.04, clang-format 18 is available to install in apt repositories.
```bash
sudo apt install clang-format
sudo apt install clang-format clang-tidy
```
If `clang-format --version` is any earlier than `15.0.0`, running `clang-format` will fail because this project uses configuration options made available since `15.0.0`.

View File

@ -80,17 +80,24 @@ target_link_libraries(qtk_example PUBLIC Qt6::Widgets Qt6::OpenGLWidgets Qt6::Co
target_link_libraries(qtk_example PUBLIC Qtk::qtk)
target_include_directories(qtk_example PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
install(
TARGETS qtk_example
COMPONENT qtk_example
BUNDLE DESTINATION .
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static
RUNTIME DESTINATION bin
)
qt_generate_deploy_app_script(
TARGET qtk_example
OUTPUT_SCRIPT QTK_EXAMPLE_DEPLOY_SCRIPT
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${QTK_EXAMPLE_DEPLOY_SCRIPT} COMPONENT qtk_example)
# qt_generate_deploy_app_script supports Windows and OSX in QtCore >= 6.3.
# qt_generate_deploy_app_script is supported on Linux in QtCore >= 6.5.0.
if((Qt6_VERSION VERSION_GREATER_EQUAL "6.3.0" AND (WIN32 OR APPLE))
OR Qt6_VERSION VERSION_GREATER_EQUAL "6.5.0")
install(
TARGETS qtk_example
COMPONENT qtk_example
BUNDLE DESTINATION .
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static
RUNTIME DESTINATION bin
)
qt_generate_deploy_app_script(
TARGET qtk_example
OUTPUT_SCRIPT QTK_EXAMPLE_DEPLOY_SCRIPT
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${QTK_EXAMPLE_DEPLOY_SCRIPT} COMPONENT qtk_example)
elseif(NOT Qtk_IS_TOP_LEVEL)
message(WARNING "[Qtk] Installation is only supported on Qt >=6.5.\n")
endif()

View File

@ -37,7 +37,7 @@ qt_add_executable(qtk_gui ${QTK_GUI_SOURCES})
target_link_libraries(qtk_gui PRIVATE qtk_plugin_library)
if (QTK_GUI_SCENE)
target_compile_definitions(qtk_gui PUBLIC QTK_GUI_SCENE)
target_compile_definitions(qtk_gui PRIVATE -DQTK_GUI_SCENE)
endif()
if (WIN32)
@ -56,21 +56,25 @@ elseif(APPLE)
)
endif()
install(
TARGETS qtk_gui
COMPONENT qtk_gui
BUNDLE DESTINATION .
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)
qt_generate_deploy_app_script(
TARGET qtk_gui
OUTPUT_SCRIPT QTK_DEPLOY_SCRIPT
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${QTK_DEPLOY_SCRIPT} COMPONENT qtk_gui)
# qt_generate_deploy_app_script supports Windows and OSX in QtCore >= 6.3.
# qt_generate_deploy_app_script is supported on Linux in QtCore >= 6.5.0.
if((Qt6_VERSION VERSION_GREATER_EQUAL "6.3.0" AND (WIN32 OR APPLE))
OR Qt6_VERSION VERSION_GREATER_EQUAL "6.5.0")
install(
TARGETS qtk_gui
COMPONENT qtk_gui
BUNDLE DESTINATION .
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)
qt_generate_deploy_app_script(
TARGET qtk_gui
OUTPUT_SCRIPT QTK_DEPLOY_SCRIPT
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${QTK_DEPLOY_SCRIPT} COMPONENT qtk_gui)
endif()
if(WIN32)
if(MSVC AND TARGET Qt6::qmake)

View File

@ -55,7 +55,7 @@ target_sources(
)
if(QTK_DEBUG)
target_compile_definitions(qtk PUBLIC QTK_DEBUG)
target_compile_definitions(qtk PUBLIC -DQTK_DEBUG)
endif()
set_target_properties(