CMake: Fix QTC_STATIC_BUILD

Change-Id: Idfcd36f2d5fdaf09c958ff101aa5e83e0a29cb58
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Cristian Adam
2023-11-08 20:28:36 +01:00
parent 5b1aa26e47
commit f90f60bb32
10 changed files with 19 additions and 13 deletions

View File

@@ -123,7 +123,10 @@ else()
${YAML_SOURCE_DIR}/src/tag.h ${YAML_SOURCE_DIR}/src/tag.h
${YAML_SOURCE_DIR}/src/token.h ${YAML_SOURCE_DIR}/src/token.h
) )
if (NOT QTC_STATIC_BUILD) if (QTC_STATIC_BUILD)
extend_qtc_target(yaml-cpp
PUBLIC_DEFINES YAML_CPP_STATIC_DEFINE)
else()
extend_qtc_target(yaml-cpp extend_qtc_target(yaml-cpp
DEFINES yaml_cpp_EXPORTS DEFINES yaml_cpp_EXPORTS
PUBLIC_DEFINES YAML_CPP_DLL) PUBLIC_DEFINES YAML_CPP_DLL)

View File

@@ -211,9 +211,14 @@ function(add_qtc_library name)
) )
if (QTC_STATIC_BUILD) if (QTC_STATIC_BUILD)
extend_qtc_target(${name} PUBLIC_DEFINES ${EXPORT_SYMBOL}) extend_qtc_target(${name}
DEFINES ${EXPORT_SYMBOL}
PUBLIC_DEFINES ${EXPORT_SYMBOL})
else() else()
extend_qtc_target(${name} DEFINES ${EXPORT_SYMBOL}) extend_qtc_target(${name} DEFINES ${EXPORT_SYMBOL})
if (_arg_OBJECT OR _arg_STATIC)
extend_qtc_target(${name} PUBLIC_DEFINES ${EXPORT_SYMBOL})
endif()
endif() endif()
# everything is different with SOURCES_PREFIX # everything is different with SOURCES_PREFIX

View File

@@ -1,6 +1,5 @@
add_qtc_library(Nanotrace add_qtc_library(Nanotrace
BUILD_DEFAULT OFF BUILD_DEFAULT OFF
DEFINES NANOTRACE_LIBRARY
PUBLIC_DEFINES NANOTRACE_ENABLED PUBLIC_DEFINES NANOTRACE_ENABLED
SOURCES nanotrace.cpp nanotrace.h SOURCES nanotrace.cpp nanotrace.h
PUBLIC_DEPENDS Qt::Core PUBLIC_DEPENDS Qt::Core

View File

@@ -7,6 +7,8 @@
#if defined(NANOTRACE_LIBRARY) #if defined(NANOTRACE_LIBRARY)
# define NANOTRACESHARED_EXPORT Q_DECL_EXPORT # define NANOTRACESHARED_EXPORT Q_DECL_EXPORT
#elif defined(NANOTRACE_STATIC_LIBRARY)
# define NANOTRACESHARED_EXPORT
#else #else
# define NANOTRACESHARED_EXPORT Q_DECL_IMPORT # define NANOTRACESHARED_EXPORT Q_DECL_IMPORT
#endif #endif

View File

@@ -1,7 +1,6 @@
add_qtc_library(Spinner OBJECT add_qtc_library(Spinner OBJECT
# Never add dependencies to non-Qt libraries for this library # Never add dependencies to non-Qt libraries for this library
DEPENDS Qt::Core Qt::Widgets DEPENDS Qt::Core Qt::Widgets
PUBLIC_DEFINES SPINNER_LIBRARY
SOURCES SOURCES
spinner.cpp spinner.h spinner.cpp spinner.h
spinner.qrc spinner.qrc

View File

@@ -1,7 +1,6 @@
add_qtc_library(Tasking OBJECT add_qtc_library(Tasking OBJECT
# Never add dependencies to non-Qt libraries for this library # Never add dependencies to non-Qt libraries for this library
DEPENDS Qt::Concurrent Qt::Core Qt::Network DEPENDS Qt::Concurrent Qt::Core Qt::Network
PUBLIC_DEFINES TASKING_LIBRARY
SOURCES SOURCES
barrier.cpp barrier.h barrier.cpp barrier.h
concurrentcall.h concurrentcall.h

View File

@@ -3,6 +3,8 @@ add_qtc_library(Utils
PUBLIC_DEPENDS PUBLIC_DEPENDS
Qt::Concurrent Qt::Core Qt::Network Qt::Gui Qt::Widgets Qt::Concurrent Qt::Core Qt::Network Qt::Gui Qt::Widgets
Qt::Core5Compat Qt::Core5Compat
$<$<BOOL:${QTC_STATIC_BUILD}>:Tasking>
$<$<BOOL:${QTC_STATIC_BUILD}>:Spinner>
SOURCES SOURCES
../3rdparty/span/span.hpp ../3rdparty/span/span.hpp
../3rdparty/tl_expected/include/tl/expected.hpp ../3rdparty/tl_expected/include/tl/expected.hpp

View File

@@ -12,7 +12,7 @@
#include <QTemporaryFile> #include <QTemporaryFile>
#include <QVersionNumber> #include <QVersionNumber>
Q_LOGGING_CATEGORY(log, "terminal.externalprocess", QtWarningMsg) Q_LOGGING_CATEGORY(logTE, "terminal.externalprocess", QtWarningMsg)
namespace Utils { namespace Utils {
@@ -155,12 +155,12 @@ expected_str<qint64> ProcessStubCreator::startStubProcess(const ProcessSetupData
QObject::connect(process, &Process::readyReadStandardOutput, process, [process] { QObject::connect(process, &Process::readyReadStandardOutput, process, [process] {
const QString output = process->readAllStandardOutput(); const QString output = process->readAllStandardOutput();
if (!output.isEmpty()) if (!output.isEmpty())
qCWarning(log).noquote() << output; qCWarning(logTE).noquote() << output;
}); });
QObject::connect(process, &Process::readyReadStandardError, process, [process] { QObject::connect(process, &Process::readyReadStandardError, process, [process] {
const QString output = process->readAllStandardError(); const QString output = process->readAllStandardError();
if (!output.isEmpty()) if (!output.isEmpty())
qCCritical(log).noquote() << output; qCCritical(logTE).noquote() << output;
}); });
QObject::connect(process, &Process::done, m_interface, &TerminalInterface::onStubExited); QObject::connect(process, &Process::done, m_interface, &TerminalInterface::onStubExited);

View File

@@ -18,8 +18,6 @@ add_feature_info("ProjectStorage" ${USE_PROJECTSTORAGE} "")
add_qtc_library(QmlDesignerUtils STATIC add_qtc_library(QmlDesignerUtils STATIC
DEPENDS DEPENDS
Qt::Gui Utils Qt::QmlPrivate Core Qt::Gui Utils Qt::QmlPrivate Core
DEFINES QMLDESIGNERUTILS_LIBRARY
PUBLIC_DEFINES $<$<BOOL:${QTC_STATIC_BUILD}>:QMLDESIGNER_STATIC_LIBRARY>
PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/utils PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/utils
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/utils SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/utils
@@ -69,8 +67,6 @@ add_qtc_library(QmlDesignerCore STATIC
TextEditor TextEditor
Sqlite Sqlite
DEFINES DEFINES
QMLDESIGNERCORE_LIBRARY
QMLDESIGNERUTILS_LIBRARY
$<$<BOOL:${USE_PROJECTSTORAGE}>:QDS_USE_PROJECTSTORAGE> $<$<BOOL:${USE_PROJECTSTORAGE}>:QDS_USE_PROJECTSTORAGE>
INCLUDES INCLUDES
${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}
@@ -443,7 +439,6 @@ add_qtc_plugin(QmlDesigner
IDE_LIBRARY_BASENAME=\"${IDE_LIBRARY_BASE_PATH}\" IDE_LIBRARY_BASENAME=\"${IDE_LIBRARY_BASE_PATH}\"
SHARE_QML_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../../../share/qtcreator/qmldesigner" SHARE_QML_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../../../share/qtcreator/qmldesigner"
$<$<BOOL:${USE_PROJECTSTORAGE}>:QDS_USE_PROJECTSTORAGE> $<$<BOOL:${USE_PROJECTSTORAGE}>:QDS_USE_PROJECTSTORAGE>
QMLDESIGNER_LIBRARY QMLDESIGNERCORE_LIBRARY QMLDESIGNERUTILS_LIBRARY
INCLUDES INCLUDES
${CMAKE_CURRENT_LIST_DIR}/components ${CMAKE_CURRENT_LIST_DIR}/components
${CMAKE_CURRENT_LIST_DIR}/components/assetslibrary ${CMAKE_CURRENT_LIST_DIR}/components/assetslibrary

View File

@@ -7,6 +7,8 @@
#if defined(STUDIOWELCOME_LIBRARY) #if defined(STUDIOWELCOME_LIBRARY)
# define STUDIOWELCOME_EXPORT Q_DECL_EXPORT # define STUDIOWELCOME_EXPORT Q_DECL_EXPORT
#elif defined(STUDIOWELCOME_STATIC_LIBRARY)
# define STUDIOWELCOME_EXPORT
#else #else
# define STUDIOWELCOME_EXPORT Q_DECL_IMPORT # define STUDIOWELCOME_EXPORT Q_DECL_IMPORT
#endif #endif