mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-05-25 18:00:48 -04:00
chore: Add support for Qt Creator version to the plugin build script (#87)
This will allow to add code conditional on the Qt Creator version to the plugin codebase. The Qt Creator version will be passed from the build script automatically. This will also allow to easily extend the Github Actions job matrix to create releases for more than one Qt Creator version. Using QT_VERSION_CHECK allows to reuse existing Qt patterns of checking versions. Code has been tested by invoking QODEASSIST_QT_CREATOR_VERSION in code.
This commit is contained in:
parent
3b188740e8
commit
d8a01504a3
12
.github/workflows/build_cmake.yml
vendored
12
.github/workflows/build_cmake.yml
vendored
@ -187,6 +187,15 @@ jobs:
|
|||||||
set(ENV{CXX} ${{ matrix.config.cxx }})
|
set(ENV{CXX} ${{ matrix.config.cxx }})
|
||||||
set(ENV{MACOSX_DEPLOYMENT_TARGET} "${{ env.MACOS_DEPLOYMENT_TARGET }}")
|
set(ENV{MACOSX_DEPLOYMENT_TARGET} "${{ env.MACOS_DEPLOYMENT_TARGET }}")
|
||||||
|
|
||||||
|
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)" version_match "$ENV{QT_CREATOR_VERSION}")
|
||||||
|
set(QT_CREATOR_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||||
|
set(QT_CREATOR_VERSION_MINOR "${CMAKE_MATCH_2}")
|
||||||
|
set(QT_CREATOR_VERSION_PATCH "${CMAKE_MATCH_3}")
|
||||||
|
|
||||||
|
if(NOT version_match)
|
||||||
|
message(FATAL_ERROR "Failed to parse Qt Creator version string: $ENV{QT_CREATOR_VERSION}")
|
||||||
|
endif()
|
||||||
|
|
||||||
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
|
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND "${{ matrix.config.environment_script }}" && set
|
COMMAND "${{ matrix.config.environment_script }}" && set
|
||||||
@ -223,6 +232,9 @@ jobs:
|
|||||||
--qt-path "${{ steps.qt.outputs.qt_dir }}"
|
--qt-path "${{ steps.qt.outputs.qt_dir }}"
|
||||||
--qtc-path "${{ steps.qt_creator.outputs.qtc_dir }}"
|
--qtc-path "${{ steps.qt_creator.outputs.qtc_dir }}"
|
||||||
--output-path "$ENV{GITHUB_WORKSPACE}"
|
--output-path "$ENV{GITHUB_WORKSPACE}"
|
||||||
|
--add-config=-DQODEASSIST_QT_CREATOR_VERSION_MAJOR=${QT_CREATOR_VERSION_MAJOR}
|
||||||
|
--add-config=-DQODEASSIST_QT_CREATOR_VERSION_MINOR=${QT_CREATOR_VERSION_MINOR}
|
||||||
|
--add-config=-DQODEASSIST_QT_CREATOR_VERSION_PATCH=${QT_CREATOR_VERSION_PATCH}
|
||||||
RESULT_VARIABLE result
|
RESULT_VARIABLE result
|
||||||
)
|
)
|
||||||
if (NOT result EQUAL 0)
|
if (NOT result EQUAL 0)
|
||||||
|
@ -13,6 +13,12 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|||||||
find_package(QtCreator REQUIRED COMPONENTS Core)
|
find_package(QtCreator REQUIRED COMPONENTS Core)
|
||||||
find_package(Qt6 COMPONENTS Core Gui Quick Widgets Network REQUIRED)
|
find_package(Qt6 COMPONENTS Core Gui Quick Widgets Network REQUIRED)
|
||||||
|
|
||||||
|
add_definitions(
|
||||||
|
-DQODEASSIST_QT_CREATOR_VERSION_MAJOR=${QODEASSIST_QT_CREATOR_VERSION_MAJOR}
|
||||||
|
-DQODEASSIST_QT_CREATOR_VERSION_MINOR=${QODEASSIST_QT_CREATOR_VERSION_MINOR}
|
||||||
|
-DQODEASSIST_QT_CREATOR_VERSION_PATCH=${QODEASSIST_QT_CREATOR_VERSION_PATCH}
|
||||||
|
)
|
||||||
|
|
||||||
add_subdirectory(llmcore)
|
add_subdirectory(llmcore)
|
||||||
add_subdirectory(settings)
|
add_subdirectory(settings)
|
||||||
add_subdirectory(logger)
|
add_subdirectory(logger)
|
||||||
|
28
Version.hpp
Normal file
28
Version.hpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2025 Povilas Kanapickas <povilas@radix.lt>
|
||||||
|
*
|
||||||
|
* This file is part of QodeAssist.
|
||||||
|
*
|
||||||
|
* QodeAssist is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* QodeAssist is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with QodeAssist. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#define QODEASSIST_QT_CREATOR_VERSION \
|
||||||
|
QT_VERSION_CHECK( \
|
||||||
|
QODEASSIST_QT_CREATOR_VERSION_MAJOR, \
|
||||||
|
QODEASSIST_QT_CREATOR_VERSION_MINOR, \
|
||||||
|
QODEASSIST_QT_CREATOR_VERSION_PATCH)
|
Loading…
Reference in New Issue
Block a user