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 26, 2024
1 parent 9c2b980 commit 65cb6d4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
5 changes: 3 additions & 2 deletions 1k/1kiss.ps1
Original file line number Diff line number Diff line change
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 65cb6d4

Please sign in to comment.