Compare commits

...

17 commits

Author SHA1 Message Date
Roman Telezhynskyi 1e6179e69d Read environment variable directly from conanfile.py. 2023-02-20 21:45:02 +02:00
Roman Telezhynskyi 824d978473 echo command 2023-02-20 21:27:45 +02:00
Roman Telezhynskyi 51f7c5102d Verbose true. 2023-02-20 21:15:49 +02:00
Roman Telezhynskyi 6b4683d10a Try without environment variable. 2023-02-20 20:29:50 +02:00
Roman Telezhynskyi e317836957 Try without quotes. 2023-02-20 20:14:13 +02:00
Roman Telezhynskyi 2733a00a40 Internally return string. 2023-02-20 19:54:35 +02:00
Roman Telezhynskyi b51c028f23 Pass as string. 2023-02-20 19:34:05 +02:00
Roman Telezhynskyi f3899ac072 Switch to conanfile.py. 2023-02-20 16:40:38 +02:00
Roman Telezhynskyi 1285f85dbc Fix conanfile.txt. 2023-02-20 16:11:10 +02:00
Roman Telezhynskyi 3c19d0123d Prebuild xerces-c with correct macos deployment target version we need.
Required version is not always available by default.
2023-02-20 15:57:54 +02:00
Roman Telezhynskyi 84529d7b39 Better control over macos deployment target version. 2023-02-20 15:50:23 +02:00
Roman Telezhynskyi ac84b9f273 Use conanfile.txt to control package options. 2023-02-20 15:47:06 +02:00
Roman Telezhynskyi 4a022e7f1a Cache conan. 2023-02-20 15:42:50 +02:00
Roman Telezhynskyi 47bb2c16d4 Fix installing xerces-c library. 2023-02-20 14:54:48 +02:00
Roman Telezhynskyi 34632ebb43 No need to use std::move in this case. 2023-02-20 13:13:39 +02:00
Roman Telezhynskyi 4f2f05fe9a Don't use XERCES_CPP_NAMESPACE_USE macro. 2023-02-20 13:03:11 +02:00
Roman Telezhynskyi edccf99f43 Fix multibundle module. 2023-02-20 12:59:24 +02:00
15 changed files with 69 additions and 38 deletions

View file

@ -154,31 +154,36 @@ macos_task_template: &MACOS_TASK_TEMPLATE
LDFLAGS: "-L$QTDIR/lib" LDFLAGS: "-L$QTDIR/lib"
CPPFLAGS: "-I$QTDIR/include" CPPFLAGS: "-I$QTDIR/include"
PKG_CONFIG_PATH: "/opt/homebrew/opt/qt6/lib/pkgconfig" PKG_CONFIG_PATH: "/opt/homebrew/opt/qt6/lib/pkgconfig"
global_homebrew_cache:
folder: "/usr/local/Homebrew"
local_homebrew_cache: local_homebrew_cache:
folder: "$HOME/Library/Caches/Homebrew" folder: "$HOME/Library/Caches/Homebrew"
global_conan_cache:
folder: "$HOME/Library/Caches/Conan"
local_conan_cache:
folder: "~/.conan/data"
pip_cache: pip_cache:
folder: ${PIP_CACHE_DIR} folder: ${PIP_CACHE_DIR}
install_script: install_script:
- brew update > /dev/null - brew update > /dev/null
- brew install qt6 coreutils ccache conan qbs - brew install qt6 coreutils ccache conan qbs cmake
- chmod -R 755 /opt/homebrew/opt/qt6/* - chmod -R 755 /opt/homebrew/opt/qt6/*
- python3 --version - python3 --version
- pip3 install --user --upgrade pip dropbox - pip3 install --user --upgrade pip dropbox
- ccache --set-config=sloppiness=pch_defines,time_macros - ccache --set-config=sloppiness=pch_defines,time_macros
- conan --version
- clang --version - clang --version
- qmake --version - qmake --version
- which qmake - which qmake
- qbs --version - qbs --version
build_script: build_script:
- pwd - pwd
- conan install . -s os=Macos -s os.version=${MACOS_DEPLOYMENT_TARGET} --build=xerces-c
- qbs setup-toolchains --detect - qbs setup-toolchains --detect
- qbs config --list profiles - qbs config --list profiles
- qbs setup-qt /opt/homebrew/opt/qt6/bin/qmake qt6 - qbs setup-qt /opt/homebrew/opt/qt6/bin/qmake qt6
- qbs-config defaultProfile qt6 - qbs-config defaultProfile qt6
- qbs config profiles.qt6.baseProfile clang - qbs config profiles.qt6.baseProfile clang
- qbs build -f valentina.qbs -d $CIRRUS_WORKING_DIR/build --command-echo-mode command-line config:release modules.buildconfig.enableUnitTests:false modules.buildconfig.enableMultiBundle:${MULTI_BUNDLE} qbs.installRoot:$CIRRUS_WORKING_DIR/build/install-root profile:qt6 project.enableConan:true - echo qbs build -f valentina.qbs -d $CIRRUS_WORKING_DIR/build --command-echo-mode command-line config:release modules.buildconfig.enableUnitTests:false modules.buildconfig.enableMultiBundle:${MULTI_BUNDLE} qbs.installRoot:$CIRRUS_WORKING_DIR/build/install-root profile:qt6 project.enableConan:true project.minimumMacosVersion:${MACOS_DEPLOYMENT_TARGET}
- qbs build -f valentina.qbs -d $CIRRUS_WORKING_DIR/build --command-echo-mode command-line config:release modules.buildconfig.enableUnitTests:false modules.buildconfig.enableMultiBundle:${MULTI_BUNDLE} qbs.installRoot:$CIRRUS_WORKING_DIR/build/install-root profile:qt6 project.enableConan:true project.minimumMacosVersion:${MACOS_DEPLOYMENT_TARGET}
- ccache -s - ccache -s
deploy_script: deploy_script:
- pwd - pwd
@ -195,6 +200,7 @@ macos_task:
QT_BRANCH: Qt6 QT_BRANCH: Qt6
ARCHITECTURE: arm64 ARCHITECTURE: arm64
PLATFORM: "macOS_11+" PLATFORM: "macOS_11+"
MACOS_DEPLOYMENT_TARGET: 11.0
matrix: matrix:
- name: 'macOS Monterey 12 [signle bundle, no tests]' - name: 'macOS Monterey 12 [signle bundle, no tests]'
env: env:

15
conanfile.py Normal file
View file

@ -0,0 +1,15 @@
import os
from conans import ConanFile
class Recipe(ConanFile):
settings = "os"
requires = "xerces-c/[>=3.2,<4.0]"
default_options = {"xerces-c:shared": True}
def configure(self):
if self.settings.os == "Linux":
self.options["xerces-c"].shared = False
if self.settings.os == "Macos" and "MACOS_DEPLOYMENT_TARGET" in os.environ:
self.settings.os.version = os.environ["MACOS_DEPLOYMENT_TARGET"]

View file

@ -1,2 +0,0 @@
[requires]
xerces-c/[>=3.2,<4.0]

View file

@ -149,6 +149,9 @@ Module {
} }
readonly property string minimumMacosVersion: { readonly property string minimumMacosVersion: {
if (project.minimumMacosVersion !== undefined)
return project.minimumMacosVersion;
// Check which minimal OSX version supports current Qt version // Check which minimal OSX version supports current Qt version
if (Qt.core.versionMajor >= 6) { if (Qt.core.versionMajor >= 6) {
// For Qt 6.5 https://doc-snapshots.qt.io/qt6-6.5/supported-platforms.html // For Qt 6.5 https://doc-snapshots.qt.io/qt6-6.5/supported-platforms.html

View file

@ -98,7 +98,7 @@ Module {
cmd.description = "Copying auxiliary binary into bundle"; cmd.description = "Copying auxiliary binary into bundle";
cmd.highlight = "filegen"; cmd.highlight = "filegen";
const fileName = product.bundle.isBundle ? product.bundle.bundleName : inputs["dynamiclibrary"][0].fileName; const fileName = product.bundle.isBundle ? product.bundle.bundleName : inputs["application"][0].fileName;
const installRoot = product.qbs.installRoot + product.qbs.installPrefix + "/" + product.buildconfig.installAppPath; const installRoot = product.qbs.installRoot + product.qbs.installPrefix + "/" + product.buildconfig.installAppPath;
var data = []; var data = [];
product.multibundle.targetApps.forEach(function(targetApp) { product.multibundle.targetApps.forEach(function(targetApp) {

View file

@ -17,6 +17,12 @@ VToolApp {
targetName: buildconfig.appTarget targetName: buildconfig.appTarget
multibundle.targetApps: ["Valentina"] multibundle.targetApps: ["Valentina"]
Properties {
condition: buildconfig.useConanPackages && buildconfig.enableMultiBundle
conan.XercesC.libInstallDir: qbs.installPrefix + "/" + buildconfig.installLibraryPath
conan.XercesC.installLib: true
}
files: [ files: [
"main.cpp", "main.cpp",
"vpapplication.cpp", "vpapplication.cpp",

View file

@ -21,6 +21,12 @@ VToolApp {
targetName: buildconfig.appTarget targetName: buildconfig.appTarget
multibundle.targetApps: ["Valentina"] multibundle.targetApps: ["Valentina"]
Properties {
condition: buildconfig.useConanPackages && buildconfig.enableMultiBundle
conan.XercesC.libInstallDir: qbs.installPrefix + "/" + buildconfig.installLibraryPath
conan.XercesC.installLib: true
}
files: [ files: [
"main.cpp", "main.cpp",
"tmainwindow.cpp", "tmainwindow.cpp",

View file

@ -32,6 +32,12 @@ VToolApp {
buildconfig.appTarget: qbs.targetOS.contains("macos") ? "Valentina" : "valentina" buildconfig.appTarget: qbs.targetOS.contains("macos") ? "Valentina" : "valentina"
targetName: buildconfig.appTarget targetName: buildconfig.appTarget
Properties {
condition: buildconfig.useConanPackages
conan.XercesC.libInstallDir: qbs.installPrefix + "/" + buildconfig.installLibraryPath
conan.XercesC.installLib: true
}
files: [ files: [
"main.cpp", "main.cpp",
"mainwindow.cpp", "mainwindow.cpp",

View file

@ -19,11 +19,6 @@ VLib {
condition: Utilities.versionCompare(Qt.core.version, "6") >= 0 && buildconfig.useConanPackages condition: Utilities.versionCompare(Qt.core.version, "6") >= 0 && buildconfig.useConanPackages
} }
Properties {
condition: buildconfig.useConan && (qbs.targetOS.contains("macos") || qbs.targetOS.contains("windows"))
conan.XercesC.installLib: true
}
name: "IFCLib" name: "IFCLib"
files: [ files: [
"ifcdef.h", "ifcdef.h",

View file

@ -190,11 +190,12 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
if (tempSchema->open()) if (tempSchema->open())
{ {
XercesDOMParser domParser; XERCES_CPP_NAMESPACE::XercesDOMParser domParser;
domParser.setErrorHandler(&parserErrorHandler); domParser.setErrorHandler(&parserErrorHandler);
if (domParser.loadGrammar( if (domParser.loadGrammar(
tempSchema->fileName().toUtf8().constData(), Grammar::SchemaGrammarType, true) == nullptr) tempSchema->fileName().toUtf8().constData(),
XERCES_CPP_NAMESPACE::Grammar::SchemaGrammarType, true) == nullptr)
{ {
VException e(parserErrorHandler.StatusMessage()); VException e(parserErrorHandler.StatusMessage());
e.AddMoreInformation(tr("Could not load schema file '%1'.").arg(fileSchema.fileName())); e.AddMoreInformation(tr("Could not load schema file '%1'.").arg(fileSchema.fileName()));
@ -211,7 +212,7 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
throw e; throw e;
} }
domParser.setValidationScheme(XercesDOMParser::Val_Always); domParser.setValidationScheme(XERCES_CPP_NAMESPACE::XercesDOMParser::Val_Always);
domParser.setDoNamespaces(true); domParser.setDoNamespaces(true);
domParser.setDoSchema(true); domParser.setDoSchema(true);
domParser.setValidationConstraintFatal(true); domParser.setValidationConstraintFatal(true);

View file

@ -91,30 +91,30 @@ auto VParserErrorHandler::Column() const -> XMLFileLoc
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VParserErrorHandler::handleMessage(const SAXParseException &ex) void VParserErrorHandler::handleMessage(const XERCES_CPP_NAMESPACE::SAXParseException &ex)
{ {
char* msg = XMLString::transcode(ex.getMessage()); char* msg = XERCES_CPP_NAMESPACE::XMLString::transcode(ex.getMessage());
m_description = QString(msg); m_description = QString(msg);
m_line = ex.getLineNumber(); m_line = ex.getLineNumber();
m_column = ex.getColumnNumber(); m_column = ex.getColumnNumber();
m_hasError = true; m_hasError = true;
XMLString::release(&msg); XERCES_CPP_NAMESPACE::XMLString::release(&msg);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VParserErrorHandler::warning(const SAXParseException &ex) void VParserErrorHandler::warning(const XERCES_CPP_NAMESPACE::SAXParseException &ex)
{ {
handleMessage(ex); handleMessage(ex);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VParserErrorHandler::error(const SAXParseException &ex) void VParserErrorHandler::error(const XERCES_CPP_NAMESPACE::SAXParseException &ex)
{ {
handleMessage(ex); handleMessage(ex);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VParserErrorHandler::fatalError(const SAXParseException &ex) void VParserErrorHandler::fatalError(const XERCES_CPP_NAMESPACE::SAXParseException &ex)
{ {
handleMessage(ex); handleMessage(ex);
} }

View file

@ -61,18 +61,16 @@ private:
#include <xercesc/sax/ErrorHandler.hpp> #include <xercesc/sax/ErrorHandler.hpp>
#include <xercesc/sax/SAXParseException.hpp> #include <xercesc/sax/SAXParseException.hpp>
XERCES_CPP_NAMESPACE_USE class VParserErrorHandler : public XERCES_CPP_NAMESPACE::ErrorHandler
class VParserErrorHandler : public ErrorHandler
{ {
public: public:
auto StatusMessage() const -> QString; auto StatusMessage() const -> QString;
auto Line() const -> XMLFileLoc; auto Line() const -> XMLFileLoc;
auto Column() const -> XMLFileLoc; auto Column() const -> XMLFileLoc;
void warning(const SAXParseException& ex) override; void warning(const XERCES_CPP_NAMESPACE::SAXParseException& ex) override;
void error(const SAXParseException& ex) override; void error(const XERCES_CPP_NAMESPACE::SAXParseException& ex) override;
void fatalError(const SAXParseException& ex) override; void fatalError(const XERCES_CPP_NAMESPACE::SAXParseException& ex) override;
void resetErrors() override; void resetErrors() override;
auto HasError() const -> bool; auto HasError() const -> bool;
@ -83,7 +81,7 @@ private:
QString m_description{}; QString m_description{};
bool m_hasError{false}; bool m_hasError{false};
void handleMessage(const SAXParseException& ex); void handleMessage(const XERCES_CPP_NAMESPACE::SAXParseException& ex);
}; };
#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0)

View file

@ -40,7 +40,7 @@ namespace
auto InvalidImage() -> QPixmap auto InvalidImage() -> QPixmap
{ {
QImageReader imageReader(VBackgroundPatternImage::brokenImage); QImageReader imageReader(VBackgroundPatternImage::brokenImage);
return std::move(QPixmap::fromImageReader(&imageReader)); return QPixmap::fromImageReader(&imageReader);
} }
} }

View file

@ -69,11 +69,12 @@ void ValidateSchema(const QString &schema)
if (tempSchema->open()) if (tempSchema->open())
{ {
XercesDOMParser domParser; XERCES_CPP_NAMESPACE::XercesDOMParser domParser;
domParser.setErrorHandler(&parserErrorHandler); domParser.setErrorHandler(&parserErrorHandler);
if (domParser.loadGrammar( if (domParser.loadGrammar(
tempSchema->fileName().toUtf8().constData(), Grammar::SchemaGrammarType, true) == nullptr) tempSchema->fileName().toUtf8().constData(),
XERCES_CPP_NAMESPACE::Grammar::SchemaGrammarType, true) == nullptr)
{ {
QFAIL(qUtf8Printable(QStringLiteral("%1 Could not load schema file '%2'.") QFAIL(qUtf8Printable(QStringLiteral("%1 Could not load schema file '%2'.")
.arg(parserErrorHandler.StatusMessage(), fileSchema.fileName()))); .arg(parserErrorHandler.StatusMessage(), fileSchema.fileName())));

View file

@ -5,17 +5,13 @@ Project {
minimumQbsVersion: "1.16" minimumQbsVersion: "1.16"
property bool enableConan: false property bool enableConan: false
property string minimumMacosVersion: undefined
Probes.ConanfileProbe { Probes.ConanfileProbe {
id: thirdPartyConanPackages id: thirdPartyConanPackages
condition: enableConan condition: enableConan
conanfilePath: project.sourceDirectory + "/conanfile.txt" conanfilePath: project.sourceDirectory + "/conanfile.py"
options: { verbose: true
if (qbs.targetOS.contains("unix") && !qbs.targetOS.contains("macos"))
return ({"xerces-c:shared": "False"});
return ({"xerces-c:shared": "True"});
}
} }
references: [ references: [