Skip to content

Commit

Permalink
add some pwsh scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
fanlumaster committed Feb 18, 2024
1 parent d8f8ca7 commit 5cb9c17
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
build/
Release/
build64/
build32/
62 changes: 48 additions & 14 deletions lcompile.ps1
Original file line number Diff line number Diff line change
@@ -1,28 +1,62 @@
# generate and compile exe files

# 默认是编译 64 位的 dll,如果指定 32 位,则编译 32 位 dll
$currentDirectory = Get-Location
$cmakeListsPath = Join-Path -Path $currentDirectory -ChildPath "CMakeLists.txt"

if (-not (Test-Path $cmakeListsPath))
{
Write-Host("No CMakeLists.txt in current directory, please check.")
return
Write-Host("No CMakeLists.txt in current directory, please check.")
return
}

Write-Host "Start generating and compiling..."

$buildFolderPath = ".\build"

if (-not (Test-Path $buildFolderPath))
{
New-Item -ItemType Directory -Path $buildFolderPath | Out-Null
Write-Host "build folder created."
}

cmake -G "Visual Studio 17 2022" -A Win32 -S . -B ./build/
$arch = $args[0]

if ($LASTEXITCODE -eq 0)
if ($arch -eq "32")
{
$buildFolderPath = ".\build32"

if (-not (Test-Path $buildFolderPath))
{
New-Item -ItemType Directory -Path $buildFolderPath | Out-Null
Write-Host "build32 folder created."
}
cmake -G "Visual Studio 17 2022" -A Win32 -S . -B ./build32/

if ($LASTEXITCODE -eq 0)
{
cmake --build ./build32/ --config DEBUG
}
} elseif ($arch -eq "64")
{
cmake --build ./build/ --config DEBUG
$buildFolderPath = ".\build64"

if (-not (Test-Path $buildFolderPath))
{
New-Item -ItemType Directory -Path $buildFolderPath | Out-Null
Write-Host "build64 folder created."
}
cmake -G "Visual Studio 17 2022" -A x64 -S . -B ./build64/

if ($LASTEXITCODE -eq 0)
{
cmake --build ./build64/ --config DEBUG
}
} else
{ # 默认是 64 位
$buildFolderPath = ".\build64"

if (-not (Test-Path $buildFolderPath))
{
New-Item -ItemType Directory -Path $buildFolderPath | Out-Null
Write-Host "build64 folder created."
}
cmake -G "Visual Studio 17 2022" -A x64 -S . -B ./build64/

if ($LASTEXITCODE -eq 0)
{
cmake --build ./build64/ --config DEBUG
}
}

2 changes: 2 additions & 0 deletions linstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 在调试的时候,只需要注册 64 位
sudo regsvr32 "./build64/DEBUG/SampleIME.dll"
1 change: 1 addition & 0 deletions luninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sudo regsvr32 /u "./build64/DEBUG/SampleIME.dll"

0 comments on commit 5cb9c17

Please sign in to comment.