Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💥 Qt6 support #157

Merged
merged 34 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
39bb7f0
add flake
OlivierLDff Aug 19, 2024
0049259
everything seems to compile
OlivierLDff Aug 19, 2024
0279233
update qml
OlivierLDff Aug 19, 2024
e50c735
disable wasm and macOS-13
OlivierLDff Aug 19, 2024
f9aa04f
install compat
OlivierLDff Aug 19, 2024
69b5836
remove codeql that is useless here
OlivierLDff Aug 19, 2024
8db0535
dump cmake version
OlivierLDff Aug 19, 2024
b14f890
fix
OlivierLDff Aug 19, 2024
9116bc7
always enable icons for now
OlivierLDff Aug 19, 2024
c217727
use ninja
OlivierLDff Aug 19, 2024
cb48ba8
fix
OlivierLDff Aug 19, 2024
f8e5a0f
fix
OlivierLDff Aug 19, 2024
a55b6af
install ninja
OlivierLDff Aug 19, 2024
e34bcca
add sharedtools
OlivierLDff Aug 19, 2024
4a600c3
fix
OlivierLDff Aug 19, 2024
06f6c50
disable install check
OlivierLDff Aug 19, 2024
3184021
enable install back, and shared library building and ninja ofor mac
OlivierLDff Aug 19, 2024
2299f1a
fix default
OlivierLDff Aug 19, 2024
2f4362d
fix
OlivierLDff Aug 19, 2024
4ce1744
maybe?
OlivierLDff Aug 19, 2024
9c72e74
whatever
OlivierLDff Aug 19, 2024
13de803
Update flake.nix
OlivierLDff Aug 20, 2024
33d41f6
cuse add ressources instead of the whole qml thingy
OlivierLDff Aug 20, 2024
e898232
fix
OlivierLDff Aug 20, 2024
3c185ee
Update qml/Qaterial/BusyIndicator.qml
OlivierLDff Aug 20, 2024
25869db
Update qml/Qaterial/ProgressBar.qml
OlivierLDff Aug 20, 2024
aa012cf
Update qml/Qaterial/ProgressBar.qml
OlivierLDff Aug 20, 2024
5c51238
Update qml/Qaterial/BusyIndicator.qml
OlivierLDff Aug 20, 2024
4f2fdb4
fix indent
OlivierLDff Aug 20, 2024
bc3ffbd
fix splashscreen loader
OlivierLDff Aug 20, 2024
b61bbcf
add ressources wasn't having any effect
OlivierLDff Aug 20, 2024
f642d15
better workfloow for app splash screen
OlivierLDff Aug 20, 2024
424d68d
correctly set qfont folder
OlivierLDff Aug 20, 2024
7beaa9c
🎨 Run js-beautify
Aug 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
89 changes: 0 additions & 89 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

77 changes: 29 additions & 48 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,52 @@ name: 👷 Continuous Deployment
on:
push:
branches:
- master
- ci

- main
pull_request:
branches:
- master
types: [opened, synchronize, unlabeled]
workflow_dispatch:

jobs:
Build:
BuildQt6:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-13, windows-latest]
version: ['5.15.2']
include:
- os: ubuntu-latest
enable_icons: 'ON'
- os: ubuntu-latest
enable_icons: 'OFF'
- os: macOS-13
enable_icons: 'ON'
- os: windows-latest
enable_icons: 'ON'
os: [ubuntu-latest, macOS-latest, windows-latest]
qt-version: ['6.6.2']
enable_icons: ['ON', 'OFF']
build_shared: ['ON', 'OFF']

steps:
-
uses: actions/checkout@v2
-
name: 📦 Cache Qt
id: cache-qt
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/Qt-${{ runner.os }}-${{ matrix.version }}
key: ${{ runner.os }}-QtCache-${{ matrix.version }}-modules
uses: actions/checkout@v4
-
name: ⬇ Install Qt
uses: jurplel/install-qt-action@v3
uses: jurplel/install-qt-action@v4
with:
version: ${{ matrix.version }}
dir: ${{ github.workspace }}/Qt-${{ runner.os }}-${{ matrix.version }}
cached: ${{ steps.cache-qt.outputs.cache-hit }}
modules: ''
version: ${{ matrix.qt-version }}
cache: true
modules: 'qt5compat qtshadertools'
-
name: Enable ninja on ubuntu
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get install ninja-build
echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
-
name: Enable ninja on macOS
if: contains(matrix.os, 'macOS')
run: |
brew install ninja
echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
-
name: 🔧 CMake
run: |
cmake --version
cmake -E make_directory build
cmake \
-DQATERIAL_ENABLE_TESTS=ON \
-DQATERIAL_ENABLE_ICONS=${{ matrix.enable_icons }} \
-DBUILD_SHARED_LIBS=${{ matrix.build_shared }} \
-DCMAKE_BUILD_TYPE="Release" \
-DCPM_SOURCE_CACHE=.cpm \
-B build \
Expand All @@ -77,6 +74,7 @@ jobs:
-
name: 🚀 Install Qaterial
run: cmake --install build --prefix install
if: contains(matrix.build_shared, 'ON')
-
name: ✅ Test install work with find_package
run: |
Expand All @@ -92,21 +90,4 @@ jobs:
--config "Release" \
-j
shell: bash

BuildWasm:
runs-on: ubuntu-latest

strategy:
matrix:
include:
- docker-image: 'reivilo1234/qt-webassembly-cmake:qt5.15-em1.39.8'

steps:
-
uses: actions/checkout@v2
-
name: 🔧 Configure
run: mkdir -p build && docker run --rm -v $(pwd):/src/ -u $(id -u):$(id -g) ${{ matrix.docker-image }} cmake -DQATERIAL_ENABLE_PCH=OFF -DQATERIAL_ENABLE_UNITY_BUILD=OFF -B ./build/ -S . ..
-
name: 🔨 Build
run: docker run --rm -v $(pwd):/src/ -u $(id -u):$(id -g) ${{ matrix.docker-image }} make -C build -j
if: contains(matrix.build_shared, 'ON')
59 changes: 35 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR)

set(QATERIAL_MAIN_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
Expand All @@ -35,7 +35,7 @@ set(QATERIAL_PROJECT "Qaterial" CACHE STRING "Project Name")
set(QATERIAL_TARGET ${QATERIAL_PROJECT} CACHE STRING "Target Name")
set(QATERIAL_FOLDER_PREFIX ${QATERIAL_PROJECT} CACHE STRING "Prefix folder for all Qaterial generated targets in generated project (only decorative)")
set(QATERIAL_VERBOSE ${QATERIAL_MAIN_PROJECT} CACHE BOOL "Qaterial log configuration")
set(QATERIAL_BUILD_SHARED OFF CACHE BOOL "Build as a shared library")
set(QATERIAL_BUILD_SHARED ${BUILD_SHARED_LIBS} CACHE BOOL "Build as a shared library")
set(QATERIAL_ENABLE_TESTS OFF CACHE BOOL "Build Qaterial test executable")
set(QATERIAL_ENABLE_PCH ON CACHE BOOL
"Enable precompile headers support for 'Qaterial'. \"
Expand All @@ -54,7 +54,13 @@ set(QATERIAL_ENABLE_LATO ON CACHE BOOL "Embed to qrc Lato Regular")
# This stays as an option if legacy behavior is desired (for example to do hot reload of qml)
set(QATERIAL_ENABLE_GEN_QMLDIR_BINARY_DIR ON CACHE BOOL "Generate `qmldir` file in binary folder instead of source folder")

set(QATERIAL_ENABLE_INSTALL ${QATERIAL_MAIN_PROJECT} CACHE BOOL "Generate the install target")
if(QATERIAL_MAIN_PROJECT AND QATERIAL_BUILD_SHARED)
set(_default_QATERIAL_ENABLE_INSTALL ON)
else()
set(_default_QATERIAL_ENABLE_INSTALL OFF)
endif()

set(QATERIAL_ENABLE_INSTALL ${_default_QATERIAL_ENABLE_INSTALL} CACHE BOOL "Generate the install target")

project(${QATERIAL_PROJECT} VERSION ${QATERIAL_VERSION} LANGUAGES CXX)
if(QATERIAL_MAIN_PROJECT)
Expand Down Expand Up @@ -94,21 +100,24 @@ endif()

# ───── QT DEPENDENCIES ─────

find_package(Qt5 REQUIRED COMPONENTS
find_package(Qt6 REQUIRED COMPONENTS
Core
Gui
Qml
Quick
QuickControls2
Svg
Xml
QuickCompiler
Core5Compat
)

if(QATERIAL_MAIN_PROJECT)
qt_standard_project_setup()
endif()

# ───── FETCH DEPENDENCIES ─────

include(cmake/FetchQOlm.cmake)
include(cmake/FetchQtGeneratorCMake.cmake)

# ───── RESSOURCES ─────

Expand Down Expand Up @@ -184,10 +193,10 @@ set(QATERIAL_SRCS ${QATERIAL_SRCS} ${QATERIAL_GEN_SRCS})
# ───── QATERIAL TARGET ─────

if(${QATERIAL_BUILD_SHARED})
add_library(${QATERIAL_TARGET} SHARED ${QATERIAL_SRCS})
qt_add_library(${QATERIAL_TARGET} SHARED ${QATERIAL_SRCS})
target_compile_definitions(${QATERIAL_TARGET} PRIVATE -DQATERIAL_SHARED)
else()
add_library(${QATERIAL_TARGET} STATIC ${QATERIAL_SRCS})
qt_add_library(${QATERIAL_TARGET} STATIC ${QATERIAL_SRCS})
target_compile_definitions(${QATERIAL_TARGET} PUBLIC -DQATERIAL_STATIC)
endif()
add_library(${QATERIAL_TARGET}::${QATERIAL_TARGET} ALIAS ${QATERIAL_TARGET})
Expand All @@ -202,23 +211,21 @@ if(QATERIAL_ENABLE_PCH AND COMMAND target_precompile_headers)
target_precompile_headers(${QATERIAL_TARGET} PRIVATE src/Qaterial/Pch/Pch.hpp)
endif()

target_link_libraries(${QATERIAL_TARGET} PRIVATE
${QATERIAL_TARGET}::Icons
${QATERIAL_TARGET}::Fonts
${QATERIAL_TARGET}::Components
QOlm::QOlm
Qt::Core
Qt::Gui
Qt::Svg
Qt::Xml
Qt::Qml
Qt::Quick
Qt::QuickControls2
target_link_libraries(${QATERIAL_TARGET}
PRIVATE ${QATERIAL_TARGET}::Icons
PRIVATE ${QATERIAL_TARGET}::Fonts
PRIVATE ${QATERIAL_TARGET}::Components
PUBLIC QOlm::QOlm
PUBLIC Qt::Core
PUBLIC Qt::Gui
PUBLIC Qt::Svg
PUBLIC Qt::Xml
PUBLIC Qt::Qml
PUBLIC Qt::Quick
PUBLIC Qt::QuickControls2
PUBLIC Qt::Core5Compat
)

set_target_properties(${QATERIAL_TARGET} PROPERTIES
AUTOMOC TRUE
)
if(QATERIAL_ENABLE_UNITY_BUILD)
set_target_properties(${QATERIAL_TARGET} PROPERTIES UNITY_BUILD ON)
endif()
Expand All @@ -237,7 +244,7 @@ if(QATERIAL_FOLDER_PREFIX)
endif()

# Correctly link to static qt
get_target_property(QT_TARGET_TYPE Qt5::Core TYPE)
get_target_property(QT_TARGET_TYPE Qt::Core TYPE)
if(NOT QATERIAL_ENABLE_INSTALL AND ${QT_TARGET_TYPE} STREQUAL "STATIC_LIBRARY")
include(${PROJECT_SOURCE_DIR}/cmake/FetchQtStaticCMake.cmake)
qt_generate_qml_plugin_import(${QATERIAL_TARGET} QML_SRC ${CMAKE_CURRENT_SOURCE_DIR}/qml)
Expand Down Expand Up @@ -267,6 +274,10 @@ endif()
# ───── INSTALL ─────

if (QATERIAL_ENABLE_INSTALL)
if(NOT QATERIAL_BUILD_SHARED)
message(FATAL_ERROR "Qaterial must be built as a shared library to be installed")
endif()

include(GNUInstallDirs)
install(TARGETS ${QATERIAL_TARGET}
EXPORT ${QATERIAL_TARGET}Targets
Expand Down
39 changes: 1 addition & 38 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,7 @@
}
},
{
"name": "base-dev-ninja",
"hidden": true,
"inherits": "base-dev",
"generator": "Ninja",
"cacheVariables": {
"USE_CCACHE": true
}
},
{
"name": "ninja-debug",
"inherits": "base-dev-ninja",
"displayName": "Debug Ninja",
"description": "Build in Debug with Ninja generator",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "ninja-relwithdebinfo",
"inherits": "base-dev-ninja",
"displayName": "RelWithDebInfo Ninja",
"description": "Build in RelWithDebInfo with Ninja generator",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "ninja-release",
"inherits": "base-dev-ninja",
"displayName": "Release Ninja",
"description": "Build in Release with Ninja generator",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "ninja-multi",
"name": "ninja",
"inherits": "base-dev",
"displayName": "Ninja Multi-Config",
"description": "Default build using Ninja Multi-Config generator",
Expand Down
Loading
Loading