refactor windows BuildAtomUINative.ps1

This commit is contained in:
CHINBOY
2025-05-21 12:13:08 +08:00
parent 2b1b5bc4e5
commit 70097bbc19
3 changed files with 23 additions and 40 deletions
+4 -1
View File
@@ -19,6 +19,9 @@ target("AtomUINative", function()
if is_os("macosx") then
add_frameworks("Foundation", "AppKit")
add_files("macos/WindowUtils.mm")
add_files("macos/WindowUtils.mm")
elseif is_os("windows") then
set_prefixname("")
add_files("windows/WindowsUtils.cpp")
end
end)
+7 -27
View File
@@ -10,18 +10,11 @@ param (
[string]$libName
)
$cmakeGenerator = "Ninja"
if ($IsWindows) {
$cmakeGenerator = "Visual Studio 17 2022"
}
$buildMarker = Join-Path -Path $buildDir -ChildPath ".native_compiled"
$lockFile = Join-Path -Path $buildDir -ChildPath ".lock"
try {
# 创建锁文件(原子操作)
$lock = [System.IO.File]::Open($lockFile, [System.IO.FileMode]::CreateNew, [System.IO.FileAccess]::Write, [System.IO.FileShare]::None)
if (-not (Test-Path -Path $buildMarker -PathType Leaf)) {
# 如果文件不存在,则创建(自动创建父目录)
New-Item -Path $buildMarker -ItemType File -Force | Out-Null
@@ -42,31 +35,18 @@ try {
}
$env:XMAKE_COLORTERM = 'nocolor'
$buildType = $buildType.ToLower()
if ($IsWindows) {
$possiblePaths = @(
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe",
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe",
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe",
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe",
"C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe",
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
)
$msbuildExecutale = $possiblePaths | Where-Object { Test-Path $_ }
if (![string]::IsNullOrEmpty($msbuildExecutale)) {
$msbuildPath = Split-Path (Get-Item $msbuildExecutale).FullName -Parent
$env:PATH += ";$msbuildPath"
}
cmake -B $buildDir -S $sourceDir -DCMAKE_INSTALL_PREFIX="$installPrefix" -DCMAKE_BUILD_TYPE="$buildType" -G $cmakeGenerator
msbuild $buildDir/atomui.sln /p:Configuration=$buildType
cmake --install $buildDir --config $buildType
Copy-Item -Path $installPrefix/bin/$libName -Destination $deployDir
xmake config --project=$sourceDir --buildir=$buildDir -p msys -a x86_64 -m $buildType
xmake build
xmake install --installdir=$installPrefix
Copy-Item -Path $installPrefix/x86_64/lib/$libName -Destination $deployDir
} else {
xmake config --project=$sourceDir --buildir=$buildDir -p macosx -a arm64 -m release --toolchain=atomui --sdk=/opt/homebrew/opt/llvm@19
xmake config --project=$sourceDir --buildir=$buildDir -p macosx -a arm64 -m $buildType --toolchain=atomui --sdk=/opt/homebrew/opt/llvm@19
xmake build
xmake install --installdir=$installPrefix
xmake config --project=$sourceDir --buildir=$buildDir -p macosx -a x86_64 -m release --toolchain=atomui --sdk=/opt/homebrew/opt/llvm@19
xmake config --project=$sourceDir --buildir=$buildDir -p macosx -a x86_64 -m $buildType --toolchain=atomui --sdk=/opt/homebrew/opt/llvm@19
xmake build
xmake install --installdir=$installPrefix
Write-Output "generate universal binary"
@@ -68,6 +68,18 @@ namespace AtomUI.Theme.Styling
public static readonly TokenResourceKey TextFontWeight = new TokenResourceKey("Badge.TextFontWeight");
}
public static class ButtonSpinnerTokenKey
{
public static readonly TokenResourceKey ControlWidth = new TokenResourceKey("ButtonSpinner.ControlWidth");
public static readonly TokenResourceKey FilledHandleBg = new TokenResourceKey("ButtonSpinner.FilledHandleBg");
public static readonly TokenResourceKey HandleActiveBg = new TokenResourceKey("ButtonSpinner.HandleActiveBg");
public static readonly TokenResourceKey HandleBg = new TokenResourceKey("ButtonSpinner.HandleBg");
public static readonly TokenResourceKey HandleBorderColor = new TokenResourceKey("ButtonSpinner.HandleBorderColor");
public static readonly TokenResourceKey HandleHoverColor = new TokenResourceKey("ButtonSpinner.HandleHoverColor");
public static readonly TokenResourceKey HandleIconSize = new TokenResourceKey("ButtonSpinner.HandleIconSize");
public static readonly TokenResourceKey HandleWidth = new TokenResourceKey("ButtonSpinner.HandleWidth");
}
public static class ButtonTokenKey
{
public static readonly TokenResourceKey BorderColorDisabled = new TokenResourceKey("Button.BorderColorDisabled");
@@ -119,18 +131,6 @@ namespace AtomUI.Theme.Styling
public static readonly TokenResourceKey TextHoverBg = new TokenResourceKey("Button.TextHoverBg");
}
public static class ButtonSpinnerTokenKey
{
public static readonly TokenResourceKey ControlWidth = new TokenResourceKey("ButtonSpinner.ControlWidth");
public static readonly TokenResourceKey FilledHandleBg = new TokenResourceKey("ButtonSpinner.FilledHandleBg");
public static readonly TokenResourceKey HandleActiveBg = new TokenResourceKey("ButtonSpinner.HandleActiveBg");
public static readonly TokenResourceKey HandleBg = new TokenResourceKey("ButtonSpinner.HandleBg");
public static readonly TokenResourceKey HandleBorderColor = new TokenResourceKey("ButtonSpinner.HandleBorderColor");
public static readonly TokenResourceKey HandleHoverColor = new TokenResourceKey("ButtonSpinner.HandleHoverColor");
public static readonly TokenResourceKey HandleIconSize = new TokenResourceKey("ButtonSpinner.HandleIconSize");
public static readonly TokenResourceKey HandleWidth = new TokenResourceKey("ButtonSpinner.HandleWidth");
}
public static class CalendarTokenKey
{
public static readonly TokenResourceKey CellActiveWithRangeBg = new TokenResourceKey("Calendar.CellActiveWithRangeBg");