Skip to content

Commit

Permalink
Merge branch 'feature/qt65' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
arBmind committed Jul 29, 2024
2 parents befb923 + 99b67e3 commit 7960cc2
Show file tree
Hide file tree
Showing 67 changed files with 3,238 additions and 163 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* text=auto
*.sh text eol=lf
*.yml text eol=lf
*.json text eol=lf
Makefile text eol=lf
Vagrantfile text eol=lf
19 changes: 7 additions & 12 deletions .github/workflows/clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
qmake --version
- name: Git Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- run: qmake -r "CONFIG+=${{ matrix.std_cpp }}"
- run: make -j
Expand All @@ -37,13 +37,15 @@ jobs:
fail-fast: false
matrix:
include:
- image: arbmind/qbs-clang-libstdcpp-qt:2.3.1-18-14-6.7.1
- image: arbmind/qbs-clang-libstdcpp-qt:1.24.1-16-12-6.5.0
- image: arbmind/qbs-clang-libstdcpp-qt:1.22.0-14-11-6.3.0
- image: arbmind/qbs-clang-libstdcpp-qt:1.21.0-13-10-6.2.4

runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Build & Test
run: >-
Expand Down Expand Up @@ -76,19 +78,12 @@ jobs:
env:
QMAKESPEC: linux-clang
steps:
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ../Qt
key: QtCache-${{ matrix.qt_version }}-${{ matrix.qt_arch }}

- name: Install Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v4
with:
version: "${{ matrix.qt_version }}"
arch: "${{ matrix.qt_arch }}"
cached: ${{ steps.cache-qt.outputs.cache-hit }}
cache: true

- name: Setup Clang
run: |
Expand All @@ -102,7 +97,7 @@ jobs:
clang++ --version
- name: Git Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- run: qmake -r "CONFIG+=${{ matrix.std_cpp }}"
- run: make -j
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ jobs:
fail-fast: false
matrix:
include:
- image: arbmind/qbs-gcc-qt:1.22.1-12-6.3.1
- image: arbmind/qbs-gcc-qt:2.3.1-14-6.7.1
- image: arbmind/qbs-gcc-qt:1.24.1-12-6.5.0
- image: arbmind/qbs-gcc-qt:1.22.1-12-6.3.1

runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Build & Test
run: >-
Expand Down Expand Up @@ -48,19 +50,12 @@ jobs:

runs-on: "${{ matrix.host_system }}"
steps:
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ../Qt
key: QtCache-${{ matrix.qt_version }}-${{ matrix.qt_arch }}

- name: Install Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v4
with:
version: "${{ matrix.qt_version }}"
arch: "${{ matrix.qt_arch }}"
cached: ${{ steps.cache-qt.outputs.cache-hit }}
cache: true

- name: Setup Gcc
run: |
Expand All @@ -73,7 +68,7 @@ jobs:
g++ --version
- name: Git Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- run: qmake -r "CONFIG+=${{ matrix.std_cpp }}"
- run: make -j
Expand Down
44 changes: 20 additions & 24 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ jobs:
fail-fast: false
matrix:
include:
- host_system: windows-2022
vcvars: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
qt_version: "6.7.2"
qt_arch: win64_msvc2019_64

- host_system: windows-2022
vcvars: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
qt_version: "6.5.0"
qt_arch: win64_msvc2019_64

- host_system: windows-2022
vcvars: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
qt_version: "6.3.0"
Expand All @@ -21,19 +31,12 @@ jobs:

runs-on: "${{ matrix.host_system }}"
steps:
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ../Qt
key: QtCache-${{ matrix.qt_version }}-${{ matrix.qt_arch }}

- name: Install Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v4
with:
version: "${{ matrix.qt_version }}"
arch: "${{ matrix.qt_arch }}"
cached: ${{ steps.cache-qt.outputs.cache-hit }}
cache: true

- name: Install Qbs
run: choco install qbs
Expand All @@ -47,7 +50,7 @@ jobs:
qbs config --list profiles
- name: Git Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- run: >-
qbs build
Expand All @@ -62,38 +65,31 @@ jobs:
matrix:
include:
- host_system: windows-2022
cl_version: "14.33"
qt_version: "6.5.0"
qt_arch: win64_msvc2019_64

- host_system: windows-2022
qt_version: "6.3.0"
qt_arch: win64_msvc2019_64

- host_system: windows-2019
cl_version: "14.29"
qt_version: "6.2.4"
qt_arch: win64_msvc2019_64

runs-on: "${{ matrix.host_system }}"
steps:
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ../Qt
key: QtCache-${{ matrix.qt_version }}-${{ matrix.qt_arch }}

- name: Install Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v4
with:
version: "${{ matrix.qt_version }}"
arch: "${{ matrix.qt_arch }}"
cached: ${{ steps.cache-qt.outputs.cache-hit }}
cache: true

- name: Add msbuild to PATH
uses: ilammy/msvc-dev-cmd@v1
with:
toolset: '${{ matrix.cl_version }}'

- name: Git Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- run: qmake -r
- run: nmake
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/cmake-build-*/
/build*/
/.idea/
/.vscode/
/*.user
/*.autosave
59 changes: 59 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
cmake_minimum_required(VERSION 3.25)

project(Verdigris
VERSION 2.0
DESCRIPTION "Replace Qt moc with native C++"
HOMEPAGE_URL "https://github.com/woboq/verdigris"
LANGUAGES CXX
)

enable_testing()

find_package(Qt6 "6.2...<6.6" COMPONENTS Core Test REQUIRED)

add_subdirectory("src")
add_subdirectory("tools")
add_subdirectory("tutorial")
add_subdirectory("tests")
add_subdirectory("benchmarks")

set_source_files_properties(
"src/wobjectcpp.h"
"src/wobjectdefs.h"
"src/wobjectimpl.h"
"src/wqmlelement.h"
DIRECTORY
"benchmarks/qobject/"
PROPERTIES
SKIP_AUTOMOC ON
)

add_library(verdigris::verdigris ALIAS verdigris)
include(CMakePackageConfigHelpers)
configure_package_config_file("cmake/verdigrisConfig.cmake.in"
"verdigrisConfig.cmake"
INSTALL_DESTINATION verdigris/cmake
)
write_basic_package_version_file("verdigrisConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
ARCH_INDEPENDENT
)
include(GNUInstallDirs)
install(TARGETS verdigris
EXPORT verdigris_Targets
FILE_SET HEADERS
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/verdigris"
)
install(FILES
"${PROJECT_BINARY_DIR}/verdigrisConfig.cmake"
"${PROJECT_BINARY_DIR}/verdigrisConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/verdigris/cmake)
install(EXPORT verdigris_Targets
FILE "verdigrisTargets.cmake"
NAMESPACE verdigris::
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/verdigris/cmake
)

set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.LGPLv3")
include(CPack)
38 changes: 38 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"version": 3,
"configurePresets": [
{
"name": "base",
"hidden": true,
"description": "Base for concrete configure presets",
"generator": "Ninja Multi-Config",
"binaryDir": "${sourceDir}/build/${presetName}"
},
{
"name": "msvc",
"description": "Preferred settings for MSVC 2022",
"cacheVariables": {
"CMAKE_CXX_FLAGS": "/DWIN32 /D_WINDOWS /EHsc /permissive- /Zc:__cplusplus /Zc:externConstexpr /Zc:inline /Zc:preprocessor /Zc:throwingNew /diagnostics:caret"
}
},
{
"name": "clang",
"cacheVariables": {
"CMAKE_CXX_FLAGS": "--pedantic -Wall -Wextra -ftemplate-backtrace-limit=0 -Wno-gnu-zero-variadic-macro-arguments"
}
},
{
"name": "clang-libcpp",
"cacheVariables": {
"CMAKE_CXX_FLAGS": "--stdlib=libc++ --pedantic -Wall -Wextra -ftemplate-backtrace-limit=0 -Wno-gnu-zero-variadic-macro-arguments",
"CMAKE_EXE_LINKER_FLAGS": "--stdlib=libc++"
}
},
{
"name": "gcc",
"cacheVariables": {
"CMAKE_CXX_FLAGS": "--pedantic -Wall -Wextra -Wno-noexcept-type -Wno-address -ftemplate-backtrace-limit=0"
}
}
]
}
2 changes: 2 additions & 0 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

add_subdirectory("qobject")
11 changes: 11 additions & 0 deletions benchmarks/qobject/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

add_executable(qobject_bench
"main.cpp"
"object.cpp"
"object.h"
)
target_link_libraries(qobject_bench PRIVATE
verdigris
Qt6::Test
)
set_target_properties(qobject_bench PROPERTIES AUTOMOC ON)
4 changes: 4 additions & 0 deletions cmake/verdigrisConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
check_required_components("@PROJECT_NAME@")
26 changes: 26 additions & 0 deletions qbs/modules/wqmlelement/metatypes/metatypes.qbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import qbs.File

Module {
Depends { name: "Qt.core" }

Rule {
name: "Qt MetaTypes"
inputs: ["verdigris.metatypes"]
inputsFromDependencies: ["verdigris.metatypes"]
Artifact {
filePath: input.fileName + ".json"
fileTags: ["qt.core.metatypes"]
qbs.install: product.Qt.core.metaTypesInstallDir
qbs.installDir: product.Qt.core.metaTypesInstallDir
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "generating " + output.fileName + " from " + input.fileName;
cmd.highlight = "codegen";
cmd.sourceCode = function() {
File.copy(input.filePath, output.filePath);
}
return [cmd];
}
}
}
32 changes: 32 additions & 0 deletions qbs/modules/wqmlelement/objlibrary/objlibrary.qbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

Module {
additionalProductTypes: ["obj", "verdigris.metatypes"]

Depends { productTypes: ["metatypes-extractor"] }
Depends { name: "Qt.core" }

Rule {
name: "Extract MetaTypes"
multiplex: true
inputs: ["obj"]
Artifact {
filePath: product.targetName.toLowerCase() + "_metatypes"
fileTags: ["verdigris.metatypes"]
}
explicitlyDependsOnFromDependencies: ["metatypes-extractor"]
prepare: {
var inputFilePaths = inputs.obj.map(function(a) {
return a.filePath;
});
var toolPath = explicitlyDependsOn["metatypes-extractor"][0].filePath;
var cmd = new Command(toolPath,
["--out=" + output.filePath].concat(inputFilePaths));
cmd.environment = [
"PATH=" + product.Qt.core.libExecPath // ensure Qt libraries are available
];
cmd.description = "generating " + output.fileName;
cmd.highlight = "codegen";
return cmd;
}
}
}
Loading

0 comments on commit 7960cc2

Please sign in to comment.