Skip to content
Snippets Groups Projects
Commit 06cbe4bb authored by Ming Rui Zhang's avatar Ming Rui Zhang
Browse files

misc: better parameterization for Qt version and toolset version

Change-Id: Ic8aad234c8806bd38a1b1633957503b09a01c137
parent 4a5f19f4
No related branches found
No related tags found
No related merge requests found
......@@ -19,13 +19,14 @@ If (test-path $stampFile) {
# default values
$qtver = If ($qtver) { $qtver } Else { "5.15.0" }
$qtMinorVer = $qtver.split('.')[1]
$mode = If ($mode) { $mode } Else { "Release" }
if (!$outDir) { $outDir = $clientDir + "\x64\" + $mode }
If (!(test-path $outDir)) { New-Item -ItemType directory -Path $outDir -Force }
$qtverSplit1, $qtverSplit2 , $qtverSplit3 = $qtver.Split('.')
$qtMsvcDir = "msvc2019_64"
$qtMsvcDir = If (([int]$qtMinorVer) -le 14) {"msvc2017_64"} Else {"msvc2019_64"}
$QtDir = "C:\Qt\$qtver\$qtMsvcDir"
......
......@@ -6,7 +6,7 @@ win32-msvc {
CONFIG += suppress_vcproj_warnings c++17 qtquickcompiler
QTQUICK_COMPILER_SKIPPED_RESOURCES += ./resources.qrc
QTQUICK_COMPILER_SKIPPED_RESOURCES += resources.qrc
# compiler options
QMAKE_CXXFLAGS += /wd"4068" /wd"4099" /wd"4189" /wd"4267" /wd"4577" /wd"4467" /wd"4715" /wd"4828"
......
......@@ -8,10 +8,12 @@ import argparse
import multiprocessing
import fileinput
import re
from enum import Enum
# vs help
win_sdk_default = '10.0.16299.0'
win_toolset_default = 'v142'
win_toolset_default = '142'
qt_version_default = '5.15.0'
vs_where_path = os.path.join(
os.environ['ProgramFiles(x86)'], 'Microsoft Visual Studio', 'Installer', 'vswhere.exe'
......@@ -19,6 +21,10 @@ vs_where_path = os.path.join(
host_is_64bit = (False, True)[platform.machine().endswith('64')]
class QtVerison(Enum):
Major = 0
Minor = 1
Micro = 2
def execute_cmd(cmd, with_shell=False, env_vars={}):
if(bool(env_vars)):
......@@ -62,6 +68,10 @@ def findVSLatestDir():
return
def getQtVersionNumber(qt_version, version_type):
version_list = qt_version.split('.')
return version_list[version_type.value]
def findMSBuild():
filename = 'MSBuild.exe'
for root, _, files in os.walk(findVSLatestDir() + r'\\MSBuild'):
......@@ -137,7 +147,8 @@ def build(arch, toolset, sdk_version, config_str, project_path_under_current_pat
configuration_type = 'StaticLibrary'
qtFolderDir = "msvc2019_64"
qt_minor_version = getQtVersionNumber(qtver, QtVerison.Minor)
qtFolderDir = 'msvc2017_64' if int(qt_minor_version) <= 14 else 'msvc2019_64'
vs_env_vars = {}
vs_env_vars.update(getVSEnv())
......@@ -224,11 +235,15 @@ def parse_args():
'-t', '--toolset', default=win_toolset_default, type=str,
help='Use specified platform toolset version')
ap.add_argument(
'-q', '--qtver', default='5.15.0',
'-q', '--qtver', default=qt_version_default,
help='Sets the version of Qmake')
parsed_args = ap.parse_args()
if parsed_args.toolset:
if parsed_args.toolset[0] != 'v':
parsed_args.toolset = 'v' + parsed_args.toolset
return parsed_args
......
......@@ -5,7 +5,8 @@ param (
$clientDir = split-path -parent $MyInvocation.MyCommand.Definition
$qtver = If ($qtver) { $qtver } Else { "5.15.0" }
$qtMsvcDir = "msvc2019_64"
$qtMinorVer = $qtver.split('.')[1]
$qtMsvcDir = If (([int]$qtMinorVer) -le 14) {"msvc2017_64"} Else {"msvc2019_64"}
$QtDir = "C:\Qt\$qtver\$qtMsvcDir"
$tsFileNames = Get-ChildItem -Path "$clientDir\translations" -Recurse -Include *.ts
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment