move qdevice.pri creation to qmake-based configure system
Change-Id: I06540c3b6d98303bd9a218feedfb529993477ed6 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This commit is contained in:
parent
b6b44b368c
commit
8861b82f9e
157
configure
vendored
157
configure
vendored
@ -121,10 +121,6 @@ done
|
||||
set +f
|
||||
IFS=$SAVED_IFS
|
||||
|
||||
# initialize global variables
|
||||
DEVICE_VARS_FILE=.device.vars
|
||||
:> "$DEVICE_VARS_FILE"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# utility functions
|
||||
#-------------------------------------------------------------------------------
|
||||
@ -142,18 +138,7 @@ expandQMakeConf()
|
||||
echo "WARNING: Unable to find file $conf_file" >&2
|
||||
continue
|
||||
fi
|
||||
expandQMakeConf "$conf_file" "$2"
|
||||
;;
|
||||
*load\(device_config\)*)
|
||||
conf_file="$2"
|
||||
if [ -z "$conf_file" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ ! -f "$conf_file" ]; then
|
||||
echo "WARNING: Unable to find file $conf_file" >&2
|
||||
continue
|
||||
fi
|
||||
expandQMakeConf "$conf_file" "$2"
|
||||
expandQMakeConf "$conf_file"
|
||||
;;
|
||||
*)
|
||||
echo "$line"
|
||||
@ -298,32 +283,6 @@ getQMakeConf()
|
||||
getSingleQMakeVariable "$1" "$specvals"
|
||||
}
|
||||
|
||||
getXQMakeConf()
|
||||
{
|
||||
if [ -z "$xspecvals" ]; then
|
||||
xspecvals=`expandQMakeConf "$XQMAKESPEC/qmake.conf" "$DEVICE_VARS_FILE" | extractQMakeVariables`
|
||||
if [ "$XPLATFORM_MAC" = "yes" ]; then xspecvals=$(macSDKify "$xspecvals"); fi
|
||||
fi
|
||||
getSingleQMakeVariable "$1" "$xspecvals"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# device options
|
||||
#-------------------------------------------------------------------------------
|
||||
DeviceVar()
|
||||
{
|
||||
case "$1" in
|
||||
set)
|
||||
eq="="
|
||||
;;
|
||||
*)
|
||||
echo >&2 "BUG: wrong command to DeviceVar: $1"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "$2" "$eq" "$3" >> "$DEVICE_VARS_FILE"
|
||||
}
|
||||
|
||||
resolveDeviceMkspec()
|
||||
{
|
||||
result=$(find "$relpath/mkspecs/devices/" -type d -name "*$1*" | sed "s,^$relpath/mkspecs/,,")
|
||||
@ -420,17 +379,8 @@ OPT_SHADOW=maybe
|
||||
OPT_VERBOSE=no
|
||||
OPT_HELP=
|
||||
CFG_SILENT=no
|
||||
OPT_MAC_SDK=
|
||||
CFG_DEV=no
|
||||
|
||||
# Android vars
|
||||
CFG_DEFAULT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT
|
||||
CFG_DEFAULT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT
|
||||
CFG_DEFAULT_ANDROID_PLATFORM=android-16
|
||||
CFG_DEFAULT_ANDROID_TARGET_ARCH=armeabi-v7a
|
||||
CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION=4.9
|
||||
CFG_DEFAULT_ANDROID_NDK_HOST=$ANDROID_NDK_HOST
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# parse command line arguments
|
||||
#-------------------------------------------------------------------------------
|
||||
@ -550,14 +500,6 @@ while [ "$#" -gt 0 ]; do
|
||||
external-hostbindir)
|
||||
CFG_HOST_QT_TOOLS_PATH="$VAL"
|
||||
;;
|
||||
sdk)
|
||||
if [ "$BUILD_ON_MAC" = "yes" ]; then
|
||||
DeviceVar set QMAKE_MAC_SDK "$VAL"
|
||||
OPT_MAC_SDK="$VAL"
|
||||
else
|
||||
UNKNOWN_OPT=yes
|
||||
fi
|
||||
;;
|
||||
platform)
|
||||
PLATFORM="$VAL"
|
||||
;;
|
||||
@ -568,11 +510,6 @@ while [ "$#" -gt 0 ]; do
|
||||
XPLATFORM=`resolveDeviceMkspec $VAL`
|
||||
[ "$XPLATFORM" = "undefined" ] && exit 101
|
||||
;;
|
||||
device-option)
|
||||
DEV_VAR=`echo $VAL | cut -d '=' -f 1`
|
||||
DEV_VAL=`echo $VAL | cut -d '=' -f 2-`
|
||||
DeviceVar set $DEV_VAR "$DEV_VAL"
|
||||
;;
|
||||
optimized-qmake|optimized-tools)
|
||||
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
|
||||
CFG_RELEASE_TOOLS="$VAL"
|
||||
@ -601,24 +538,6 @@ while [ "$#" -gt 0 ]; do
|
||||
# need to keep this here, to ensure qmake is built silently
|
||||
CFG_SILENT="$VAL"
|
||||
;;
|
||||
android-sdk)
|
||||
CFG_DEFAULT_ANDROID_SDK_ROOT="$VAL"
|
||||
;;
|
||||
android-ndk)
|
||||
CFG_DEFAULT_ANDROID_NDK_ROOT="$VAL"
|
||||
;;
|
||||
android-ndk-platform)
|
||||
CFG_DEFAULT_ANDROID_PLATFORM="$VAL"
|
||||
;;
|
||||
android-ndk-host)
|
||||
CFG_DEFAULT_ANDROID_NDK_HOST="$VAL"
|
||||
;;
|
||||
android-arch)
|
||||
CFG_DEFAULT_ANDROID_TARGET_ARCH="$VAL"
|
||||
;;
|
||||
android-toolchain-version)
|
||||
CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION="$VAL"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
@ -834,60 +753,6 @@ esac
|
||||
# command line and environment validation
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
if [ "$XPLATFORM_ANDROID" != "no" ]; then
|
||||
if [ -z "$CFG_DEFAULT_ANDROID_NDK_HOST" ]; then
|
||||
case $PLATFORM in
|
||||
linux-*)
|
||||
if [ -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/linux-x86" ]; then
|
||||
CFG_DEFAULT_ANDROID_NDK_HOST=linux-x86
|
||||
elif [ -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/linux-x86_64" ]; then
|
||||
CFG_DEFAULT_ANDROID_NDK_HOST=linux-x86_64
|
||||
fi
|
||||
;;
|
||||
macx-*)
|
||||
CFG_DEFAULT_ANDROID_NDK_HOST=darwin-x86
|
||||
if [ -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/darwin-x86_64" ]; then
|
||||
CFG_DEFAULT_ANDROID_NDK_HOST=darwin-x86_64
|
||||
fi
|
||||
;;
|
||||
win32-*)
|
||||
CFG_DEFAULT_ANDROID_NDK_HOST=windows
|
||||
if [ -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/windows-x86_64" ]; then
|
||||
CFG_DEFAULT_ANDROID_NDK_HOST=windows-x86_64
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -z "$CFG_DEFAULT_ANDROID_NDK_ROOT" ]; then
|
||||
echo
|
||||
echo "Can not find Android NDK. Please use -android-ndk option to specify one"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$CFG_DEFAULT_ANDROID_SDK_ROOT" ]; then
|
||||
echo
|
||||
echo "Can not find Android SDK. Please use -android-sdk option to specify one"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION" ] || [ ! -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt" ]; then
|
||||
echo
|
||||
echo "Can not detect Android NDK toolchain. Please use -android-toolchain-version to specify"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$CFG_DEFAULT_ANDROID_NDK_HOST" ] || [ ! -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/$CFG_DEFAULT_ANDROID_NDK_HOST" ]; then
|
||||
echo
|
||||
echo "Can not detect the android host. Please use -android-ndk-host option to specify one"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DeviceVar set DEFAULT_ANDROID_SDK_ROOT "$CFG_DEFAULT_ANDROID_SDK_ROOT"
|
||||
DeviceVar set DEFAULT_ANDROID_NDK_ROOT "$CFG_DEFAULT_ANDROID_NDK_ROOT"
|
||||
DeviceVar set DEFAULT_ANDROID_PLATFORM "$CFG_DEFAULT_ANDROID_PLATFORM"
|
||||
DeviceVar set DEFAULT_ANDROID_NDK_HOST "$CFG_DEFAULT_ANDROID_NDK_HOST"
|
||||
DeviceVar set DEFAULT_ANDROID_TARGET_ARCH "$CFG_DEFAULT_ANDROID_TARGET_ARCH"
|
||||
DeviceVar set DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION "$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION"
|
||||
fi
|
||||
|
||||
if [ -d "$PLATFORM" ]; then
|
||||
QMAKESPEC="$PLATFORM"
|
||||
else
|
||||
@ -975,15 +840,6 @@ if [ "$OPT_SHADOW" = "yes" ]; then
|
||||
mkdir -p "$outpath/mkspecs"
|
||||
fi
|
||||
|
||||
if [ "$XPLATFORM_ANDROID" = "no" ]; then
|
||||
TEST_COMPILER=`getXQMakeConf QMAKE_CXX`
|
||||
GCC_MACHINE_DUMP=
|
||||
case "$TEST_COMPILER" in *g++) GCC_MACHINE_DUMP=$($TEST_COMPILER -dumpmachine);; esac
|
||||
if [ -n "$GCC_MACHINE_DUMP" ]; then
|
||||
DeviceVar set GCC_MACHINE_DUMP $($TEST_COMPILER -dumpmachine)
|
||||
fi
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# build qmake
|
||||
# -----------------------------------------------------------------------------
|
||||
@ -1137,17 +993,6 @@ fi
|
||||
[ -z "$CFG_HOST_QT_TOOLS_PATH" ] && CFG_HOST_QT_TOOLS_PATH="$outpath/bin"
|
||||
CFG_QMAKE_PATH="$CFG_HOST_QT_TOOLS_PATH/qmake"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# write out device config before we run the test.
|
||||
#-------------------------------------------------------------------------------
|
||||
DEVICE_VARS_OUTFILE="$outpath/mkspecs/qdevice.pri"
|
||||
if cmp -s "$DEVICE_VARS_FILE" "$DEVICE_VARS_OUTFILE"; then
|
||||
rm -f "$DEVICE_VARS_FILE"
|
||||
else
|
||||
mv -f $DEVICE_VARS_FILE "$DEVICE_VARS_OUTFILE"
|
||||
DEVICE_VARS_FILE="$DEVICE_VARS_OUTFILE"
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# run configure tests
|
||||
#-------------------------------------------------------------------------------
|
||||
|
@ -73,7 +73,7 @@
|
||||
"debug-and-release": { "type": "boolean", "name": "debug_and_release" },
|
||||
"developer-build": "void",
|
||||
"device": "string",
|
||||
"device-option": "string",
|
||||
"device-option": "addString",
|
||||
"force-asserts": { "type": "boolean", "name": "force_asserts" },
|
||||
"force-debug-info": { "type": "boolean", "name": "force_debug_info" },
|
||||
"force-pkg-config": { "type": "void", "name": "pkg-config" },
|
||||
@ -189,9 +189,9 @@
|
||||
|
||||
"testTypeDependencies": {
|
||||
"linkerSupportsFlag": [ "use_gold_linker" ],
|
||||
"verifySpec": [ "shared", "use_gold_linker", "compiler-flags", "gcc-sysroot", "qmakeargs" ],
|
||||
"verifySpec": [ "shared", "use_gold_linker", "compiler-flags", "gcc-sysroot", "qmakeargs", "commit" ],
|
||||
"compile": [ "verifyspec" ],
|
||||
"detectPkgConfig": [ "cross_compile" ],
|
||||
"detectPkgConfig": [ "cross_compile", "machineTuple" ],
|
||||
"library": [ "pkg-config" ],
|
||||
"getPkgConfigVariable": [ "pkg-config" ],
|
||||
"neon": [ "architecture" ]
|
||||
@ -202,6 +202,10 @@
|
||||
},
|
||||
|
||||
"tests": {
|
||||
"machineTuple": {
|
||||
"label": "machine tuple",
|
||||
"type": "machineTuple"
|
||||
},
|
||||
"verifyspec": {
|
||||
"label": "valid makespec",
|
||||
"type": "verifySpec",
|
||||
@ -419,7 +423,14 @@
|
||||
|
||||
"features": {
|
||||
"prepare": {
|
||||
"output": [ "preparePaths" ]
|
||||
"output": [ "prepareOptions", "preparePaths" ]
|
||||
},
|
||||
"machineTuple": {
|
||||
"condition": "!config.linux || config.android || tests.machineTuple",
|
||||
"output": [ "machineTuple" ]
|
||||
},
|
||||
"commit": {
|
||||
"output": [ "commitOptions" ]
|
||||
},
|
||||
"android-style-assets": {
|
||||
"label": "Android Style Assets",
|
||||
|
154
configure.pri
154
configure.pri
@ -233,6 +233,14 @@ defineReplace(qtConfFunc_licenseCheck) {
|
||||
|
||||
# custom tests
|
||||
|
||||
# this is meant for linux device specs only
|
||||
defineTest(qtConfTest_machineTuple) {
|
||||
qtRunLoggedCommand("$$QMAKE_CXX -dumpmachine", $${1}.tuple)|return(false)
|
||||
$${1}.cache += tuple
|
||||
export($${1}.cache)
|
||||
return(true)
|
||||
}
|
||||
|
||||
defineTest(qtConfTest_architecture) {
|
||||
!qtConfTest_compile($${1}): \
|
||||
error("Could not determine $$eval($${1}.label). See config.log for details.")
|
||||
@ -328,11 +336,9 @@ defineTest(qtConfTest_detectPkgConfig) {
|
||||
}
|
||||
|
||||
pkgConfigLibdir = $$sysroot/usr/lib/pkgconfig:$$sysroot/usr/share/pkgconfig
|
||||
gcc {
|
||||
qtRunLoggedCommand("$$QMAKE_CXX -dumpmachine", gccMachineDump): \
|
||||
!isEmpty(gccMachineDump): \
|
||||
pkgConfigLibdir = "$$pkgConfigLibdir:$$sysroot/usr/lib/$$gccMachineDump/pkgconfig"
|
||||
}
|
||||
machineTuple = $$eval($${currentConfig}.tests.machineTuple.tuple)
|
||||
!isEmpty(machineTuple): \
|
||||
pkgConfigLibdir = "$$pkgConfigLibdir:$$sysroot/usr/lib/$$machineTuple/pkgconfig"
|
||||
|
||||
qtConfAddNote("PKG_CONFIG_LIBDIR automatically set to $$pkgConfigLibdir")
|
||||
}
|
||||
@ -437,6 +443,144 @@ defineTest(qtConfTest_checkCompiler) {
|
||||
|
||||
# custom outputs
|
||||
|
||||
# this reloads the qmakespec as completely as reasonably possible.
|
||||
defineTest(reloadSpec) {
|
||||
bypassNesting() {
|
||||
for (f, QMAKE_INTERNAL_INCLUDED_FILES) {
|
||||
contains(f, .*/mkspecs/.*):\
|
||||
!contains(f, .*/(qt_build_config|qt_parts|qt_configure|configure_base)\\.prf): \
|
||||
discard_from($$f)
|
||||
}
|
||||
# nobody's going to try to re-load the features above,
|
||||
# so don't bother with being selective.
|
||||
QMAKE_INTERNAL_INCLUDED_FEATURES =
|
||||
|
||||
_SAVED_CONFIG = $$CONFIG
|
||||
load(spec_pre)
|
||||
load(device_config) # avoid that the spec loads it later.
|
||||
# discard possible settings from an earlier configure run.
|
||||
discard_from($$[QT_HOST_DATA/get]/mkspecs/qdevice.pri)
|
||||
# qdevice.pri gets written too late (and we can't write it early
|
||||
# enough, as it's populated in stages, with later ones depending
|
||||
# on earlier ones). so inject its variables manually.
|
||||
for (l, $${currentConfig}.output.devicePro): \
|
||||
eval($$l)
|
||||
include($$QMAKESPEC/qmake.conf)
|
||||
load(spec_post)
|
||||
load(default_pre)
|
||||
CONFIG += $$_SAVED_CONFIG
|
||||
|
||||
# ensure pristine environment for configuration. again.
|
||||
discard_from($$[QT_HOST_DATA/get]/mkspecs/qconfig.pri)
|
||||
discard_from($$[QT_HOST_DATA/get]/mkspecs/qmodule.pri)
|
||||
}
|
||||
}
|
||||
|
||||
defineTest(qtConfOutput_prepareOptions) {
|
||||
$${currentConfig}.output.devicePro += \
|
||||
$$replace(config.input.device-option, "^([^=]+) *= *(.*)$", "\\1 = \\2")
|
||||
darwin:!isEmpty(config.input.sdk) {
|
||||
$${currentConfig}.output.devicePro += \
|
||||
"QMAKE_MAC_SDK = $$val_escape(config.input.sdk)"
|
||||
}
|
||||
android {
|
||||
ndk_root = $$eval(config.input.android-ndk)
|
||||
isEmpty(ndk_root): \
|
||||
ndk_root = $$getenv(ANDROID_NDK_ROOT)
|
||||
isEmpty(ndk_root): \
|
||||
qtConfFatalError("Cannot find Android NDK." \
|
||||
"Please use -android-ndk option to specify one.")
|
||||
|
||||
ndk_tc_ver = $$eval(config.input.android-toolchain-version)
|
||||
isEmpty(ndk_tc_ver): \
|
||||
ndk_tc_ver = 4.9
|
||||
!exists($$ndk_root/toolchains/arm-linux-androideabi-$$ndk_tc_ver/prebuilt/*): \
|
||||
qtConfFatalError("Cannot detect Android NDK toolchain." \
|
||||
"Please use -android-toolchain-version to specify it.")
|
||||
|
||||
ndk_tc_pfx = $$ndk_root/toolchains/arm-linux-androideabi-$$ndk_tc_ver/prebuilt
|
||||
ndk_host = $$eval(config.input.android-ndk-host)
|
||||
isEmpty(ndk_host): \
|
||||
ndk_host = $$getenv(ANDROID_NDK_HOST)
|
||||
isEmpty(ndk_host) {
|
||||
equals(QMAKE_HOST.os, Linux) {
|
||||
ndk_host_64 = linux-x86_64
|
||||
ndk_host_32 = linux-x86
|
||||
} else: equals(QMAKE_HOST.os, Darwin) {
|
||||
ndk_host_64 = darwin-x86_64
|
||||
ndk_host_32 = darwin-x86
|
||||
} else: equals(QMAKE_HOST.os, Windows) {
|
||||
ndk_host_64 = windows-x86_64
|
||||
ndk_host_32 = windows
|
||||
} else {
|
||||
qtConfFatalError("Host operating system not supported by Android.")
|
||||
}
|
||||
!exists($$ndk_tc_pfx/$$ndk_host_64/*): ndk_host_64 =
|
||||
!exists($$ndk_tc_pfx/$$ndk_host_32/*): ndk_host_32 =
|
||||
equals(QMAKE_HOST.arch, x86_64):!isEmpty(ndk_host_64) {
|
||||
ndk_host = $$ndk_host_64
|
||||
} else: equals(QMAKE_HOST.arch, x86):!isEmpty(ndk_host_32) {
|
||||
ndk_host = $$ndk_host_32
|
||||
} else {
|
||||
!isEmpty(ndk_host_64): \
|
||||
ndk_host = $$ndk_host_64
|
||||
else: !isEmpty(ndk_host_32): \
|
||||
ndk_host = $$ndk_host_32
|
||||
else: \
|
||||
qtConfFatalError("Cannot detect the Android host." \
|
||||
"Please use -android-ndk-host option to specify one.")
|
||||
qtConfAddNotice("Available Android host does not match host architecture.")
|
||||
}
|
||||
} else {
|
||||
!exists($$ndk_tc_pfx/$$ndk_host/*): \
|
||||
qtConfFatalError("Specified Android NDK host is invalid.")
|
||||
}
|
||||
|
||||
sdk_root = $$eval(config.input.android-sdk)
|
||||
isEmpty(sdk_root): \
|
||||
sdk_root = $$getenv(ANDROID_SDK_ROOT)
|
||||
isEmpty(sdk_root): \
|
||||
qtConfFatalError("Cannot find Android SDK." \
|
||||
"Please use -android-sdk option to specify one.")
|
||||
|
||||
target_arch = $$eval(config.input.android-arch)
|
||||
isEmpty(target_arch): \
|
||||
target_arch = armeabi-v7a
|
||||
|
||||
platform = $$eval(config.input.android-ndk-platform)
|
||||
isEmpty(platform): \
|
||||
platform = android-16 ### the windows configure disagrees ...
|
||||
|
||||
$${currentConfig}.output.devicePro += \
|
||||
"DEFAULT_ANDROID_SDK_ROOT = $$val_escape(sdk_root)" \
|
||||
"DEFAULT_ANDROID_NDK_ROOT = $$val_escape(ndk_root)" \
|
||||
"DEFAULT_ANDROID_PLATFORM = $$platform" \
|
||||
"DEFAULT_ANDROID_NDK_HOST = $$ndk_host" \
|
||||
"DEFAULT_ANDROID_TARGET_ARCH = $$target_arch" \
|
||||
"DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION = $$ndk_tc_ver"
|
||||
}
|
||||
|
||||
export($${currentConfig}.output.devicePro)
|
||||
|
||||
# reload the spec to make the settings actually take effect.
|
||||
!isEmpty($${currentConfig}.output.devicePro): \
|
||||
reloadSpec()
|
||||
}
|
||||
|
||||
defineTest(qtConfOutput_machineTuple) {
|
||||
$${currentConfig}.output.devicePro += \
|
||||
"GCC_MACHINE_DUMP = $$eval($${currentConfig}.tests.machineTuple.tuple)"
|
||||
export($${currentConfig}.output.devicePro)
|
||||
|
||||
# for completeness, one could reload the spec here,
|
||||
# but no downstream users actually need that.
|
||||
}
|
||||
|
||||
defineTest(qtConfOutput_commitOptions) {
|
||||
# qdevice.pri needs to be written early, because the compile tests require it.
|
||||
write_file($$QT_BUILD_TREE/mkspecs/qdevice.pri, $${currentConfig}.output.devicePro)|error()
|
||||
}
|
||||
|
||||
# type (empty or 'host'), option name, default value
|
||||
defineTest(processQtPath) {
|
||||
out_var = config.rel_input.$${2}
|
||||
|
@ -1,5 +1,8 @@
|
||||
load(device_config)
|
||||
|
||||
# In early configure setup; nothing useful to be done here.
|
||||
isEmpty(DEFAULT_ANDROID_NDK_ROOT): return()
|
||||
|
||||
NDK_ROOT = $$(ANDROID_NDK_ROOT)
|
||||
!exists($$NDK_ROOT) {
|
||||
NDK_ROOT = $$DEFAULT_ANDROID_NDK_ROOT
|
||||
|
@ -1,3 +1,6 @@
|
||||
# In early configure setup; nothing useful to be done here.
|
||||
isEmpty(DEFAULT_ANDROID_NDK_ROOT): return()
|
||||
|
||||
# -fstack-protector-strong offers good protection against stack smashing attacks.
|
||||
# It is (currently) enabled only on Android because we know for sure that Andoroid compilers supports it
|
||||
QMAKE_CFLAGS += -fstack-protector-strong -DANDROID
|
||||
|
@ -162,7 +162,8 @@ defineTest(qtConfCommandline_addString) {
|
||||
val = $${2}
|
||||
isEmpty(val): val = $$qtConfGetNextCommandlineArg()
|
||||
|
||||
contains(val, "^-.*|[A-Z_]+=.*")|isEmpty(val) {
|
||||
# Note: Arguments which are variable assignments are legit here.
|
||||
contains(val, "^-.*")|isEmpty(val) {
|
||||
qtConfAddError("No value supplied to command line option '$$opt'.")
|
||||
return()
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
|
||||
# In early configure setup; nothing useful to be done here.
|
||||
isEmpty(QMAKE_CXX): return()
|
||||
|
||||
defineReplace(qtMakeExpand) {
|
||||
out = "$$1"
|
||||
for(ever) {
|
||||
|
@ -102,17 +102,6 @@ Configure::~Configure()
|
||||
{
|
||||
}
|
||||
|
||||
QString Configure::formatPath(const QString &path)
|
||||
{
|
||||
QString ret = QDir::cleanPath(path);
|
||||
// This amount of quoting is deemed sufficient.
|
||||
if (ret.contains(QLatin1Char(' '))) {
|
||||
ret.prepend(QLatin1Char('"'));
|
||||
ret.append(QLatin1Char('"'));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Configure::parseCmdLine()
|
||||
{
|
||||
sourcePathMangled = sourcePath;
|
||||
@ -166,14 +155,6 @@ void Configure::parseCmdLine()
|
||||
|| configCmdLine.at(i) == "-device") {
|
||||
++i;
|
||||
// do nothing
|
||||
} else if (configCmdLine.at(i) == "-device-option") {
|
||||
++i;
|
||||
const QString option = configCmdLine.at(i);
|
||||
QString &devOpt = dictionary["DEVICE_OPTION"];
|
||||
if (!devOpt.isEmpty())
|
||||
devOpt.append("\n").append(option);
|
||||
else
|
||||
devOpt = option;
|
||||
}
|
||||
|
||||
else if (configCmdLine.at(i) == "-no-syncqt")
|
||||
@ -186,47 +167,6 @@ void Configure::parseCmdLine()
|
||||
dictionary[ "MAKE" ] = configCmdLine.at(i);
|
||||
}
|
||||
|
||||
else if (configCmdLine.at(i) == "-android-ndk") {
|
||||
++i;
|
||||
if (i == argCount)
|
||||
break;
|
||||
dictionary[ "ANDROID_NDK_ROOT" ] = configCmdLine.at(i);
|
||||
}
|
||||
|
||||
else if (configCmdLine.at(i) == "-android-sdk") {
|
||||
++i;
|
||||
if (i == argCount)
|
||||
break;
|
||||
dictionary[ "ANDROID_SDK_ROOT" ] = configCmdLine.at(i);
|
||||
}
|
||||
|
||||
else if (configCmdLine.at(i) == "-android-ndk-platform") {
|
||||
++i;
|
||||
if (i == argCount)
|
||||
break;
|
||||
dictionary[ "ANDROID_PLATFORM" ] = configCmdLine.at(i);
|
||||
}
|
||||
|
||||
else if (configCmdLine.at(i) == "-android-ndk-host") {
|
||||
++i;
|
||||
if (i == argCount)
|
||||
break;
|
||||
dictionary[ "ANDROID_HOST" ] = configCmdLine.at(i);
|
||||
}
|
||||
|
||||
else if (configCmdLine.at(i) == "-android-arch") {
|
||||
++i;
|
||||
if (i == argCount)
|
||||
break;
|
||||
dictionary[ "ANDROID_TARGET_ARCH" ] = configCmdLine.at(i);
|
||||
}
|
||||
|
||||
else if (configCmdLine.at(i) == "-android-toolchain-version") {
|
||||
++i;
|
||||
if (i == argCount)
|
||||
break;
|
||||
dictionary[ "ANDROID_NDK_TOOLCHAIN_VERSION" ] = configCmdLine.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure that QMAKESPEC exists in the mkspecs folder
|
||||
@ -297,48 +237,6 @@ void Configure::parseCmdLine()
|
||||
}
|
||||
}
|
||||
|
||||
void Configure::generateQDevicePri()
|
||||
{
|
||||
FileWriter deviceStream(buildPath + "/mkspecs/qdevice.pri");
|
||||
if (dictionary.contains("DEVICE_OPTION")) {
|
||||
const QString devoptionlist = dictionary["DEVICE_OPTION"];
|
||||
const QStringList optionlist = devoptionlist.split(QStringLiteral("\n"));
|
||||
foreach (const QString &entry, optionlist)
|
||||
deviceStream << entry << "\n";
|
||||
}
|
||||
if (dictionary.contains("ANDROID_SDK_ROOT") && dictionary.contains("ANDROID_NDK_ROOT")) {
|
||||
deviceStream << "android_install {" << endl;
|
||||
deviceStream << " DEFAULT_ANDROID_SDK_ROOT = " << formatPath(dictionary["ANDROID_SDK_ROOT"]) << endl;
|
||||
deviceStream << " DEFAULT_ANDROID_NDK_ROOT = " << formatPath(dictionary["ANDROID_NDK_ROOT"]) << endl;
|
||||
if (dictionary.contains("ANDROID_HOST"))
|
||||
deviceStream << " DEFAULT_ANDROID_NDK_HOST = " << dictionary["ANDROID_HOST"] << endl;
|
||||
else if (QSysInfo::WordSize == 64)
|
||||
deviceStream << " DEFAULT_ANDROID_NDK_HOST = windows-x86_64" << endl;
|
||||
else
|
||||
deviceStream << " DEFAULT_ANDROID_NDK_HOST = windows" << endl;
|
||||
QString android_arch(dictionary.contains("ANDROID_TARGET_ARCH")
|
||||
? dictionary["ANDROID_TARGET_ARCH"]
|
||||
: QString("armeabi-v7a"));
|
||||
QString android_tc_vers(dictionary.contains("ANDROID_NDK_TOOLCHAIN_VERSION")
|
||||
? dictionary["ANDROID_NDK_TOOLCHAIN_VERSION"]
|
||||
: QString("4.9"));
|
||||
|
||||
bool targetIs64Bit = android_arch == QString("arm64-v8a")
|
||||
|| android_arch == QString("x86_64")
|
||||
|| android_arch == QString("mips64");
|
||||
QString android_platform(dictionary.contains("ANDROID_PLATFORM")
|
||||
? dictionary["ANDROID_PLATFORM"]
|
||||
: (targetIs64Bit ? QString("android-21") : QString("android-9")));
|
||||
|
||||
deviceStream << " DEFAULT_ANDROID_PLATFORM = " << android_platform << endl;
|
||||
deviceStream << " DEFAULT_ANDROID_TARGET_ARCH = " << android_arch << endl;
|
||||
deviceStream << " DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION = " << android_tc_vers << endl;
|
||||
deviceStream << "}" << endl;
|
||||
}
|
||||
if (!deviceStream.flush())
|
||||
dictionary[ "DONE" ] = "error";
|
||||
}
|
||||
|
||||
void Configure::generateHeaders()
|
||||
{
|
||||
if (dictionary["SYNCQT"] == "auto")
|
||||
@ -521,47 +419,4 @@ bool Configure::isOk()
|
||||
return (dictionary[ "DONE" ] != "error");
|
||||
}
|
||||
|
||||
FileWriter::FileWriter(const QString &name)
|
||||
: QTextStream()
|
||||
, m_name(name)
|
||||
{
|
||||
m_buffer.open(QIODevice::WriteOnly);
|
||||
setDevice(&m_buffer);
|
||||
}
|
||||
|
||||
bool FileWriter::flush()
|
||||
{
|
||||
QTextStream::flush();
|
||||
QFile oldFile(m_name);
|
||||
if (oldFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
if (oldFile.readAll() == m_buffer.data())
|
||||
return true;
|
||||
oldFile.close();
|
||||
}
|
||||
QString dir = QFileInfo(m_name).absolutePath();
|
||||
if (!QDir().mkpath(dir)) {
|
||||
cout << "Cannot create directory " << qPrintable(QDir::toNativeSeparators(dir)) << ".\n";
|
||||
return false;
|
||||
}
|
||||
QFile file(m_name + ".new");
|
||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
if (file.write(m_buffer.data()) == m_buffer.data().size()) {
|
||||
file.close();
|
||||
if (file.error() == QFile::NoError) {
|
||||
::SetFileAttributes((wchar_t*)m_name.utf16(), FILE_ATTRIBUTE_NORMAL);
|
||||
QFile::remove(m_name);
|
||||
if (!file.rename(m_name)) {
|
||||
cout << "Cannot replace file " << qPrintable(QDir::toNativeSeparators(m_name)) << ".\n";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
cout << "Cannot create file " << qPrintable(QDir::toNativeSeparators(file.fileName()))
|
||||
<< ": " << qPrintable(file.errorString()) << ".\n";
|
||||
file.remove();
|
||||
return false;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -50,7 +50,6 @@ public:
|
||||
void configure();
|
||||
|
||||
void generateHeaders();
|
||||
void generateQDevicePri();
|
||||
|
||||
bool isDone();
|
||||
bool isOk();
|
||||
@ -69,19 +68,7 @@ private:
|
||||
QString sourcePathMangled, buildPathMangled;
|
||||
QDir sourceDir, buildDir;
|
||||
|
||||
QString formatPath(const QString &path);
|
||||
|
||||
bool reloadCmdLine(int idx);
|
||||
};
|
||||
|
||||
class FileWriter : public QTextStream
|
||||
{
|
||||
public:
|
||||
FileWriter(const QString &name);
|
||||
bool flush();
|
||||
private:
|
||||
QString m_name;
|
||||
QBuffer m_buffer;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -55,11 +55,6 @@ int runConfigure( int argc, char** argv )
|
||||
if (!app.isOk())
|
||||
return 3;
|
||||
|
||||
// Generate qdevice.pri
|
||||
app.generateQDevicePri();
|
||||
if (!app.isOk())
|
||||
return 3;
|
||||
|
||||
// run qmake based configure
|
||||
app.configure();
|
||||
if (!app.isOk())
|
||||
|
Loading…
x
Reference in New Issue
Block a user