Commit 45a5c006 authored by Andras Becsi's avatar Andras Becsi Committed by The Qt Project
Browse files

Allow overriding target compiler and linker with qmake's one


Using make_global_settings, we can pass along the compiler and linker
that qmake uses, still allowing overriding it through environment variables.
We generate qmake_extras.gypi and populated with the host and target compilers
so that it also works when cross compiling.

Based on patch by Pierre Rossi <pierre.rossi@digia.com>

Change-Id: Ia3789abeea88f4d3cde75c2cf07cc9de66d7afbf
Reviewed-by: default avatarZeno Albisser <zeno.albisser@digia.com>
Showing with 40 additions and 1 deletion
...@@ -65,6 +65,9 @@ def additional_include_files(args=[]): ...@@ -65,6 +65,9 @@ def additional_include_files(args=[]):
# Used for additional build tweaks such as file exclusions # Used for additional build tweaks such as file exclusions
AddInclude(os.path.join(qtwebengine_src, 'build', 'qtwebengine_extras.gypi')) AddInclude(os.path.join(qtwebengine_src, 'build', 'qtwebengine_extras.gypi'))
# Common stuff we generate and extract from qmake
AddInclude(os.path.join(qtwebengine_src, 'build', 'qmake_extras.gypi'))
# Optionally add supplemental .gypi files if present. # Optionally add supplemental .gypi files if present.
supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi')) supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi'))
for supplement in supplements: for supplement in supplements:
......
# Prevent generating a makefile that attempts to create a lib
TEMPLATE = aux
# Pick up the host toolchain
option(host_build)
GYPI_CONTENTS = "{" \
" 'make_global_settings': [" \
" ['CC.host', '$$which($$QMAKE_CC)']," \
" ['CXX.host', '$$which($$QMAKE_CXX)']," \
" ['LD.host', '$$which($$QMAKE_LINK)'],"
GYPI_FILE = $$absolute_path('build/qmake_extras.gypi', $$QTWEBENGINE_ROOT)
write_file($$GYPI_FILE, GYPI_CONTENTS)
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS = host \
target
# Prevent generating a makefile that attempts to create a lib
TEMPLATE = aux
GYPI_CONTENTS += " ['CC', '$$which($$QMAKE_CC)']," \
" ['CXX', '$$which($$QMAKE_CXX)']," \
" ['LD', '$$which($$QMAKE_LINK)'],"
GYPI_CONTENTS += " ],"
GYPI_CONTENTS += "}"
GYPI_FILE = $$absolute_path('build/qmake_extras.gypi', $$QTWEBENGINE_ROOT)
!exists($$GYPI_FILE): error("-- $$GYPI not found --")
# Append to the file already containing the host settings.
write_file($$GYPI_FILE, GYPI_CONTENTS, append)
...@@ -4,7 +4,8 @@ CONFIG += ordered ...@@ -4,7 +4,8 @@ CONFIG += ordered
# The first three subdirs contain dummy .pro files that are used by qmake # The first three subdirs contain dummy .pro files that are used by qmake
# to generate a corresponding .gyp file # to generate a corresponding .gyp file
SUBDIRS = resources \ SUBDIRS = build/qmake_extras \ # Phony pro file that extracts things like compiler and linker from qmake
resources \
shared \ shared \
lib \ lib \
process \ process \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment