summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2019-09-20 11:14:05 +0200
committerEike Ziller <eike.ziller@qt.io>2019-09-20 12:50:37 +0000
commitfe6ba084c4f91265531905e031094a832600f091 (patch)
tree40f401fd977aa48056fb9116c808fdeb87fd708b
parent1273081224e38d393e74a7defadec98acd46df71 (diff)
downloadqt-creator-fe6ba084c4f91265531905e031094a832600f091.tar.gz
Help/litehtml: Fix litehtml build on Windows and with GCC 5.3
GCC 5.3 doesn't want to convert char* literals to QString sometimes, and for MSVC conversions litehtml::tstring/tchar_t <-> QString::fromStdString/QString fails because the former was wstring and wchar Also position independent code is needed on Linux Change-Id: Iec8dd0d9d38a07cd1c4db49c9edf10e3d1d5b156 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
-rw-r--r--src/plugins/help/qlitehtml/CMakeLists.txt17
-rw-r--r--src/plugins/help/qlitehtml/container_qpainter.cpp6
-rw-r--r--src/plugins/help/qlitehtml/qlitehtml.pri3
3 files changed, 18 insertions, 8 deletions
diff --git a/src/plugins/help/qlitehtml/CMakeLists.txt b/src/plugins/help/qlitehtml/CMakeLists.txt
index 43c20ca0b9..c9bcd3326d 100644
--- a/src/plugins/help/qlitehtml/CMakeLists.txt
+++ b/src/plugins/help/qlitehtml/CMakeLists.txt
@@ -2,26 +2,32 @@ cmake_minimum_required(VERSION 3.9)
project(QLiteHtml)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-set(CMAKE_CXX_STANDARD 14)
-
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/litehtml/CMakeLists.txt)
+ set(ORIG_FPIC ${CMAKE_POSITION_INDEPENDENT_CODE})
set(ORIG_CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE})
if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
else()
set(CMAKE_BUILD_TYPE "Release")
endif()
+ if (WIN32)
+ set(LITEHTML_UTF8 ON)
+ endif()
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_subdirectory(litehtml)
set(CMAKE_BUILD_TYPE ${ORIG_CMAKE_BUILD_TYPE})
+ set(CMAKE_POSITION_INDEPENDENT_CODE "${ORIG_FPIC}")
else()
find_package(litehtml REQUIRED)
endif()
find_package(Qt5 COMPONENTS Widgets REQUIRED)
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+set(CMAKE_CXX_STANDARD 14)
+
add_library(qlitehtml STATIC
container_qpainter.cpp container_qpainter.h
qlitehtmlwidget.cpp qlitehtmlwidget.h
@@ -29,3 +35,4 @@ add_library(qlitehtml STATIC
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/container_qpainter.cpp b/src/plugins/help/qlitehtml/container_qpainter.cpp
index 7dff2b0bb3..7a5f385948 100644
--- a/src/plugins/help/qlitehtml/container_qpainter.cpp
+++ b/src/plugins/help/qlitehtml/container_qpainter.cpp
@@ -1232,19 +1232,19 @@ QPixmap DocumentContainer::getPixmap(const QString &imageUrl, const QString &bas
QString DocumentContainer::serifFont() const
{
// TODO make configurable
- return "Times New Roman";
+ return {"Times New Roman"};
}
QString DocumentContainer::sansSerifFont() const
{
// TODO make configurable
- return "Arial";
+ return {"Arial"};
}
QString DocumentContainer::monospaceFont() const
{
// TODO make configurable
- return "Courier";
+ return {"Courier"};
}
QUrl DocumentContainer::resolveUrl(const QString &url, const QString &baseUrl) const
diff --git a/src/plugins/help/qlitehtml/qlitehtml.pri b/src/plugins/help/qlitehtml/qlitehtml.pri
index 95153af491..4c562d5037 100644
--- a/src/plugins/help/qlitehtml/qlitehtml.pri
+++ b/src/plugins/help/qlitehtml/qlitehtml.pri
@@ -11,10 +11,13 @@ exists($$PWD/litehtml/CMakeLists.txt) {
system("$$sprintf($$QMAKE_MKDIR_CMD, $$shell_path($${LITEHTML_BUILD_PATH}))")
macos: CMAKE_DEPLOYMENT_TARGET = -DCMAKE_OSX_DEPLOYMENT_TARGET=$${QMAKE_MACOSX_DEPLOYMENT_TARGET}
+ win32: LITEHTML_UTF8 = -DLITEHTML_UTF8=ON
LITEHTML_CMAKE_CMD = \
"$$QMAKE_CD $$system_quote($$shell_path($${LITEHTML_BUILD_PATH})) && \
cmake -DCMAKE_BUILD_TYPE=$$BUILD_TYPE \
-DCMAKE_INSTALL_PREFIX=$$system_quote($$shell_path($${LITEHTML_INSTALL_PATH})) \
+ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
+ $$LITEHTML_UTF8 \
$$CMAKE_DEPLOYMENT_TARGET \
$$system_quote($$shell_path($${LITEHTML_SOURCE_PATH}))"
message("$${LITEHTML_CMAKE_CMD}")