Step 1.: 下载 MSYS2 installer WIN32或 WIN64版本。
Step 2.:运行 MSYS2输入:
pacman -S mingw-w64-ucrt-x86_64-gtk4
如果要安装 GTK3 输入:
pacman -S mingw-w64-ucrt-x86_64-gtk3
Step 3. 安装GTK4程序在WINDOWS下的C/C++编译环境MINGW-W64,输入:
pacman -S mingw-w64-ucrt-x86_64-toolchain base-devel
安装GTK4程序在WINDOWS下的PYTHON开发环境,输入:
pacman -S mingw-w64-ucrt-x86_64-python-gobject
安装WIN10主题:
Once you have installed the GTK as above, you should have little problem compiling a GTK app. In order to run it successfully, you will also need a GTK theme. There is some old builtin support for a Windows theme in GTK, but that makes your app look like a Windows 7 app. It is better to get a Windows 10 theme, for instance the Windows 10 Transformation Pack.
Step 1. 从 Windows 10 Transformation Pack repository 复制图标到本地 share/themes/Windows10:
- for the GTK4 assets, copy the contents of the
gtk-4.0folder undershare/themes/Windows10/gtk-4.0 - for the GTK3 assets, copy the contents of the
gtk-3.20folder undershare/themes/WIndows10/gtk-3.0
Step 2. You also need to copy the icons from the Adwaita theme, which you can download from the GNOME sources.
Step 3. Perform the same steps for the hicolor icons, which are the mandatory fallback for icons not available in Adwaita.
Step 4. 在 etc 文件夹下创建settings.ini:
- for GTK4, use
etc/gtk-4.0/settings.ini - for GTK3, use
etc/gtk-3.0/settings.ini
在settings.ini 中输入:
[Settings]
gtk-theme-name=Windows10
gtk-font-name=Segoe UI 9
Step 5. 运行glib-compile-schemas 安装主题:
glib-compile-schemas share/glib-2.0/schemas
Step 6. You can then zip up your installation folder, or use an installer generator to do that for you, and distribute the result.
You may use MSYS2 to build your GTK application and create an installer to distribute it. Your installer will need to ship your application build artifacts as well as GTK binaries and runtime dependencies.
Legal notes on distributing GTK with your application
You are welcome to redistribute GTK binaries, including applications that bundle them, on other web sites, CD-ROM, and other media. You don’t have to ask for permission. That’s one of the points of Free Software.
One important thing that the GNU licenses require is that you must also redistribute the source code on request. This usually means at least the gettext, GLib, GTK, Pango and ATK sources.

1114

被折叠的 条评论
为什么被折叠?



