-
Notifications
You must be signed in to change notification settings - Fork 103
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
dexc-desktop: Windows builder, installer #2635
Conversation
This sets the window icon, which is different from either the tray icon or any icon embedded in the binary such as the windows ICOs. On Linxu, this uses gtk_window_set_icon to set the icon from one of the embedded (in-memory) images so it does not need the file on disk. On Windows, it applies the icon in a resource. This also changes to os-specific systray icons since Windows in particular needs these to be ico files, not pngs. This also adds Windows syso resource files for dexc-desktop, as is already done for dexc with -systray builds. On Windows, these resources are also used to set the window's icon with LoadImage specifying the window's handle and resource name instead of a file name. just open the logs folder, not a new webview window add notes for windows build of dexc-desktop
511029a
to
b65812d
Compare
b65812d
to
4398729
Compare
Write-Host "Installing MSYS2..." -ForegroundColor Cyan | ||
Invoke-WebRequest -Uri https://github.com/msys2/msys2-installer/releases/download/$MSysVersion/$MSys2Installer -OutFile $MSys2Installer | ||
Start-Process $MSys2Installer -ArgumentList "install --root $MSysInstallPath --confirm-command" -Wait | ||
[Environment]::SetEnvironmentVariable('Path', "$([Environment]::GetEnvironmentVariable('Path', 'Machine'));$MSysInstallPath\ucrt64\bin", 'Machine') |
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.
I actually see the header it isn't finding in $MSysInstallPath\ucrt64\include
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.
Wait, that one is not capitalized, does it matter. I have another capitalized one.
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.
Wait, that one is not capitalized, does it matter. I have another capitalized one.
That shouldn't matter, the FS is case insensitive.
) | ||
|
||
echo Building dexc-desktop with CGO configured... | ||
set CGO_CXXFLAGS="-I%libDir%\build\native\include" |
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.
So, I changed this to exactly: set CGO_CXXFLAGS="-I%libDir%\build\native\include" "-IC:\msys64\ucrt64\include"
And it builds with a few warnings:
.\pkg\build-windows.cmd
Building dexc-desktop with CGO configured...
# github.com/webview/webview
In file included from C:\msys64\ucrt64\include/winerror.h:4739,
from C:\msys64\ucrt64\include/winbase.h:2817,
from C:\msys64\ucrt64\include/windows.h:70,
from C:\msys64\ucrt64\include/rpc.h:16,
from C:\msys64\ucrt64\include/wtypesbase.h:7,
from C:\msys64\ucrt64\include/shlobj.h:9,
from webview.h:1051,
from webview.cc:1:
C:\msys64\ucrt64\include/fltwinerror.h:12: warning: "FACILITY_USERMODE_FILTER_MANAGER" redefined
12 | #define FACILITY_USERMODE_FILTER_MANAGER 0x1f
|
In file included from C:\msys64\ucrt64\include/winbase.h:2817,
from C:\msys64\ucrt64\include/windows.h:70,
from C:\msys64\ucrt64\include/rpc.h:16,
from C:\msys64\ucrt64\include/wtypesbase.h:7,
from C:\msys64\ucrt64\include/shlobj.h:9,
from webview.h:1051,
from webview.cc:1:
C:\msys64\ucrt64\include/winerror.h:38: note: this is the location of the previous definition
38 | #define FACILITY_USERMODE_FILTER_MANAGER 31
|
In file included from webview.h:1051,
from webview.cc:1:
C:\msys64\ucrt64\include/shlobj.h:607:3: warning: 'typedef' was ignored in this declaration
607 | typedef enum tagGPFIDL_FLAGS {
| ^~~~~~~
Build completed
1 file(s) copied.
Signing C:\Users\joe\git\dcrdex\client\cmd\dexc-desktop\build\windows\dexc-desktop.exe
Usage: sign-windows.cmd <file>
The WebView2Loader.dll file should be included with dexc-desktop.exe
But it does build. Running is mostly fine, but The USDC has no symbol and the candles dont seem to load... Is it using an up to date site folder?
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.
Oh yeah I updated my site folder and it worked. Maybe should do that anyway? I see it is conditional.
Can you add the include? I'm fine with the warnings it is building with that.
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.
Can you add the include? I'm fine with the warnings it is building with that.
I tried hard but can't replicate this situation - the header files are all found correctly without adding this path, and the build runs without any warnings/errors. I think there may be some leftover of the previous msys install on the system you're testing on.
736b340
to
9779240
Compare
9779240
to
33f37e0
Compare
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.
Working for me with some adjustment, but may be because of things previously installed on my system.
Uhmm, @peterzen what's the correct cmd to use? this? |
curl -O https://github.com/peterzen/dcrdex/blob/windows-build/client/cmd/dexc-desktop/pkg/setup-windows.cmd |
Tried to run from the normal windows cmd but got this error:
Maybe it has to do with this: |
Apologies, that URL wasn't correct - you need to get the raw script. The documentation points to the correct URL but to the |
Could you doblecheck that a file named Edit: I was able to reproduce this when running in |
ae4634a
to
cb7cbd3
Compare
Okay, will check and try again. |
Thanks. I've updated the script to change to |
It's there. Maybe I should delete this yh?
|
Yes, though it doesn't hurt. The script now has a fix, basically it needs to be run from any writable directory, e.g. |
cb7cbd3
to
9f61418
Compare
// This code is available on the terms of the project LICENSE.md file, | ||
// also available online at https://blueoakcouncil.org/license/1.0.0. | ||
|
||
//go:build !linux && !windows && !darwin |
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.
We're only targeting these three platforms anyway. Do we need this file?
// https://docs.gtk.org/gtk3/method.Window.set_icon_from_file.html | ||
|
||
/* | ||
#cgo linux pkg-config: gtk+-3.0 |
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.
Huh. Nice.
```batch | ||
cd %UserProfile% | ||
curl -O https://raw.githubusercontent.com/decred/dcrdex/master/client/cmd/dexc-desktop/pkg/setup-windows.cmd | ||
setup-windows.cmd <branch> <repoUrl> |
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.
On a fresh Windows 10 install
C:\Users\buck5>setup-windows.cmd
Installing git...
Installing PowerShell...
Cloning https://github.com/decred/dcrdex@master...
Cloning into 'dcrdex'...
remote: Enumerating objects: 30531, done.
remote: Counting objects: 100% (1661/1661), done.
remote: Compressing objects: 100% (1023/1023), done.
remote: Total 30531 (delta 987), reused 1076 (delta 619), pack-reused 28870
Receiving objects: 100% (30531/30531), 53.70 MiB | 25.19 MiB/s, done.
Resolving deltas: 7% (1591/22728)
Resolving deltas: 100% (22728/22728), done.
The argument 'pkg\setup-windows-stage2.ps1' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the -File parameter.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
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.
setup-windows.cmd
calls pkg\setup-windows-stage2.ps1
after cloning the repo; for testing this PR the fork repo/branch needs to be specified:
setup-windows.cmd windows-build https://github.com/peterzen/dcrdex
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.
The script should probably explain this fact if the file is not found, I'll add this.
This PR implements the build environment for Windows:
Tested on Windows 10, Windows 11, Windows 2019/2022