Skip to content

Commit

Permalink
Test latest cmake(3.29.0) suppress duplicated link static libraries w…
Browse files Browse the repository at this point in the history
…arnings
  • Loading branch information
halx99 committed Jan 18, 2024
1 parent fc6fff7 commit 000d4d0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
14 changes: 8 additions & 6 deletions 1k/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ $exeSuffix = if ($HOST_OS -eq 0) { '.exe' } else { '' }
$Script:cmake_generator = $null

# import VersionEx
. (Join-Path $PSScriptRoot 'versionex.ps1')
. (Join-Path $PSScriptRoot 'extensions.ps1')

class build1k {
[void] println($msg) {
Expand Down Expand Up @@ -301,6 +301,8 @@ $Global:is_darwin_embed_family = $Global:is_ios -or $Global:is_tvos -or $Global:
$Global:is_darwin_family = $Global:is_mac -or $Global:is_darwin_embed_family
$Global:is_gh_act = "$env:GITHUB_ACTIONS" -eq 'true'

$Script:cmake_ver = ''

if (!$is_wasm) {
$TARGET_CPU = $options.a
if (!$TARGET_CPU) {
Expand Down Expand Up @@ -665,7 +667,7 @@ function setup_ninja() {
function setup_cmake($skipOS = $false) {
$cmake_prog, $cmake_ver = find_prog -name 'cmake'
if ($cmake_prog -and (!$skipOS -or $cmake_prog.IndexOf($myRoot) -ne -1)) {
return $cmake_prog
return $cmake_prog, $cmake_ver
}

$cmake_root = $(Join-Path $external_prefix 'cmake')
Expand Down Expand Up @@ -731,7 +733,7 @@ function setup_cmake($skipOS = $false) {
if (($null -ne $cmake_bin) -and ($env:PATH.IndexOf($cmake_bin) -eq -1)) {
$env:PATH = "$cmake_bin$ENV_PATH_SEP$env:PATH"
}
return $cmake_prog
return $cmake_prog, $cmake_ver
}

function ensure_cmake_ninja($cmake_prog, $ninja_prog) {
Expand Down Expand Up @@ -1254,7 +1256,7 @@ function preprocess_andorid([string[]]$inputOptions) {

$archs = $archlist -join ':' # TODO: modify gradle, split by ';'

$outputOptions += "-P__1K_CMAKE_VERSION=$($manifest['cmake'])"
$outputOptions += "-P__1K_CMAKE_VERSION=$($Script:cmake_ver.TrimLast('-'))"
$outputOptions += "-P__1K_ARCHS=$archs"
$outputOptions += '--parallel', '--info'
}
Expand Down Expand Up @@ -1374,7 +1376,7 @@ validHostAndToolchain

$null = setup_glslcc

$cmake_prog = setup_cmake
$cmake_prog,$Script:cmake_ver = setup_cmake

if ($Global:is_win_family) {
find_vs_latest
Expand All @@ -1394,7 +1396,7 @@ elseif ($Global:is_android) {
$ninja_prog = setup_ninja
# ensure ninja in cmake_bin
if (!(ensure_cmake_ninja $cmake_prog $ninja_prog)) {
$cmake_prog = setup_cmake -Force
$cmake_prog,$Script:cmake_ver = setup_cmake -Force
if (!(ensure_cmake_ninja $cmake_prog $ninja_prog)) {
$b1k.println("Ensure ninja in cmake bin directory fail")
}
Expand Down
15 changes: 15 additions & 0 deletions 1k/versionex.ps1 → 1k/extensions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,21 @@ namespace System
return v1.CompareTo(v2) >= 0;
}
}
public static class ExtensionMethods
{
public static string TrimLast(this Management.Automation.PSObject thiz, string separator)
{
var str = thiz.BaseObject as string;
var index = str.LastIndexOf(separator);
if (index != -1)
return str.Substring(0, index);
return str;
}
}
}
"@

$TrimLastMethod = [ExtensionMethods].GetMethod('TrimLast')
Update-TypeData -TypeName System.String -MemberName TrimLast -MemberType CodeMethod -Value $TrimLastMethod
}
4 changes: 4 additions & 0 deletions 1k/manifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
$manifest['nuget'] = '5.5.1' # since 5.6.0, require .net 4.0
$manifest['glslcc'] = '1.9.4+'

# Test latest cmake(3.29.0) suppress duplicated link static libraries warnings
$manifest['cmake'] = '3.28.20240117-gd860b4e'
$channels['cmake'] = { param($FileName) return "https://cmake.org/files/dev/$FileName" }

# android sdk tools
$android_sdk_tools['build-tools'] = '34.0.0' # match with AGP, current 8.2.1 android studio 2023.1.1
$android_sdk_tools['platforms'] = 'android-34'
2 changes: 1 addition & 1 deletion setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ $AX_ROOT = $myRoot
Set-Alias println Write-Host

# import VersionEx
. (Join-Path $PSScriptRoot '1k/versionex.ps1')
. (Join-Path $PSScriptRoot '1k/extensions.ps1')

$pwsh_ver = [VersionEx]$PSVersionTable.PSVersion.ToString()

Expand Down
2 changes: 1 addition & 1 deletion tools/ci/make-pkg.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function Compress-ArchiveEx() {
}

# import VersionEx
. (Join-Path $AX_ROOT '1k/versionex.ps1')
. (Join-Path $AX_ROOT '1k/extensions.ps1')

if (([VersionEx]$PSVersionTable.PSVersion.ToString() -ge [VersionEx]'7.0') -and $IsWindows) {

Expand Down

0 comments on commit 000d4d0

Please sign in to comment.