Skip to content

Commit b15ed68

Browse files
committed
Update 1k
1 parent 0760541 commit b15ed68

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

1k/1kiss.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,8 @@ function find_prog($name, $path = $null, $mode = 'ONLY', $cmd = $null, $params =
585585
$preferredVer = $preferredVer.TrimEnd('+')
586586
if ($minimalVer.EndsWith('+')) { $minimalVer = $minimalVer.TrimEnd('+') }
587587
$checkVerCond = '$(version_ge $foundVer $minimalVer)'
588-
} else {
588+
}
589+
else {
589590
if ($isRange) {
590591
$checkVerCond = '$(version_in_range $foundVer $minimalVer $preferredVer)'
591592
}
@@ -1220,7 +1221,9 @@ function setup_msvc() {
12201221
if (!$cl_prog) {
12211222
if ($VS_INST) {
12221223
Import-Module "$VS_PATH\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
1223-
Enter-VsDevShell -VsInstanceId $VS_INST.instanceId -SkipAutomaticLocation -DevCmdArguments "-arch=$target_cpu -host_arch=x64 -no_logo"
1224+
$dev_cmd_args = "-arch=$target_cpu -host_arch=x64 -no_logo"
1225+
if (!$manifest['msvc'].EndsWith('+')) { $dev_cmd_args += " -vcvars_ver=$cl_ver" }
1226+
Enter-VsDevShell -VsInstanceId $VS_INST.instanceId -SkipAutomaticLocation -DevCmdArguments $dev_cmd_args
12241227

12251228
$cl_prog, $cl_ver = find_prog -name 'msvc' -cmd 'cl' -silent $true -usefv $true
12261229
$1k.println("Using msvc: $cl_prog, version: $cl_ver")

1k/platforms.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "tvOS")
5656
set(IOS TRUE)
5757
set(TVOS TRUE)
5858
set(PLATFORM_NAME tvos)
59+
elseif(${CMAKE_SYSTEM_NAME} MATCHES "OHOS")
60+
set(OHOS TRUE)
61+
set(PLATFORM_NAME ohos)
5962
else()
6063
message(AUTHOR_WARNING "Unhandled platform: ${CMAKE_SYSTEM_NAME}")
6164
endif()

1k/setup-msvc.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
param(
2+
$ver = '14.39'
3+
)
4+
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
5+
$vs_installs = ConvertFrom-Json "$(&$vswhere -version '17.0' -format 'json')"
6+
$vs_installs
7+
$vs_installer = '${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe'
8+
$vs_path = $vs_installs[0].installationPath
9+
$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
10+
echo "Installing $msvc_comp_id ..."
11+
&$vs_installer modify --quiet --installPath $vs_path --add $msvc_comp_id | Out-Host
12+
13+
if($?) {
14+
echo 'setup msvc success.'
15+
} else {
16+
echo 'setup msvc fail'
17+
}
18+
19+
exit $LASTEXITCODE

0 commit comments

Comments
 (0)