diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2016-06-30 15:17:03 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2018-04-09 07:17:25 +0000 |
commit | d45d7ea294daa85249432572a6bdb4dece82d44c (patch) | |
tree | c976658ad97ddac8ec1049f5d02ed3431ca2fcbb | |
parent | cf12d96aa7e22f8cb18b6af076fec36b6ea96f34 (diff) |
Add QtScript git submodule
This adds QtScript as a git submodule to build the qbsscriptengine
library.
QtDeclarative support has been stripped out. We don't need that.
Windows CE and Symbian platform support has been removed.
JIT has been disabled, which improves resolve/rule execution by 8%.
[ChangeLog] Bundled QtScript as a submodule.
Task-number: QBS-913
Change-Id: Idfbaf06eb2cef3985e5eae955f231686499f7754
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | doc/qbs.qdoc | 1 | ||||
-rw-r--r-- | qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs | 1 | ||||
-rw-r--r-- | qbs.pro | 6 | ||||
-rw-r--r-- | src/lib/bundledlibs.pri | 3 | ||||
-rw-r--r-- | src/lib/corelib/corelib.pro | 9 | ||||
-rw-r--r-- | src/lib/corelib/corelib.qbs | 11 | ||||
-rw-r--r-- | src/lib/libs.qbs | 1 | ||||
-rw-r--r-- | src/lib/scriptengine/scriptengine.pro | 91 | ||||
-rw-r--r-- | src/lib/scriptengine/scriptengine.qbs | 426 | ||||
-rw-r--r-- | src/lib/scriptengine/use_scriptengine.pri | 10 | ||||
-rw-r--r-- | src/shared/bundledqt/bundledqt.qbs | 3 | ||||
m--------- | src/shared/qtscript | 0 | ||||
-rw-r--r-- | tests/auto/buildgraph/buildgraph.pro | 6 | ||||
-rw-r--r-- | tests/auto/language/language.pro | 8 | ||||
-rw-r--r-- | tests/auto/language/language.qbs | 6 |
16 files changed, 580 insertions, 5 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..f2f854c17 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "qtscript"] + path = src/shared/qtscript + url = ../../qt/qtscript.git diff --git a/doc/qbs.qdoc b/doc/qbs.qdoc index 8cbc59f6b..9108f0f09 100644 --- a/doc/qbs.qdoc +++ b/doc/qbs.qdoc @@ -506,6 +506,7 @@ \row \li qbs_no_man_install \li Exclude the man page from installation. \row \li qbs_enable_project_file_updates \li Enable API for updating project files. This implies a dependency to the Qt GUI module. + \row \li qbs_use_bundled_qtscript \li Use the bundled QtScript library. \endtable \section1 Using Docker diff --git a/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs b/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs index dd079a106..8bd3c617a 100644 --- a/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs +++ b/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs @@ -7,6 +7,7 @@ Module { property bool enableRPath: true property bool installApiHeaders: true property bool enableBundledQt: true + property bool useBundledQtScript: false property string libDirName: "lib" property string appInstallDir: "bin" property string libInstallDir: qbs.targetOS.contains("windows") ? "bin" : libDirName @@ -1,4 +1,5 @@ requires(!cross_compile) +include(src/lib/bundledlibs.pri) defineTest(minQtVersion) { maj = $$1 @@ -40,6 +41,11 @@ CONFIG(shared, static|shared): src_plugins.depends = corelib tests.depends = static_res static_res.file = static-res.pro static_res.depends = src_app src_libexec src_plugins static.pro +qbs_use_bundled_qtscript { + scriptenginelib.file = src/lib/scriptengine/scriptengine.pro + corelib.depends = scriptenginelib + SUBDIRS += scriptenginelib +} SUBDIRS += \ corelib\ setupqtprofilelib\ diff --git a/src/lib/bundledlibs.pri b/src/lib/bundledlibs.pri new file mode 100644 index 000000000..6ffedbbd8 --- /dev/null +++ b/src/lib/bundledlibs.pri @@ -0,0 +1,3 @@ +!qbs_use_bundled_qtscript:!qtHaveModule(script) { + CONFIG += qbs_use_bundled_qtscript +} diff --git a/src/lib/corelib/corelib.pro b/src/lib/corelib/corelib.pro index 441cb50c2..9299ab953 100644 --- a/src/lib/corelib/corelib.pro +++ b/src/lib/corelib/corelib.pro @@ -1,5 +1,12 @@ TARGET = qbscore include(../library.pri) +include(../bundledlibs.pri) + +qbs_use_bundled_qtscript { + include(../scriptengine/use_scriptengine.pri) +} else { + QT += script +} isEmpty(QBS_RELATIVE_LIBEXEC_PATH) { win32:QBS_RELATIVE_LIBEXEC_PATH=../bin @@ -7,7 +14,7 @@ isEmpty(QBS_RELATIVE_LIBEXEC_PATH) { } DEFINES += QBS_RELATIVE_LIBEXEC_PATH=\\\"$${QBS_RELATIVE_LIBEXEC_PATH}\\\" -QT += core-private network script +QT += core-private network qbs_enable_project_file_updates: QT += gui INCLUDEPATH += $$PWD diff --git a/src/lib/corelib/corelib.qbs b/src/lib/corelib/corelib.qbs index 36bf84a4e..6c0671e25 100644 --- a/src/lib/corelib/corelib.qbs +++ b/src/lib/corelib/corelib.qbs @@ -4,7 +4,16 @@ import qbs.Utilities QbsLibrary { Depends { name: "cpp" } Depends { name: "bundledqt" } - Depends { name: "Qt"; submodules: ["core-private", "network", "script", "xml"] } + Depends { name: "Qt"; submodules: ["core-private", "network", "xml"] } + Depends { + name: "Qt.script" + condition: !qbsbuildconfig.useBundledQtScript + required: false + } + Depends { + name: "qbsscriptengine" + condition: qbsbuildconfig.useBundledQtScript || !Qt.script.present + } Depends { condition: qbsbuildconfig.enableProjectFileUpdates; name: "Qt.gui" } Depends { condition: Qt.core.staticBuild; productTypes: ["qbsplugin"] } name: "qbscore" diff --git a/src/lib/libs.qbs b/src/lib/libs.qbs index e31dd463d..478db3286 100644 --- a/src/lib/libs.qbs +++ b/src/lib/libs.qbs @@ -4,5 +4,6 @@ Project { references: [ "corelib/corelib.qbs", "qtprofilesetup/qtprofilesetup.qbs", + "scriptengine/scriptengine.qbs", ] } diff --git a/src/lib/scriptengine/scriptengine.pro b/src/lib/scriptengine/scriptengine.pro new file mode 100644 index 000000000..f5d4ad590 --- /dev/null +++ b/src/lib/scriptengine/scriptengine.pro @@ -0,0 +1,91 @@ +TARGET = qbsscriptengine +include(../library.pri) +INSTALLS = + +QT = core-private + +DEFINES += QT_BUILD_SCRIPT_LIB + +DEFINES += JSC=QTJSC jscyyparse=qtjscyyparse jscyylex=qtjscyylex jscyyerror=qtjscyyerror WTF=QTWTF +DEFINES += QT_NO_USING_NAMESPACE + +CONFIG += building-libs +CONFIG += staticlib + +GENERATED_SOURCES_DIR = generated + +CONFIG += QTDIR_build +include(../../shared/qtscript/src/3rdparty/javascriptcore/WebKit.pri) + +# Disable a few warnings on Windows. +# These are in addition to the ones disabled in WebKit.pri +msvc: QMAKE_CXXFLAGS += -wd4396 -wd4099 +else: QMAKE_CXXFLAGS += -Wno-deprecated + +# We cannot afford -O0 for QtScript even in debug builds. +QMAKE_CXXFLAGS_DEBUG += -O2 + +darwin { + DEFINES += ENABLE_JSC_MULTIPLE_THREADS=0 + contains(QT_CONFIG, coreservices) { + LIBS_PRIVATE += -framework CoreServices + } else { + LIBS_PRIVATE += -framework CoreFoundation + } +} +win32 { + LIBS += -lwinmm +} + +# Suppress 'LEAK' messages (see QTBUG-18201) +DEFINES += LOG_DISABLED=1 + +JAVASCRIPTCORE_JIT = no +include(../../shared/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri) + +# This line copied from WebCore.pro +DEFINES += WTF_USE_JAVASCRIPTCORE_BINDINGS=1 WTF_CHANGES=1 + +CONFIG(release, debug|release): DEFINES += NDEBUG + +# Avoid JSC C API functions being exported. +DEFINES += JS_NO_EXPORT + +!build_pass { + qtPrepareTool(QMAKE_SYNCQT, syncqt, , system) + QMAKE_SYNCQT += \ + -minimal -version $$[QT_VERSION] \ + -outdir $$system_quote($$system_path($$OUT_PWD)) \ + $$system_quote($$system_path($$clean_path($$PWD/../../shared/qtscript))) + !system($$QMAKE_SYNCQT): error("Failed to execute syncqt for the bundled QtScript module.") +} + +INCLUDEPATH += \ + $$OUT_PWD/include \ + $$OUT_PWD/include/QtScript/$$[QT_VERSION]/QtScript \ + $$PWD/../../shared/qtscript/src/script \ + $$PWD/../../shared/qtscript/src/script/api + +include(../../shared/qtscript/src/script/api/api.pri) +include(../../shared/qtscript/src/script/parser/parser.pri) + +BRIDGESRCDIR = ../../shared/qtscript/src/script/bridge +SOURCES += \ + $$BRIDGESRCDIR/qscriptactivationobject.cpp \ + $$BRIDGESRCDIR/qscriptclassobject.cpp \ + $$BRIDGESRCDIR/qscriptfunction.cpp \ + $$BRIDGESRCDIR/qscriptglobalobject.cpp \ + $$BRIDGESRCDIR/qscriptobject.cpp \ + $$BRIDGESRCDIR/qscriptqobject.cpp \ + $$BRIDGESRCDIR/qscriptstaticscopeobject.cpp \ + $$BRIDGESRCDIR/qscriptvariant.cpp + +HEADERS += \ + $$BRIDGESRCDIR/qscriptactivationobject_p.h \ + $$BRIDGESRCDIR/qscriptclassobject_p.h \ + $$BRIDGESRCDIR/qscriptfunction_p.h \ + $$BRIDGESRCDIR/qscriptglobalobject_p.h \ + $$BRIDGESRCDIR/qscriptobject_p.h \ + $$BRIDGESRCDIR/qscriptqobject_p.h \ + $$BRIDGESRCDIR/qscriptstaticscopeobject_p.h \ + $$BRIDGESRCDIR/qscriptvariant_p.h diff --git a/src/lib/scriptengine/scriptengine.qbs b/src/lib/scriptengine/scriptengine.qbs new file mode 100644 index 000000000..c92bc1954 --- /dev/null +++ b/src/lib/scriptengine/scriptengine.qbs @@ -0,0 +1,426 @@ +import qbs +import qbs.File +import qbs.FileInfo +import qbs.Process + +Project { + QbsLibrary { + condition: qbsbuildconfig.useBundledQtScript || !Qt.script.present + Depends { + name: "Qt.script" + condition: !qbsbuildconfig.useBundledQtScript + required: false + } + Depends { name: "QtScriptFwdHeaders" } + Depends { name: "cpp" } + Depends { name: "Qt"; submodules: ["core-private"] } + type: ["staticlibrary"] + name: "qbsscriptengine" + + property bool useSystemMalloc: !qbs.targetOS.contains("macos") + && !qbs.targetOS.contains("unix") + property string qtscriptPath: "../../shared/qtscript/src/" + + cpp.includePaths: { + var result = base.concat(["."]); + + var jscBaseDir = qtscriptPath + "3rdparty/javascriptcore"; + result.push(jscBaseDir); + jscBaseDir += "/JavaScriptCore"; + result.push(jscBaseDir); + + var jscSubDirs = [ + "assembler", + "bytecode", + "bytecompiler", + "debugger", + "interpreter", + "jit", + "parser", + "pcre", + "profiler", + "runtime", + "wrec", + "wtf", + "wtf/unicode", + "yarr", + "API", + "ForwardingHeaders", + "generated"]; + result = result.concat(jscSubDirs.map(function(s) { return jscBaseDir + '/' + s; })); + + result.push(qtscriptPath + "script"); + result.push(qtscriptPath + "script/api"); + result.push(qtscriptPath + "script/parser"); + result = result.concat(QtScriptFwdHeaders.publicIncludePaths, + QtScriptFwdHeaders.privateIncludePaths); + return result; + } + cpp.defines: { + var result = base.concat([ + "QT_BUILD_SCRIPT_LIB", "QT_NO_USING_NAMESPACE", + "JSC=QTJSC", "jscyyparse=qtjscyyparse", "jscyylex=qtjscyylex", + "jscyyerror=qtjscyyerror", + "WTF=QTWTF", + "LOG_DISABLED=1", + "WTF_USE_JAVASCRIPTCORE_BINDINGS=1", "WTF_CHANGES=1", + "JS_NO_EXPORT"]); + if (qbs.buildVariant != "debug") + result.push("NDEBUG"); + if (qbs.targetOS.contains("macos")) + result.push("ENABLE_JSC_MULTIPLE_THREADS=0"); + + // JavaScriptCore + result.push("BUILDING_QT__", "BUILDING_JavaScriptCore", "BUILDING_WTF", + "ENABLE_JIT=0", "ENABLE_YARR_JIT=0", "ENABLE_YARR=0"); + if (qbs.targetOS.contains("windows")) { + // Prevent definition of min, max macros in windows.h + result.push("NOMINMAX"); + // Enables rand_s + result.push("_CRT_RAND_S"); + } + + // WebKit + result.push("WTF_USE_ACCELERATED_COMPOSITING"); + if (useSystemMalloc) + result.push("USE_SYSTEM_MALLOC"); + return result; + } + cpp.cxxFlags: { + var result = base; + if (qbs.toolchain.contains("gcc")) { + result.push("-fno-strict-aliasing", + "-Wall", "-Wreturn-type", "-Wcast-align", "-Wchar-subscripts", + "-Wformat-security", "-Wreturn-type", "-Wno-unused-parameter", + "-Wno-sign-compare", "-Wno-switch", "-Wno-switch-enum", "-Wundef", + "-Wmissing-noreturn", "-Winit-self", "-Wno-deprecated", + "-Wno-suggest-attribute=noreturn", "-Wno-nonnull-compare"); + } else if (qbs.toolchain.contains("msvc")) { + result.push("-wd4291", "-wd4344", "-wd4396", "-wd4503", "-wd4800", "-wd4819", + "-wd4996"); + } + if (qbs.targetOS.contains("unix")) + result.push("-pthread"); + + return result; + } + cpp.warningLevel: "none" + cpp.optimization: "fast" // We cannot afford -O0 for QtScript even in debug builds. + Properties { + condition: qbs.targetOS.contains("unix") + cpp.dynamicLibraries: base.concat(["pthread"]) + } + + Group { + name: "pcre" + prefix: qtscriptPath + "3rdparty/javascriptcore/JavaScriptCore/pcre/" + files: [ + "pcre_compile.cpp", + "pcre_exec.cpp", + "pcre_tables.cpp", + "pcre_ucp_searchfuncs.cpp", + "pcre_xclass.cpp", + ] + } + + Group { + name: "system malloc replacement" + prefix: qtscriptPath + "3rdparty/javascriptcore/JavaScriptCore/" + condition: !useSystemMalloc + files: [ + "wtf/TCSystemAlloc.cpp", + ] + } + + Group { + name: "JavaScriptCore" + prefix: qtscriptPath + "3rdparty/javascriptcore/JavaScriptCore/" + files: [ + "API/JSBase.cpp", + "API/JSCallbackConstructor.cpp", + "API/JSCallbackFunction.cpp", + "API/JSCallbackObject.cpp", + "API/JSClassRef.cpp", + "API/JSContextRef.cpp", + "API/JSObjectRef.cpp", + "API/JSStringRef.cpp", + "API/JSValueRef.cpp", + "API/OpaqueJSString.cpp", + "assembler/ARMAssembler.cpp", + "assembler/MacroAssemblerARM.cpp", + "bytecode/CodeBlock.cpp", + "bytecode/JumpTable.cpp", + "bytecode/Opcode.cpp", + "bytecode/SamplingTool.cpp", + "bytecode/StructureStubInfo.cpp", + "bytecompiler/BytecodeGenerator.cpp", + "bytecompiler/NodesCodegen.cpp", + "debugger/DebuggerActivation.cpp", + "debugger/DebuggerCallFrame.cpp", + "debugger/Debugger.cpp", + "generated/Grammar.cpp", + "interpreter/CallFrame.cpp", + "interpreter/Interpreter.cpp", + "interpreter/RegisterFile.cpp", + "parser/Lexer.cpp", + "parser/Nodes.cpp", + "parser/ParserArena.cpp", + "parser/Parser.cpp", + "profiler/Profile.cpp", + "profiler/ProfileGenerator.cpp", + "profiler/ProfileNode.cpp", + "profiler/Profiler.cpp", + "runtime/ArgList.cpp", + "runtime/Arguments.cpp", + "runtime/ArrayConstructor.cpp", + "runtime/ArrayPrototype.cpp", + "runtime/BooleanConstructor.cpp", + "runtime/BooleanObject.cpp", + "runtime/BooleanPrototype.cpp", + "runtime/CallData.cpp", + "runtime/Collector.cpp", + "runtime/CommonIdentifiers.cpp", + "runtime/Completion.cpp", + "runtime/ConstructData.cpp", + "runtime/DateConstructor.cpp", + "runtime/DateConversion.cpp", + "runtime/DateInstance.cpp", + "runtime/DatePrototype.cpp", + "runtime/ErrorConstructor.cpp", + "runtime/Error.cpp", + "runtime/ErrorInstance.cpp", + "runtime/ErrorPrototype.cpp", + "runtime/ExceptionHelpers.cpp", + "runtime/Executable.cpp", + "runtime/FunctionConstructor.cpp", + "runtime/FunctionPrototype.cpp", + "runtime/GetterSetter.cpp", + "runtime/GlobalEvalFunction.cpp", + "runtime/Identifier.cpp", + "runtime/InitializeThreading.cpp", + "runtime/InternalFunction.cpp", + "runtime/JSActivation.cpp", + "runtime/JSAPIValueWrapper.cpp", + "runtime/JSArray.cpp", + "runtime/JSByteArray.cpp", + "runtime/JSCell.cpp", + "runtime/JSFunction.cpp", + "runtime/JSGlobalData.cpp", + "runtime/JSGlobalObject.cpp", + "runtime/JSGlobalObjectFunctions.cpp", + "runtime/JSImmediate.cpp", + "runtime/JSLock.cpp", + "runtime/JSNotAnObject.cpp", + "runtime/JSNumberCell.cpp", + "runtime/JSObject.cpp", + "runtime/JSONObject.cpp", + "runtime/JSPropertyNameIterator.cpp", + "runtime/JSStaticScopeObject.cpp", + "runtime/JSString.cpp", + "runtime/JSValue.cpp", + "runtime/JSVariableObject.cpp", + "runtime/JSWrapperObject.cpp", + "runtime/LiteralParser.cpp", + "runtime/Lookup.cpp", + "runtime/MarkStackPosix.cpp", + "runtime/MarkStackSymbian.cpp", + "runtime/MarkStackWin.cpp", + "runtime/MarkStack.cpp", + "runtime/MathObject.cpp", + "runtime/NativeErrorConstructor.cpp", + "runtime/NativeErrorPrototype.cpp", + "runtime/NumberConstructor.cpp", + "runtime/NumberObject.cpp", + "runtime/NumberPrototype.cpp", + "runtime/ObjectConstructor.cpp", + "runtime/ObjectPrototype.cpp", + "runtime/Operations.cpp", + "runtime/PropertyDescriptor.cpp", + "runtime/PropertyNameArray.cpp", + "runtime/PropertySlot.cpp", + "runtime/PrototypeFunction.cpp", + "runtime/RegExpConstructor.cpp", + "runtime/RegExp.cpp", + "runtime/RegExpObject.cpp", + "runtime/RegExpPrototype.cpp", + "runtime/ScopeChain.cpp", + "runtime/SmallStrings.cpp", + "runtime/StringConstructor.cpp", + "runtime/StringObject.cpp", + "runtime/StringPrototype.cpp", + "runtime/StructureChain.cpp", + "runtime/Structure.cpp", + "runtime/TimeoutChecker.cpp", + "runtime/UString.cpp", + "runtime/UStringImpl.cpp", + "wtf/Assertions.cpp", + "wtf/ByteArray.cpp", + "wtf/CurrentTime.cpp", + "wtf/DateMath.cpp", + "wtf/dtoa.cpp", + "wtf/FastMalloc.cpp", + "wtf/HashTable.cpp", + "wtf/MainThread.cpp", + "wtf/qt/MainThreadQt.cpp", + "wtf/qt/ThreadingQt.cpp", + "wtf/RandomNumber.cpp", + "wtf/RefCountedLeakCounter.cpp", + "wtf/ThreadingNone.cpp", + "wtf/Threading.cpp", + "wtf/TypeTraits.cpp", + "wtf/unicode/CollatorDefault.cpp", + "wtf/unicode/icu/CollatorICU.cpp", + "wtf/unicode/UTF8.cpp", + ] + } + Group { + name: "api" + prefix: qtscriptPath + "script/api/" + files: [ + "qscriptable.cpp", + "qscriptable.h", + "qscriptable_p.h", + "qscriptclass.cpp", + "qscriptclass.h", + "qscriptclasspropertyiterator.cpp", + "qscriptclasspropertyiterator.h", + "qscriptcontext.cpp", + "qscriptcontext.h", + "qscriptcontextinfo.cpp", + "qscriptcontextinfo.h", + "qscriptcontext_p.h", + "qscriptengineagent.cpp", + "qscriptengineagent.h", + "qscriptengineagent_p.h", + "qscriptengine.cpp", + "qscriptengine.h", + "qscriptengine_p.h", + "qscriptextensioninterface.h", + "qscriptextensionplugin.cpp", + "qscriptextensionplugin.h", + "qscriptprogram.cpp", + "qscriptprogram.h", + "qscriptprogram_p.h", + "qscriptstring.cpp", + "qscriptstring.h", + "qscriptstring_p.h", + "qscriptvalue.cpp", + "qscriptvalue.h", + "qscriptvalueiterator.cpp", + "qscriptvalueiterator.h", + "qscriptvalue_p.h", + "qtscriptglobal.h", + ] + } + Group { + name: "bridge" + prefix: qtscriptPath + "script/bridge/" + files: [ + "qscriptactivationobject.cpp", + "qscriptactivationobject_p.h", + "qscriptclassobject.cpp", + "qscriptclassobject_p.h", + "qscriptfunction.cpp", + "qscriptfunction_p.h", + "qscriptglobalobject.cpp", + "qscriptglobalobject_p.h", + "qscriptobject.cpp", + "qscriptobject_p.h", + "qscriptqobject.cpp", + "qscriptqobject_p.h", + "qscriptstaticscopeobject.cpp", + "qscriptstaticscopeobject_p.h", + "qscriptvariant.cpp", + "qscriptvariant_p.h", + ] + } + Group { + name: "parser" + prefix: qtscriptPath + "script/parser/" + files: [ + "qscriptast.cpp", + "qscriptastfwd_p.h", + "qscriptast_p.h", + "qscriptastvisitor.cpp", + "qscriptastvisitor_p.h", + "qscriptgrammar.cpp", + "qscriptgrammar_p.h", + "qscriptlexer.cpp", + "qscriptlexer_p.h", + "qscriptsyntaxchecker.cpp", + "qscriptsyntaxchecker_p.h", + ] + } + + Export { + Depends { name: "QtScriptFwdHeaders" } + Depends { name: "cpp" } + cpp.includePaths: QtScriptFwdHeaders.publicIncludePaths + Properties { + condition: qbs.targetOS.contains("unix") + cpp.dynamicLibraries: base.concat(["pthread"]) + } + Properties { + condition: qbs.targetOS.contains("windows") + cpp.dynamicLibraries: base.concat(["winmm"]) + } + } + } + Product { + type: ["hpp"] + name: "QtScriptFwdHeaders" + Depends { name: "Qt.core" } + Group { + files: [ + "../../shared/qtscript/src/script/api/*.h" + ] + fileTags: ["qtscriptheader"] + } + Rule { + multiplex: true + inputs: ["qtscriptheader"] + Artifact { + filePath: "include/QtScript/qscriptengine.h" + fileTags: ["hpp"] + } + prepare: { + var syncQtPath = FileInfo.joinPaths(product.Qt.core.binPath, "syncqt.pl"); + if (!File.exists(syncQtPath)) { + // syncqt.pl is not in Qt's bin path. We might have a developer build. + // As we don't provide QT_HOST_BINS/src in our Qt modules we must + // kindly ask qmake. + var qmake = FileInfo.joinPaths(product.Qt.core.binPath, + "qmake" + product.cpp.executableSuffix); + var p = new Process(); + if (p.exec(qmake, ["-query", "QT_HOST_BINS/src"]) !== 0) + throw new Error("Error while querying qmake."); + syncQtPath = FileInfo.joinPaths(p.readStdOut().replace(/[\r\n]/, ''), + "syncqt.pl"); + } + var qtScriptSrcPath = FileInfo.cleanPath( + FileInfo.path(inputs["qtscriptheader"][0].filePath) + "/../../.."); + console.info("qtScriptSrcPath: " + qtScriptSrcPath); + var cmd = new Command("perl", [ + syncQtPath, + "-minimal", + "-version", product.Qt.core.version, + "-outdir", FileInfo.cleanPath( + FileInfo.path(output.filePath) + "/../.."), + qtScriptSrcPath + ]); + cmd.description = "Create forwarding headers for the bundled QtScript module."; + return cmd; + } + } + Export { + Depends { name: "Qt.core" } + property stringList publicIncludePaths: [ + FileInfo.joinPaths(product.buildDirectory, "include") + ] + property stringList privateIncludePaths: [ + FileInfo.joinPaths(product.buildDirectory, "include", + "QtScript", Qt.core.version, "QtScript") + ] + } + } +} diff --git a/src/lib/scriptengine/use_scriptengine.pri b/src/lib/scriptengine/use_scriptengine.pri new file mode 100644 index 000000000..296b6e416 --- /dev/null +++ b/src/lib/scriptengine/use_scriptengine.pri @@ -0,0 +1,10 @@ +!qbs_do_not_link_bundled_qtscript { + include(../../library_dirname.pri) + isEmpty(QBSLIBDIR) { + QBSLIBDIR = $$shadowed($$PWD/../../../$${QBS_LIBRARY_DIRNAME}) + } + LIBS += -L$$QBSLIBDIR -lqbsscriptengine$$qtPlatformTargetSuffix() +} + +INCLUDEPATH += \ + $$shadowed($$PWD/include) diff --git a/src/shared/bundledqt/bundledqt.qbs b/src/shared/bundledqt/bundledqt.qbs index b1594dee7..434fc10fd 100644 --- a/src/shared/bundledqt/bundledqt.qbs +++ b/src/shared/bundledqt/bundledqt.qbs @@ -4,7 +4,8 @@ import qbs.FileInfo Product { Depends { name: "qbsbuildconfig" } Depends { name: "Qt"; submodules: - ["core", "gui", "network", "printsupport", "script", "widgets", "xml"] } + ["core", "gui", "network", "printsupport", "widgets", "xml"] } + Depends { name: "Qt.script"; required: false } property bool deployQt: qbsbuildconfig.enableBundledQt && qbs.targetOS.contains("macos") && Qt.core.qtConfig.contains("rpath") diff --git a/src/shared/qtscript b/src/shared/qtscript new file mode 160000 +Subproject 8399cdfbaf2aceab9c22fdcb10d2369ddb39b5d diff --git a/tests/auto/buildgraph/buildgraph.pro b/tests/auto/buildgraph/buildgraph.pro index 10f8c071b..9230bb748 100644 --- a/tests/auto/buildgraph/buildgraph.pro +++ b/tests/auto/buildgraph/buildgraph.pro @@ -5,3 +5,9 @@ HEADERS = tst_buildgraph.h include(../auto.pri) include(../../../src/app/shared/logging/logging.pri) +include(../../../src/lib/bundledlibs.pri) + +qbs_use_bundled_qtscript { + CONFIG += qbs_do_not_link_bundled_qtscript + include(../../../src/lib/scriptengine/use_scriptengine.pri) +} diff --git a/tests/auto/language/language.pro b/tests/auto/language/language.pro index 118d0f95c..86248d926 100644 --- a/tests/auto/language/language.pro +++ b/tests/auto/language/language.pro @@ -5,8 +5,9 @@ HEADERS = tst_language.h include(../auto.pri) include(../../../src/app/shared/logging/logging.pri) +include(../../../src/lib/bundledlibs.pri) -QT += script +!qbs_use_bundled_qtscript: QT += script DATA_DIRS = testdata @@ -17,3 +18,8 @@ for(data_dir, DATA_DIRS) { } OTHER_FILES += $$FILES + +qbs_use_bundled_qtscript { + CONFIG += qbs_do_not_link_bundled_qtscript + include(../../../src/lib/scriptengine/use_scriptengine.pri) +} diff --git a/tests/auto/language/language.qbs b/tests/auto/language/language.qbs index 9610b1fe1..f43ca0e44 100644 --- a/tests/auto/language/language.qbs +++ b/tests/auto/language/language.qbs @@ -3,7 +3,11 @@ import qbs.Utilities QbsAutotest { Depends { name: "qbsversion" } - Depends { name: "Qt.script" } + Depends { + name: "Qt.script" + condition: !qbsbuildconfig.useBundledQtScript + required: false + } testName: "language" condition: qbsbuildconfig.enableUnitTests |