vslavik / winsparkle

App update framework for Windows, inspired by Sparkle for macOS
http://winsparkle.org
Other
1.31k stars 267 forks source link

Support LLVM MinGW with CMake. #265

Closed tmiw closed 10 months ago

tmiw commented 11 months ago

This PR updates the CMake files as follows:

  1. Updates the list of wxWidgets files to reflect updates to it since the CMake files were last touched.
  2. Includes CMake logic from wxWidgets to pull in WebView2 and include its .lib/.dll files.
  3. For LLVM MinGW only, uses a slightly modified wx/setup.h to require WebView2Loader.dll due to MinGW missing Microsoft's buffercheck code.
  4. Minor fixes to allow WinSparkle to be built on Linux instead of Windows via cross-compiling.
  5. Fixes a minor compiler error in the main WinSparkle code due to a missing #include.

Context: I'm one of the maintainers of the FreeDV project and am looking to include an auto-update mechanism into our codebase (which uses CMake for configuration and LLVM MinGW to build the Windows binaries).

Let me know if you have any questions or need me to modify anything here.

tmiw commented 10 months ago

I'd appreciate if this could follow the golden git rule of one commit per one self-contained change - right now some changes are split across two commits while the primary 79c5af5 commit does more than it says. In particular, wx/cmake and other compilation fixes are unrelated to Clang.

Understood, have tried to do so for commits after this message.

This should be an #ifdef in the setup.h file instead of duplicated all of it.

Added #if defined(__clang__) in the existing setup.h instead of creating a new one.

vslavik commented 10 months ago

Thanks!

I'd like to add this to CI to avoid accidentally breaking it. Do I need to do anything special or will using MSYS2's CLANG64 environment do?

tmiw commented 10 months ago

Thanks!

I'd like to add this to CI to avoid accidentally breaking it. Do I need to do anything special or will using MSYS2's CLANG64 environment do?

I've never tried that environment, but I've basically been testing by doing something like the following:

$ cd ~
$ wget https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/llvm-mingw-20231128-ucrt-ubuntu-20.04-x86_64.tar.xz
$ tar xf llvm-mingw-20231128-ucrt-ubuntu-20.04-x86_64.tar.xz
$ export PATH=~/llvm-mingw-20231128-ucrt-ubuntu-20.04-x86_64/bin:$PATH
$ cd winsparkle/cmake
$ mkdir build
$ cd build
$ cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/llvm-mingw-toolchain.cmake ..
$ make

For llvm-mingw-toolchain.cmake, one of the files over at https://github.com/drowe67/freedv-gui/tree/master/cross-compile will work (depending on platform). Hope this helps!

vslavik commented 10 months ago

Thanks for the pointers; I'll add this together with other CMake CI integration later, now that this is merged.