Skip to content

Commit d456aff

Browse files
authored
Merge pull request #865 from zonble/master
Support Windows for ARM64 and upgrade McBopomofo
2 parents 8b2aca3 + 2267563 commit d456aff

File tree

6 files changed

+2204
-851
lines changed

6 files changed

+2204
-851
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.vs
22
build
33
build64
4+
build_arm64/
45
node/input_methods/McBopomofo
5-
installer/*.exe
6+
installer/*.exe

McBopomofoWeb

Submodule McBopomofoWeb updated 46 files

appveyor.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
skip_tags: true
22
pull_requests:
3-
do_not_increment_build_number: true
3+
do_not_increment_build_number: true
44

5-
version: '{branch} build {build}'
6-
image: Visual Studio 2019
5+
version: "{branch} build {build}"
6+
image: Visual Studio 2022
77

88
init:
9-
- git --version
10-
- git config --global core.autocrlf true
9+
- git --version
10+
- git config --global core.autocrlf true
1111

1212
install:
13-
- git submodule init
14-
- git submodule update
13+
- git submodule init
14+
- git submodule update
1515

1616
build_script:
17-
- .\build.bat
17+
- .\build.bat
1818

1919
after_build:
20-
- appveyor.after_build.bat
21-
- ps: .\appveyor.artifacts.ps1
20+
- appveyor.after_build.bat
21+
- ps: .\appveyor.artifacts.ps1

build.bat

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
cmake . -Bbuild -G "Visual Studio 17 2022" -A Win32
1+
cmake . -Bbuild -G "Visual Studio 17 2022" -A Win32 -DCMAKE_POLICY_VERSION_MINIMUM=3.5
22
cmake --build build --config Release
33

4-
cmake . -Bbuild64 -G "Visual Studio 17 2022" -A x64
4+
cmake . -Bbuild64 -G "Visual Studio 17 2022" -A x64 -DCMAKE_POLICY_VERSION_MINIMUM=3.5
55
cmake --build build64 --config Release --target PIMETextService
66

7+
cmake . -Bbuild_arm64 -G "Visual Studio 17 2022" -A ARM64 -DCMAKE_POLICY_VERSION_MINIMUM=3.5
8+
cmake --build build_arm64 --config Release --target PIMETextService
9+
10+
711
echo "Start building McBopomofo"
812
cd McBopomofoWeb
913
cmd /C npm install

installer/installer.nsi

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ RequestExecutionLevel admin
102102

103103
var UPDATEX86DLL
104104
var UPDATEX64DLL
105+
var UPDATEARM64DLL
105106

106107
var INST_PYTHON
107108
var INST_CINBASE
@@ -158,6 +159,24 @@ Function uninstallOldVersion
158159
${EndIf}
159160
${EndIf}
160161

162+
; Handle ARM64 version of PIMETextService.dll
163+
${If} ${IsNativeARM64}
164+
SetRegView 64 ; For ARM64, use native 64-bit registry view
165+
ExecWait '"$SYSDIR\regsvr32.exe" /u /s "$INSTDIR\arm64\PIMETextService.dll"'
166+
; Verify MD5 checksum to determine if update is needed
167+
StrCpy $0 "$INSTDIR\arm64\PIMETextService.dll"
168+
md5dll::GetMD5File "$0"
169+
Pop $1
170+
StrCpy $2 "$PLUGINSDIR\PIMETextService_arm64.dll"
171+
md5dll::GetMD5File "$2"
172+
Pop $3
173+
${If} $1 == $3
174+
StrCpy $UPDATEARM64DLL "False"
175+
${Else}
176+
RMDir /REBOOTOK /r "$INSTDIR\arm64"
177+
${EndIf}
178+
${EndIf}
179+
161180
; Try to terminate running PIMELauncher and the server process
162181
; Otherwise we cannot replace it.
163182
ExecWait '"$INSTDIR\PIMELauncher.exe" /quit'
@@ -208,6 +227,25 @@ Function uninstallOldVersion
208227
${EndIf}
209228
${EndIf}
210229

230+
${If} ${IsNativeARM64}
231+
${If} ${FileExists} "$INSTDIR\arm64\PIMETextService.dll"
232+
; Verify the MD5 checksum of ARM64 PIMETextService.dll
233+
StrCpy $0 "$INSTDIR\arm64\PIMETextService.dll"
234+
md5dll::GetMD5File "$0"
235+
Pop $1
236+
StrCpy $2 "$PLUGINSDIR\PIMETextService_arm64.dll"
237+
md5dll::GetMD5File "$2"
238+
Pop $3
239+
${If} $1 == $3
240+
StrCpy $UPDATEARM64DLL "False"
241+
${Else}
242+
Delete /REBOOTOK "$INSTDIR\arm64\PIMETextService.dll"
243+
IfErrors 0 +2
244+
Call .onInstFailed
245+
${EndIf}
246+
${EndIf}
247+
${EndIf}
248+
211249
${If} ${FileExists} "$INSTDIR\x86\PIMETextService.dll"
212250
; Verify the MD5/SHA1 checksum of 32-bit PIMETextService.dll
213251
StrCpy $0 "$INSTDIR\x86\PIMETextService.dll"
@@ -261,11 +299,17 @@ Function .onInit
261299
SetRegView 64 ; disable registry redirection and use 64 bit Windows registry directly
262300
${EndIf}
263301

302+
${If} ${IsNativeARM64}
303+
SetRegView 64 ; disable registry redirection for ARM64 (also uses 64-bit view)
304+
${EndIf}
305+
264306
File "/oname=$PLUGINSDIR\PIMETextService_x86.dll" "..\build\PIMETextService\Release\PIMETextService.dll"
265307
File "/oname=$PLUGINSDIR\PIMETextService_x64.dll" "..\build64\PIMETextService\Release\PIMETextService.dll"
308+
File "/oname=$PLUGINSDIR\PIMETextService_arm64.dll" "..\build_arm64\PIMETextService\Release\PIMETextService.dll"
266309

267310
StrCpy $UPDATEX86DLL "True"
268311
StrCpy $UPDATEX64DLL "True"
312+
StrCpy $UPDATEARM64DLL "True"
269313

270314
StrCpy $INST_PYTHON "False"
271315
StrCpy $INST_CINBASE "False"
@@ -332,6 +376,29 @@ Function ensureVCRedist
332376

333377
; Change X64 FS Redirection back to default state
334378
${EnableX64FSRedirection}
379+
380+
${ElseIf} ${IsNativeARM64}
381+
${DisableX64FSRedirection}
382+
${IfNot} ${FileExists} "$SYSDIR\ucrtbase.dll"
383+
${OrIfNot} ${FileExists} "$SYSDIR\msvcp140.dll"
384+
MessageBox MB_YESNO|MB_ICONQUESTION $(DOWNLOAD_VCREDIST_QUESTION) IDYES +2
385+
Abort
386+
inetc::get "https://aka.ms/vs/17/release/vc_redist.arm64.exe" "$TEMP\vc_redist.arm64.exe"
387+
Pop $R0
388+
${If} $R0 != "OK"
389+
MessageBox MB_ICONSTOP|MB_OK $(DOWNLOAD_VCREDIST_FAILED_MESSAGE)
390+
Abort
391+
${EndIf}
392+
ExecWait "$TEMP\vc_redist.arm64.exe" $0
393+
${IfNot} ${FileExists} "$SYSDIR\ucrtbase.dll"
394+
${OrIfNot} ${FileExists} "$SYSDIR\msvcp140.dll"
395+
MessageBox MB_ICONSTOP|MB_OK $(INST_VCREDIST_FAILED_MESSAGE)
396+
ExecShell "open" "https://support.microsoft.com/en-us/kb/2999226"
397+
Abort
398+
${EndIf}
399+
${EndIf}
400+
${EnableX64FSRedirection}
401+
335402
${Else}
336403
MessageBox MB_YESNO|MB_ICONQUESTION $(DOWNLOAD_VCREDIST_QUESTION) IDYES +2
337404
Abort ; this is skipped if the user select Yes
@@ -565,6 +632,16 @@ Section "" Register
565632
; Register COM objects (NSIS RegDLL command is broken and cannot be used)
566633
ExecWait '"$SYSDIR\regsvr32.exe" /s "$INSTDIR\x64\PIMETextService.dll"'
567634
${EndIf}
635+
636+
${If} ${IsNativeARM64} ; This is a native ARM64 Windows system
637+
SetOutPath "$INSTDIR\arm64"
638+
${If} $UPDATEARM64DLL == "True"
639+
File "..\build_arm64\PIMETextService\Release\PIMETextService.dll" ; put ARM64 PIMETextService.dll in arm64 folder
640+
${EndIf}
641+
; Register COM objects (NSIS RegDLL command is broken and cannot be used)
642+
ExecWait '"$SYSDIR\regsvr32.exe" /s "$INSTDIR\arm64\PIMETextService.dll"'
643+
${EndIf}
644+
568645
SetOutPath "$INSTDIR\x86"
569646
${If} $UPDATEX86DLL == "True"
570647
File "..\build\PIMETextService\Release\PIMETextService.dll" ; put 32-bit PIMETextService.dll in x86 folder
@@ -667,6 +744,10 @@ Section "Uninstall"
667744
SetRegView 64 ; disable registry redirection and use 64 bit Windows registry directly
668745
${EndIf}
669746

747+
${If} ${IsNativeARM64}
748+
SetRegView 64 ; disable registry redirection on ARM64 systems
749+
${EndIf}
750+
670751
; Remove the launcher from auto-start
671752
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PIME"
672753
DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "PIMELauncher"
@@ -679,6 +760,11 @@ Section "Uninstall"
679760
RMDir /REBOOTOK /r "$INSTDIR\x64"
680761
${EndIf}
681762

763+
${If} ${IsNativeARM64}
764+
ExecWait '"$SYSDIR\regsvr32.exe" /u /s "$INSTDIR\arm64\PIMETextService.dll"'
765+
RMDir /REBOOTOK /r "$INSTDIR\arm64"
766+
${EndIf}
767+
682768
; Try to terminate running PIMELauncher and the server process
683769
; Otherwise we cannot replace it.
684770
ExecWait '"$INSTDIR\PIMELauncher.exe" /quit'

0 commit comments

Comments
 (0)