Update 1k

This commit is contained in:
halx99 2024-07-27 00:22:28 +08:00
parent 0760541fea
commit b15ed68228
3 changed files with 27 additions and 2 deletions

View File

@ -585,7 +585,8 @@ function find_prog($name, $path = $null, $mode = 'ONLY', $cmd = $null, $params =
$preferredVer = $preferredVer.TrimEnd('+')
if ($minimalVer.EndsWith('+')) { $minimalVer = $minimalVer.TrimEnd('+') }
$checkVerCond = '$(version_ge $foundVer $minimalVer)'
} else {
}
else {
if ($isRange) {
$checkVerCond = '$(version_in_range $foundVer $minimalVer $preferredVer)'
}
@ -1220,7 +1221,9 @@ function setup_msvc() {
if (!$cl_prog) {
if ($VS_INST) {
Import-Module "$VS_PATH\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstanceId $VS_INST.instanceId -SkipAutomaticLocation -DevCmdArguments "-arch=$target_cpu -host_arch=x64 -no_logo"
$dev_cmd_args = "-arch=$target_cpu -host_arch=x64 -no_logo"
if (!$manifest['msvc'].EndsWith('+')) { $dev_cmd_args += " -vcvars_ver=$cl_ver" }
Enter-VsDevShell -VsInstanceId $VS_INST.instanceId -SkipAutomaticLocation -DevCmdArguments $dev_cmd_args
$cl_prog, $cl_ver = find_prog -name 'msvc' -cmd 'cl' -silent $true -usefv $true
$1k.println("Using msvc: $cl_prog, version: $cl_ver")

View File

@ -56,6 +56,9 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "tvOS")
set(IOS TRUE)
set(TVOS TRUE)
set(PLATFORM_NAME tvos)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "OHOS")
set(OHOS TRUE)
set(PLATFORM_NAME ohos)
else()
message(AUTHOR_WARNING "Unhandled platform: ${CMAKE_SYSTEM_NAME}")
endif()

19
1k/setup-msvc.ps1 Normal file
View File

@ -0,0 +1,19 @@
param(
$ver = '14.39'
)
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vs_installs = ConvertFrom-Json "$(&$vswhere -version '17.0' -format 'json')"
$vs_installs
$vs_installer = '${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe'
$vs_path = $vs_installs[0].installationPath
$msvc_comp_id = "Microsoft.VisualStudio.Component.VC.$ver.17.9.x86.x64" # refer to: https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022
echo "Installing $msvc_comp_id ..."
&$vs_installer modify --quiet --installPath $vs_path --add $msvc_comp_id | Out-Host
if($?) {
echo 'setup msvc success.'
} else {
echo 'setup msvc fail'
}
exit $LASTEXITCODE