From 4874b4c0cff423aae073d8bf15d726cbb92061e4 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte <jocelyn.turcotte@digia.com> Date: Wed, 20 Nov 2013 15:15:32 +0100 Subject: [PATCH] Make QtWebEngineProcess a slim executable. Move all the process code in the core library and let the later simply call its QtWebEngine::processMain exported function from its main. This also allows us building QtWebEngineProcess directly with qmake without going through gyp. Change-Id: I8df36510d0bf14e313918bef807e2118f1ecadd5 Reviewed-by: Andras Becsi <andras.becsi@digia.com> --- lib/lib.pro | 2 ++ lib/process_main.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++ lib/process_main.h | 48 ++++++++++++++++++++++++++++++++++++++++ process/main.cpp | 4 ++-- process/process.pro | 16 ++++++++------ qtwebengine.gyp | 1 - qtwebengine.pro | 4 ++-- 7 files changed, 115 insertions(+), 12 deletions(-) create mode 100644 lib/process_main.cpp create mode 100644 lib/process_main.h diff --git a/lib/lib.pro b/lib/lib.pro index 682388217..9e51b3c58 100644 --- a/lib/lib.pro +++ b/lib/lib.pro @@ -47,6 +47,7 @@ SOURCES = \ download_manager_delegate_qt.cpp \ chromium_gpu_helper.cpp \ javascript_dialog_manager_qt.cpp \ + process_main.cpp \ render_widget_host_view_qt.cpp \ resource_context_qt.cpp \ url_request_context_getter_qt.cpp \ @@ -67,6 +68,7 @@ HEADERS = \ download_manager_delegate_qt.h \ chromium_gpu_helper.h \ javascript_dialog_manager_qt.h \ + process_main.h \ render_widget_host_view_qt.h \ render_widget_host_view_qt_delegate.h \ resource_context_qt.h \ diff --git a/lib/process_main.cpp b/lib/process_main.cpp new file mode 100644 index 000000000..af44ba600 --- /dev/null +++ b/lib/process_main.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "process_main.h" +#include "content/public/app/content_main.h" + +namespace QtWebEngine { + +int processMain(int argc, const char **argv) +{ + return content::ContentMain(argc, argv, 0); +} + +} diff --git a/lib/process_main.h b/lib/process_main.h new file mode 100644 index 000000000..2bd37a336 --- /dev/null +++ b/lib/process_main.h @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtwebenginecoreglobal.h" + +namespace QtWebEngine { + +QWEBENGINE_EXPORT int processMain(int argc, const char **argv); + +} diff --git a/process/main.cpp b/process/main.cpp index 839b626c3..800dbdcfa 100644 --- a/process/main.cpp +++ b/process/main.cpp @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#include "content/public/app/content_main.h" +#include "process_main.h" int main(int argc, const char **argv) { - return content::ContentMain(argc, argv, 0); + return QtWebEngine::processMain(argc, argv); } diff --git a/process/process.pro b/process/process.pro index 11a7880f2..8edf22bf2 100644 --- a/process/process.pro +++ b/process/process.pro @@ -1,11 +1,13 @@ -# This is a dummy .pro file used to extract some aspects of the used configuration and feed them to gyp -# We want the gyp generation step to happen after all the other config steps. For that we need to prepend -# our gyp_generator.prf feature to the CONFIG variable since it is processed backwards -CONFIG = gyp_generator $$CONFIG -GYPDEPENDENCIES += ../shared/shared.gyp:qtwebengine_shared -GYPINCLUDES += ../qtwebengine.gypi - TARGET = $$QTWEBENGINEPROCESS_NAME TEMPLATE = app +macx:LIBPATH = $$getOutDir()/$$getConfigDir() +else:LIBPATH = $$getOutDir()/$$getConfigDir()/lib +LIBS_PRIVATE += -lQt5WebEngineCore -L$$LIBPATH +QMAKE_RPATHDIR += $$LIBPATH + +DESTDIR = $$getOutDir()/$$getConfigDir() + +INCLUDEPATH += ../lib + SOURCES = main.cpp diff --git a/qtwebengine.gyp b/qtwebengine.gyp index a511da461..f7cabf26a 100644 --- a/qtwebengine.gyp +++ b/qtwebengine.gyp @@ -5,7 +5,6 @@ 'type': 'none', 'dependencies': [ 'shared/shared.gyp:*', - 'process/process.gyp:*', 'lib/lib.gyp:*', ], } diff --git a/qtwebengine.pro b/qtwebengine.pro index 71396207a..8604551a0 100644 --- a/qtwebengine.pro +++ b/qtwebengine.pro @@ -9,7 +9,6 @@ qmake_extras.subdir = build/qmake_extras # Phony pro files that generate gyp files. Will be built by ninja. shared.depends = qmake_extras lib.depends = qmake_extras -process.depends = qmake_extras # API libraries webengine_lib.subdir = lib/quick @@ -25,11 +24,12 @@ widgets_lib.subdir = lib/widgets widgets_lib.target = sub-widgets-lib widgets_lib.depends = build +process.depends = build sub_examples.depends = quick_plugin_lib quick_experimental_plugin_lib sub_tests.depends = quick_plugin_lib quick_experimental_plugin_lib # This is where we use the generated gypi files and run gyp_qtwebengine -build.depends = resources shared lib process +build.depends = resources shared lib SUBDIRS += qmake_extras \ resources \ -- GitLab