-
Notifications
You must be signed in to change notification settings - Fork 2
Windows installer and app icon.[CPP-324] #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e7e1908
Windows installer.
c90e3d8
Windows installer.
2abf785
Update installers/Windows/Installer.nsi
john-michaelburke 2839404
Switch author -> company_name
f9bca9c
Remove Scripts paths from installer.
e3e8aa7
Set executionlevel to user.
383b650
Add cache secret to GA caches.
38c2e37
Add version number to installer welcome page body.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,3 +17,4 @@ dist/ | |
| console_backend/tests/fileout.json | ||
| get-pip.py | ||
| .*.sw? | ||
| installers/Windows/*.exe | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,18 @@ | ||
| fn main() { | ||
| #[cfg(target_os = "windows")] | ||
| use winres::WindowsResource; | ||
| type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>; | ||
|
|
||
| fn main() -> Result<()> { | ||
| #[cfg(target_os = "linux")] | ||
| { | ||
| println!("cargo:rustc-link-lib=dylib=crypt"); | ||
| println!("cargo:rustc-link-arg=-Wl,-rpath,$ORIGIN/lib"); | ||
| } | ||
| #[cfg(target_os = "windows")] | ||
| { | ||
| WindowsResource::new() | ||
| .set_icon("../resources/images/icon.ico") | ||
| .compile()?; | ||
| } | ||
| Ok(()) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| ; This file was adapted from: | ||
| ; https://github.com/mherrmann/fbs/blob/master/fbs/_defaults/src/installer/windows/Installer.nsi | ||
| !include MUI2.nsh | ||
| !include FileFunc.nsh | ||
| !include LogicLib.nsh | ||
| !define MUI_ICON "..\..\resources\images\icon.ico" | ||
| !define MUI_UNICON "..\..\resources\images\icon.ico" | ||
|
|
||
| !searchparse /file "..\..\console_backend\src\version.txt" `` VER_MAJOR `.` VER_MINOR `.` VER_PATCH_UNFILTERED `` | ||
| !searchparse /noerrors "${VER_PATCH_UNFILTERED}" `` VER_PATCH `-` | ||
| !define VERSION_ORIGINAL "${VER_MAJOR}.${VER_MINOR}.${VER_PATCH_UNFILTERED}" | ||
| !define VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}.0" | ||
| !define app_name "Swift Navigation Console" | ||
| !define app_executable "console.exe" | ||
| !define installer_dir "py39-dist" | ||
| !define company_name "Swift Navigation" | ||
|
|
||
|
|
||
|
|
||
| !define UNINST_KEY \ | ||
| "Software\Microsoft\Windows\CurrentVersion\Uninstall\${app_name}" | ||
|
|
||
| VIProductVersion "${VERSION}" | ||
| VIAddVersionKey "ProductName" "${app_name}" | ||
| VIAddVersionKey "FileVersion" "${VERSION}" | ||
| VIAddVersionKey "ProductVersion" "${VERSION}" | ||
| VIAddVersionKey "LegalCopyright" "(C) ${company_name}" | ||
| VIAddVersionKey "FileDescription" "${app_name}" | ||
|
|
||
| !define MULTIUSER_EXECUTIONLEVEL Standard ; Switch to "Highest" for All Users when available otherwise current user. | ||
|
|
||
| !define MULTIUSER_INSTALLMODE_COMMANDLINE | ||
| !include MultiUser.nsh | ||
|
|
||
| ;-------------------------------- | ||
| ;Init | ||
|
|
||
| Function .onInit | ||
| !insertmacro MULTIUSER_INIT | ||
| ; Do not use InstallDir at all so we can detect empty $InstDir! | ||
| ${If} $InstDir == "" ; /D not used | ||
| ${If} $MultiUser.InstallMode == "AllUsers" | ||
| StrCpy $InstDir "$PROGRAMFILES64\${company_name}\${app_name}" | ||
| ${Else} | ||
| StrCpy $InstDir "$LOCALAPPDATA\${company_name}\${app_name}" | ||
| ${EndIf} | ||
| ${EndIf} | ||
|
|
||
| FunctionEnd | ||
|
|
||
| ;-------------------------------- | ||
| ;General | ||
|
|
||
| Name "${app_name}" | ||
| OutFile "${app_name}-${VERSION_ORIGINAL}.exe" | ||
|
|
||
| ;-------------------------------- | ||
| ;Interface Settings | ||
|
|
||
| !define MUI_ABORTWARNING | ||
|
|
||
| ;-------------------------------- | ||
| ;Pages | ||
| !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of ${app_name} version ${VERSION_ORIGINAL}.$\r$\n$\r$\n$\r$\nClick Next to continue." | ||
| !insertmacro MUI_PAGE_WELCOME | ||
| !insertmacro MUI_PAGE_DIRECTORY | ||
| !insertmacro MUI_PAGE_INSTFILES | ||
| !define MUI_FINISHPAGE_NOAUTOCLOSE | ||
| !define MUI_FINISHPAGE_RUN | ||
| !define MUI_FINISHPAGE_RUN_CHECKED | ||
| !define MUI_FINISHPAGE_RUN_TEXT "Run ${app_name}" | ||
| !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchAsNonAdmin" | ||
| !insertmacro MUI_PAGE_FINISH | ||
|
|
||
| !insertmacro MUI_UNPAGE_CONFIRM | ||
| !insertmacro MUI_UNPAGE_INSTFILES | ||
|
|
||
| ;-------------------------------- | ||
| ;Languages | ||
|
|
||
| !insertmacro MUI_LANGUAGE "English" | ||
|
|
||
| ;-------------------------------- | ||
| ;Installer Sections | ||
|
|
||
| Section | ||
| SetOutPath "$InstDir" | ||
| Call Uninstall | ||
| File /r "..\..\${installer_dir}\*" | ||
| WriteRegStr SHCTX "Software\${app_name}" "" $InstDir | ||
| WriteUninstaller "$InstDir\uninstall.exe" | ||
| CreateShortCut "$DESKTOP\${app_name}.lnk" "$InstDir\${app_executable}" | ||
| CreateShortCut "$SMPROGRAMS\${app_name}.lnk" "$InstDir\${app_executable}" | ||
| WriteRegStr SHCTX "${UNINST_KEY}" "DisplayName" "${app_name}" | ||
| WriteRegStr SHCTX "${UNINST_KEY}" "UninstallString" \ | ||
| "$\"$InstDir\uninstall.exe$\" /$MultiUser.InstallMode" | ||
| WriteRegStr SHCTX "${UNINST_KEY}" "QuietUninstallString" \ | ||
| "$\"$InstDir\uninstall.exe$\" /$MultiUser.InstallMode /S" | ||
| WriteRegStr SHCTX "${UNINST_KEY}" "Publisher" "${company_name}" | ||
| WriteRegStr SHCTX "${UNINST_KEY}" "DisplayIcon" "$InstDir\uninstall.exe" | ||
| ${GetSize} "$InstDir" "/S=0K" $0 $1 $2 | ||
| IntFmt $0 "0x%08X" $0 | ||
| WriteRegDWORD SHCTX "${UNINST_KEY}" "EstimatedSize" "$0" | ||
|
|
||
| SectionEnd | ||
|
|
||
| ;-------------------------------- | ||
| ;Uninstaller Section | ||
|
|
||
| Section "Uninstall" | ||
| Call un.Uninstall | ||
| SectionEnd | ||
|
|
||
| Function LaunchAsNonAdmin | ||
| Exec '"$WINDIR\explorer.exe" "$InstDir\${app_executable}"' | ||
| FunctionEnd | ||
|
|
||
| !macro Uninstall Prefix | ||
| Function ${Prefix}Uninstall | ||
| RMDir /r "$InstDir" | ||
| Delete "$DESKTOP\${app_name}.lnk" | ||
| Delete "$SMPROGRAMS\${app_name}.lnk" | ||
| DeleteRegKey /ifempty SHCTX "Software\${app_name}" | ||
| DeleteRegKey SHCTX "${UNINST_KEY}" | ||
| FunctionEnd | ||
| !macroend | ||
| !insertmacro Uninstall "" | ||
| !insertmacro Uninstall "un." | ||
|
|
||
| Function un.onInit | ||
| !insertmacro MULTIUSER_UNINIT | ||
| FunctionEnd | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need both of these macro calls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah when using a call inside of the uninstaller the function/macro must be prefixed by "un." so this allows us to call the same function before installing and when uninstalling.