aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIvan Komissarov <ABBAPOH@gmail.com>2021-07-29 16:12:20 +0200
committerIvan Komissarov <ABBAPOH@gmail.com>2021-07-30 15:31:52 +0000
commit6a601950d4bb6240b99758878fefb00c8471bf74 (patch)
treea59fd2bb9b702a9416ed0d2a582fa7ca5ba4f280 /src
parent7048d5d7df979a82c1d7793953bbdc68f5494a31 (diff)
Build scriptengine as a shared object
Otherwise, we have an ODR violation when global static object is instantiated twice - one in qbscore and one in tst_language. Change-Id: Ib27d403da70ed16be3eb7ca2d979a67ae8a2259e Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/lib/scriptengine/CMakeLists.txt12
-rw-r--r--src/lib/scriptengine/include/QtScript/qtscriptglobal.h46
-rw-r--r--src/lib/scriptengine/scriptengine.pro1
-rw-r--r--src/lib/scriptengine/scriptengine.qbs10
-rw-r--r--src/lib/scriptengine/use_scriptengine.pri5
5 files changed, 23 insertions, 51 deletions
diff --git a/src/lib/scriptengine/CMakeLists.txt b/src/lib/scriptengine/CMakeLists.txt
index 01c6cd09b..39ceeec58 100644
--- a/src/lib/scriptengine/CMakeLists.txt
+++ b/src/lib/scriptengine/CMakeLists.txt
@@ -328,7 +328,14 @@ get_filename_component(_QT_BIN_DIRECTORY ${_QT_QMAKE_EXECUTABLE} DIRECTORY)
file(GLOB API_HEADERS "${QT_SCRIPT_PATH}/script/api/*.h")
-message("${QT_SCRIPT_PATH}")
+set(EXTERNAL_DEPENDS "")
+if(APPLE)
+ set(EXTERNAL_DEPENDS "-framework CoreFoundation")
+endif()
+
+if(WIN32)
+ set(EXTERNAL_DEPENDS "winmm")
+endif()
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/include/QtScript/qscriptengine.h"
@@ -342,9 +349,8 @@ add_custom_command(
)
add_qbs_library(qbsscriptengine
- STATIC
DEFINES ${QT_SCRIPT_DEFINES}
- DEPENDS Qt${QT_VERSION_MAJOR}::CorePrivate Qt6Core5Compat
+ DEPENDS Qt${QT_VERSION_MAJOR}::CorePrivate Qt6Core5Compat ${EXTERNAL_DEPENDS}
PUBLIC_DEPENDS ${QT_SCRIPT_PUBLIC_DEPENDS}
INCLUDES ${QT_SCRIPT_PUBLIC_INCLUDES} ${QT_SCRIPT_INCLUDES} ${JAVASCRIPT_CORE_INCLUDES}
PUBLIC_INCLUDES ${QT_SCRIPT_PUBLIC_INCLUDES}
diff --git a/src/lib/scriptengine/include/QtScript/qtscriptglobal.h b/src/lib/scriptengine/include/QtScript/qtscriptglobal.h
deleted file mode 100644
index 8b1e09bb1..000000000
--- a/src/lib/scriptengine/include/QtScript/qtscriptglobal.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qbs.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QBS_QTSCRIPTGLOBAL_H
-#define QBS_QTSCRIPTGLOBAL_H
-
-#define Q_SCRIPT_EXPORT
-#define Q_SCRIPTTOOLS_EXPORT
-
-#endif // include guard
diff --git a/src/lib/scriptengine/scriptengine.pro b/src/lib/scriptengine/scriptengine.pro
index 41e2e0262..fab0851fc 100644
--- a/src/lib/scriptengine/scriptengine.pro
+++ b/src/lib/scriptengine/scriptengine.pro
@@ -10,7 +10,6 @@ DEFINES += JSC=QTJSC jscyyparse=qtjscyyparse jscyylex=qtjscyylex jscyyerror=qt
DEFINES += QT_NO_USING_NAMESPACE
CONFIG += building-libs
-CONFIG += staticlib
CONFIG -= c++17
CONFIG += c++14
diff --git a/src/lib/scriptengine/scriptengine.qbs b/src/lib/scriptengine/scriptengine.qbs
index c7061fa98..5a5767c50 100644
--- a/src/lib/scriptengine/scriptengine.qbs
+++ b/src/lib/scriptengine/scriptengine.qbs
@@ -15,7 +15,10 @@ Project {
Depends { name: "QtScriptFwdHeaders" }
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["core-private"] }
- type: ["staticlibrary"]
+ Depends {
+ name: "Qt.core5compat";
+ condition: Utilities.versionCompare(Qt.core.version, "6.0.0") >= 0
+ }
name: "qbsscriptengine"
generatePkgConfigFile: false
@@ -119,10 +122,15 @@ Project {
}
cpp.warningLevel: "none"
cpp.optimization: "fast" // We cannot afford -O0 for QtScript even in debug builds.
+ cpp.frameworks: base.concat(qbs.targetOS.contains("darwin") ? ["CoreFoundation"] : [])
Properties {
condition: qbs.targetOS.contains("unix")
cpp.dynamicLibraries: base.concat(["pthread"])
}
+ Properties {
+ condition: qbs.targetOS.contains("windows")
+ cpp.dynamicLibraries: base.concat(["winmm"])
+ }
Group {
name: "pcre"
diff --git a/src/lib/scriptengine/use_scriptengine.pri b/src/lib/scriptengine/use_scriptengine.pri
index e8f82a949..e763c9d86 100644
--- a/src/lib/scriptengine/use_scriptengine.pri
+++ b/src/lib/scriptengine/use_scriptengine.pri
@@ -12,6 +12,11 @@
LIBS += -lqbsscriptengine$$qtPlatformTargetSuffix()
}
+ isEmpty(QBS_RPATH): QBS_RPATH = ../$$QBS_LIBRARY_DIRNAME
+ !qbs_disable_rpath {
+ linux-*: QMAKE_LFLAGS += -Wl,-z,origin \'-Wl,-rpath,\$\$ORIGIN/$${QBS_RPATH}\'
+ macos: QMAKE_LFLAGS += -Wl,-rpath,@loader_path/$${QBS_RPATH}
+ }
}
INCLUDEPATH += \