summaryrefslogtreecommitdiffstats
path: root/build/qmake_extras
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2013-09-28 03:24:07 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-01 13:11:57 +0200
commit45a5c006d12c38d17f5605c2f975a7eabda7456f (patch)
treea038368ae7292d7a7f9d459ea37caa1e1520502a /build/qmake_extras
parent8608404f7991b910381e7b402f80b502177f4d6a (diff)
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: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'build/qmake_extras')
-rw-r--r--build/qmake_extras/host/host.pro14
-rw-r--r--build/qmake_extras/qmake_extras.pro6
-rw-r--r--build/qmake_extras/target/target.pro15
3 files changed, 35 insertions, 0 deletions
diff --git a/build/qmake_extras/host/host.pro b/build/qmake_extras/host/host.pro
new file mode 100644
index 000000000..95d7b3cad
--- /dev/null
+++ b/build/qmake_extras/host/host.pro
@@ -0,0 +1,14 @@
+# 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)
diff --git a/build/qmake_extras/qmake_extras.pro b/build/qmake_extras/qmake_extras.pro
new file mode 100644
index 000000000..409993128
--- /dev/null
+++ b/build/qmake_extras/qmake_extras.pro
@@ -0,0 +1,6 @@
+TEMPLATE = subdirs
+
+CONFIG += ordered
+
+SUBDIRS = host \
+ target
diff --git a/build/qmake_extras/target/target.pro b/build/qmake_extras/target/target.pro
new file mode 100644
index 000000000..294ebc609
--- /dev/null
+++ b/build/qmake_extras/target/target.pro
@@ -0,0 +1,15 @@
+# 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)