Skip to content

Commit

Permalink
build: migrate WeaselSetup to Weasel.Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiredPlanck committed Jan 27, 2025
1 parent 50ab385 commit d56e5c0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ReleaseHant/
/output/*.ime
/output/*.txt
/output/*.bat
/output/*.config
/output/data/essay.txt
/output/data/opencc/
/output/data/*.yaml
Expand Down
2 changes: 1 addition & 1 deletion clang-format.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

WEASEL_SOURCE_PATH="RimeWithWeasel WeaselDeployer WeaselIME WeaselIPC WeaselIPCServer WeaselServer WeaselSetup WeaselTSF WeaselUI include test"
WEASEL_SOURCE_PATH="RimeWithWeasel WeaselDeployer WeaselIME WeaselIPC WeaselIPCServer WeaselServer WeaselTSF WeaselUI include test"

# clang format options
method="-i"
Expand Down
9 changes: 5 additions & 4 deletions output/install.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ program_files:
${Endif}
${Endif}

File "WeaselSetup.exe"
File "Weasel.Setup.exe"
File "TSF.TypeLib.dll"
; shared data files
SetOutPath $INSTDIR\data
File "data\*.yaml"
Expand All @@ -287,7 +288,7 @@ program_files:
IfErrors +2 0
StrCpy $R2 "/t"

ExecWait '"$INSTDIR\WeaselSetup.exe" $R2'
ExecWait '"$INSTDIR\Weasel.Setup.exe" $R2'

; Write the uninstall keys for Windows
WriteRegStr HKLM "${REG_UNINST_KEY}" "DisplayName" "$(DISPLAYNAME)"
Expand Down Expand Up @@ -350,7 +351,7 @@ Section "Start Menu Shortcuts"
CreateShortCut "$SMPROGRAMS\$(DISPLAYNAME)\$(LNKFORUSERFOLDER).lnk" "$INSTDIR\WeaselServer.exe" "/userdir" "$SYSDIR\shell32.dll" 126
CreateShortCut "$SMPROGRAMS\$(DISPLAYNAME)\$(LNKFORAPPFOLDER).lnk" "$INSTDIR\WeaselServer.exe" "/weaseldir" "$SYSDIR\shell32.dll" 19
CreateShortCut "$SMPROGRAMS\$(DISPLAYNAME)\$(LNKFORUPDATER).lnk" "$INSTDIR\WeaselServer.exe" "/update" "$SYSDIR\shell32.dll" 13
CreateShortCut "$SMPROGRAMS\$(DISPLAYNAME)\$(LNKFORSETUP).lnk" "$INSTDIR\WeaselSetup.exe" "" "$SYSDIR\shell32.dll" 162
CreateShortCut "$SMPROGRAMS\$(DISPLAYNAME)\$(LNKFORSETUP).lnk" "$INSTDIR\Weasel.Setup.exe" "" "$SYSDIR\shell32.dll" 162
CreateShortCut "$SMPROGRAMS\$(DISPLAYNAME)\$(LNKFORUNINSTALL).lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0

SectionEnd
Expand All @@ -363,7 +364,7 @@ Section "Uninstall"

ExecWait '"$INSTDIR\WeaselServer.exe" /quit'

ExecWait '"$INSTDIR\WeaselSetup.exe" /u'
ExecWait '"$INSTDIR\Weasel.Setup.exe" /u'

; Remove registry keys
DeleteRegKey HKLM SOFTWARE\Rime
Expand Down
21 changes: 18 additions & 3 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,24 @@ if is_arch("x64") or is_arch("x86") then
includes("RimeWithWeasel", "WeaselIPCServer", "WeaselServer", "WeaselDeployer")
end

if is_arch("x86") then
includes("WeaselSetup")
end
target("Weasel.Setup")
on_build(function(target)
import("package.tools.msbuild")

local sln = "weasel.sln"
local target_name = string.gsub(target:name(), "%.", "_")
local build_type = is_mode("debug") and "Debug" or "Release"
local platform = "Any CPU"
local configs = {
sln,
"/t:" .. target_name,
"-restore",
"/p:Configuration=" .. build_type,
"/p:Platform=" .. platform
}

msbuild.build(target, configs)
end)

if is_mode("debug") then
includes("test/TestWeaselIPC")
Expand Down

0 comments on commit d56e5c0

Please sign in to comment.