Skip to content

Commit

Permalink
Update llvm install [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
halx99 committed Dec 20, 2024
1 parent 9c2b980 commit 58958f9
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ env:
jobs:
linux:
# The type of runner that the job will run on
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

env:
BUILD_ARCH: x64
Expand Down
11 changes: 6 additions & 5 deletions 1k/1kiss.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ $manifest = @{
# _EMIT_STL_ERROR(STL1000, "Unexpected compiler version, expected Clang xx.x.x or newer.");
# clang-cl msvc14.37 require 16.0.0+
# clang-cl msvc14.40 require 17.0.0+
llvm = '17.0.6+';
llvm = '17.0.6+';
gcc = '9.0.0+';
cmake = '3.23.0~3.31.1+';
ninja = '1.10.0+';
Expand Down Expand Up @@ -655,7 +655,7 @@ function find_prog($name, $path = $null, $mode = 'ONLY', $cmd = $null, $params =
if (!$usefv) {
$verStr = $(. $cmd @params 2>$null) | Select-Object -First 1
if ($LASTEXITCODE) {
Write-Warning '1kiss: Get version of $cmd fail'
Write-Warning "1kiss: Get version of $cmd fail"
$LASTEXITCODE = 0
}
if (!$verStr -or $verStr.Contains('--version')) {
Expand Down Expand Up @@ -818,7 +818,7 @@ function find_vs() {

# refer: https://learn.microsoft.com/en-us/visualstudio/install/workload-and-component-ids?view=vs-2022
$require_comps = @('Microsoft.VisualStudio.Component.VC.Tools.x86.x64', 'Microsoft.VisualStudio.Product.BuildTools')
$vs_installs = ConvertFrom-Json "$(&$VSWHERE_EXE -version $required_vs_ver.TrimEnd('+') -format 'json' -requires $require_comps -requiresAny)"
$vs_installs = ConvertFrom-Json "$(&$VSWHERE_EXE -version $required_vs_ver.TrimEnd('+') -format 'json' -requires $require_comps -requiresAny -prerelease)"
$ErrorActionPreference = $eap

if ($vs_installs) {
Expand Down Expand Up @@ -2026,12 +2026,12 @@ if (!$setupOnly) {
if (($cmake_generator -eq 'Xcode') -and !$BUILD_ALL_OPTIONS.Contains('--verbose')) {
$forward_options += '--', '-quiet'
}
$1k.println("cmake --build $BUILD_DIR $BUILD_ALL_OPTIONS")

if ($options.t) { $cmake_target = $options.t }
if ($cmake_target) {
$cmake_targets = $cmake_target.Split(',') | Sort-Object | Get-Unique
$cmake_targets = $cmake_target.Split(',')
foreach ($target in $cmake_targets) {
$1k.println("cmake --build $BUILD_DIR $BUILD_ALL_OPTIONS --target $target")
cmake --build $BUILD_DIR $BUILD_ALL_OPTIONS --target $target $forward_options | Out-Host
if (!$?) {
Set-Location $stored_cwd
Expand All @@ -2040,6 +2040,7 @@ if (!$setupOnly) {
}
}
else {
$1k.println("cmake --build $BUILD_DIR $BUILD_ALL_OPTIONS")
cmake --build $BUILD_DIR $BUILD_ALL_OPTIONS $forward_options | Out-Host
if (!$?) {
Set-Location $stored_cwd
Expand Down
20 changes: 17 additions & 3 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ if ($is_darwin_family) {
$compiler_dumped = $false

Foreach ($lib_name in $libs) {
$lib_info = $lib_name.Split(':')
$lib_name = $lib_info[0]
$cb_target = $lib_info[1]
$build_conf_path = Join-Path $_1k_root "src/$lib_name/build.yml"
$build_conf = ConvertFrom-Yaml -Yaml (Get-Content $build_conf_path -raw)
if ($build_conf.targets -and !$build_conf.targets.contains($target_os)) {
Expand Down Expand Up @@ -226,6 +229,10 @@ Foreach ($lib_name in $libs) {
}
}

if ($build_conf.repo.EndsWith('.git') -and $rebuild) {
git -C $lib_src clean -dfx -e _1kiss
}

$install_script = Join-Path $_1k_root "src/$lib_name/install1.ps1"
$has_custom_install = (Test-Path $install_script)

Expand All @@ -234,6 +241,10 @@ Foreach ($lib_name in $libs) {
$install_dir = Join-Path $install_root $lib_name
mkdirs $install_dir
Set-Variable -Name "${lib_name}_install_dir" -Value $install_dir -Scope Global

if(!$cb_target) {
$cb_target = $build_conf.cb_target
}
if ($build_conf.cb_tool -ne 'custom') {
$_config_options = $build_conf.options
if ($build_conf.cb_tool -eq 'cmake') {
Expand All @@ -247,8 +258,8 @@ Foreach ($lib_name in $libs) {

$_config_options += "-DCMAKE_INSTALL_PREFIX=$install_dir"
$evaluated_args = @()
if ($build_conf.cb_target) {
$evaluated_args += '-t', $build_conf.cb_target
if ($cb_target) {
$evaluated_args += '-t', $cb_target
}
if (!$has_custom_install) {
$evaluated_args += '-i'
Expand All @@ -261,7 +272,7 @@ Foreach ($lib_name in $libs) {
&$1k_script -p $target_os -a $target_cpu -xc $_config_options @forward_args @evaluated_args @args
}
elseif ($is_gn) {
&$1k_script -p $target_os -a $target_cpu -xc $_config_options -xt 'gn' -t "$($build_conf.cb_target)" @forward_args @args
&$1k_script -p $target_os -a $target_cpu -xc $_config_options -xt 'gn' -t "$($cb_target)" @forward_args @args
}
else {
throw "Unsupported cross build tool: $($build_conf.cb_tool)"
Expand All @@ -272,6 +283,9 @@ Foreach ($lib_name in $libs) {
. $custom_build_script $target_os $target_cpu $install_dir @forward_args
}
Pop-Location
if ($LASTEXITCODE) {
throw "Build $lib_name failed"
}

# custom install step
if ($has_custom_install) {
Expand Down
1 change: 0 additions & 1 deletion src/llvm/clean1.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ if ((Test-Path $install_dir -PathType Container)) {
sremove (Join-Path $install_dir 'include')
sremove (Join-Path $install_dir 'lib/*.lib')
sremove (Join-Path $install_dir 'lib/*.a')
sremove (Join-Path $install_dir 'bin/*.exe')
ls -R "$install_dir"
}
12 changes: 10 additions & 2 deletions src/llvm/install1.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
$install_dir = $args[0]
# $libsrc_dir = $args[1]

$artifact_path = @('Release\bin\libclang.dll', 'lib\libclang.so', 'Release\lib\libclang.dylib')[$HOST_OS]
$artifact_files = @(@('Release\bin\libclang.dll', 'Release\bin\clang-format.exe'), 'lib\libclang.so', 'Release\lib\libclang.dylib')[$HOST_OS]
$install_dest = (Join-Path $install_dir (@('lib', 'bin')[$IsWin]))
mkdirs $install_dest
Copy-Item (Join-Path $BUILD_DIR "$artifact_path") $install_dest

foreach($path in $artifact_files) {
$full_path = (Join-Path $BUILD_DIR "$path")
if (Test-Path $full_path -PathType Leaf) {
Copy-Item $full_path $install_dest
} else {
Write-Warning "The file $full_path not exist"
}
}

0 comments on commit 58958f9

Please sign in to comment.