From bf536a04413e1d5e28fa95c2772f1fb47bb8d6ef Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 22 Sep 2020 17:35:59 +0200 Subject: [PATCH] Make qlitehtml a dynamic library So it can be re-used by other plugins. Fixes: QTCREATORBUG-24330 Change-Id: Ic9ff865f96c01a37584b02d1125717a307cc79ed Reviewed-by: Cristian Adam --- src/plugins/help/qlitehtml/CMakeLists.txt | 18 +++++----- src/plugins/help/qlitehtml/qlitehtml_global.h | 36 +++++++++++++++++++ src/plugins/help/qlitehtml/qlitehtmlwidget.h | 4 ++- 3 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 src/plugins/help/qlitehtml/qlitehtml_global.h diff --git a/src/plugins/help/qlitehtml/CMakeLists.txt b/src/plugins/help/qlitehtml/CMakeLists.txt index 31ed481e495..b9bba459c26 100644 --- a/src/plugins/help/qlitehtml/CMakeLists.txt +++ b/src/plugins/help/qlitehtml/CMakeLists.txt @@ -27,13 +27,15 @@ find_package(Qt5 COMPONENTS Widgets REQUIRED) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) -add_library(qlitehtml STATIC - container_qpainter.cpp container_qpainter.h - qlitehtmlwidget.cpp qlitehtmlwidget.h +add_qtc_library(qlitehtml + PUBLIC_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS Qt5::Widgets litehtml + PROPERTIES + POSITION_INDEPENDENT_CODE ON + SOURCES + container_qpainter.cpp container_qpainter.h + qlitehtml_global.h + qlitehtmlwidget.cpp qlitehtmlwidget.h ) - -target_include_directories(qlitehtml PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries(qlitehtml PRIVATE Qt5::Widgets litehtml) -set_target_properties(qlitehtml PROPERTIES POSITION_INDEPENDENT_CODE ON) diff --git a/src/plugins/help/qlitehtml/qlitehtml_global.h b/src/plugins/help/qlitehtml/qlitehtml_global.h new file mode 100644 index 00000000000..a480b1146b6 --- /dev/null +++ b/src/plugins/help/qlitehtml/qlitehtml_global.h @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +#if defined(QLITEHTML_LIBRARY) +# define QLITEHTML_EXPORT Q_DECL_EXPORT +#elif defined(QLITEHTML_STATIC_LIBRARY) // Abuse single files for manual tests +# define QLITEHTML_EXPORT +#else +# define QLITEHTML_EXPORT Q_DECL_IMPORT +#endif diff --git a/src/plugins/help/qlitehtml/qlitehtmlwidget.h b/src/plugins/help/qlitehtml/qlitehtmlwidget.h index 1eed9b1f095..5da2c90c72d 100644 --- a/src/plugins/help/qlitehtml/qlitehtmlwidget.h +++ b/src/plugins/help/qlitehtml/qlitehtmlwidget.h @@ -25,6 +25,8 @@ #pragma once +#include "qlitehtml_global.h" + #include #include @@ -32,7 +34,7 @@ class QLiteHtmlWidgetPrivate; -class QLiteHtmlWidget : public QAbstractScrollArea +class QLITEHTML_EXPORT QLiteHtmlWidget : public QAbstractScrollArea { Q_OBJECT public: