Compiling GTK4 in windows with Vulkan

Submitted by Dickens A S on Sat, 12/07/2019 - 10:06

GTK4 is already available for download as "mingw-w64-x86_64-gtk4" you can type "pacman -S mingw-w64-x86_64-gtk4" to install it

Below steps are useful if you want to customize and install GTK4 with vulkan

Step 1 download and install MSYS2

Step 3 Install toolchains

pacman -S --needed mingw-w64-x86_64-toolchain
pacman -S --needed mingw-w64-x86_64-meson
pacman -S --needed mingw-w64-x86_64-pkg-config
pacman -S --needed mingw-w64-x86_64-glib2
pacman -S --needed mingw-w64-x86_64-pango
​​​​​​​pacman -S --needed mingw-w64-x86_64-cairo
​​​​​​​pacman -S --needed mingw-w64-x86_64-vulkan-devel

Step 4 Install GTK4 dependencies 

pacman -S --needed mingw-w64-x86_64-atk
pacman -S --needed mingw-w64-x86_64-gdk-pixbuf2
pacman -S --needed mingw-w64-x86_64-gobject-introspection
pacman -S --needed mingw-w64-x86_64-libepoxy
pacman -S --needed mingw-w64-x86_64-graphene
pacman -S --needed mingw-w64-x86_64-ffmpeg
pacman -S --needed mingw-w64-x86_64-cmake
pacman -S --needed mingw-w64-x86_64-pkg-config
pacman -S --needed mingw-w64-x86_64-hicolor-icon-theme 
pacman -S --needed mingw-w64-x86_64-libsass
pacman -S --needed mingw-w64-x86_64-sassc
pacman -S --needed mingw-w64-x86_64-glsl-optimizer-git
pacman -S --needed mingw-w64-x86_64-hlsl2glsl-git
pacman -S --needed mingw-w64-x86_64-glslang
pacman -S --needed mingw-w64-x86_64-iso-codes
pacman -S --needed mingw-w64-x86_64-glm

Step 5 Download Source Code GTK4 

Step 6 unzip and place inside c:\msys2\gtk (make sure the directory path is very small)

Step 7 update all MSYS2 dependencies to latest and check the GCC version properly as below or higher version

$ gcc --version
gcc.exe (Rev1, Built by MSYS2 project) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

Step 8 go inside the folder

$ cd /gtk
$ pwd

Step 9 begin meson

$ meson --prefix=/mingw64 -Dwin32-backend=true -Dvulkan=yes -Dprint-backends=none -Dman-pages=false -Ddocumentation=false -Ddemos=false -Dmedia=ffmpeg -Dbuild-examples=false builddir

Step 10 verify the below output

Build targets in project: 273

gtk 3.99.0

    Display backends: win32
      Print backends:
      Media backends: ffmpeg
      Vulkan support: True
       Cloud support: False
            Profiler: False
      Colord support: auto

           Debugging: True
        Optimization: 2
       Introspection: True
       Documentation: False
           Man pages: False
               Tests: True
       Install tests: False
               Demos: False
            Examples: False

              prefix: C:/msys64/mingw64
          includedir: C:/msys64/mingw64/include
              libdir: C:/msys64/mingw64/lib
             datadir: C:/msys64/mingw64/share

Found ninja.EXE-1.10.1 at C:\msys64\mingw64\bin/ninja.EXE

Step 11 got inside the build folder

$ cd builddir/
$ pwd

Step 11 initiate ninja build with single thread (for less CPU usage)

ninja -j 1 -v

Step 12 install GTK4

ninja install -v

Step 13 verify GTK4 settings

$ gtk4-query-settings
              gtk-double-click-time: 500
          gtk-double-click-distance: 4
                   gtk-cursor-blink: TRUE
              gtk-cursor-blink-time: 1200
           gtk-cursor-blink-timeout: 10
                   gtk-split-cursor: FALSE
            gtk-cursor-aspect-ratio: 0.040000
                     gtk-theme-name: "Adwaita"
                gtk-icon-theme-name: "Adwaita"
             gtk-dnd-drag-threshold: 4
                      gtk-font-name: "Segoe UI 9"
                  gtk-xft-antialias: 1
                    gtk-xft-hinting: 1
                  gtk-xft-hintstyle: "hintfull"
                       gtk-xft-rgba: "rgb"
                        gtk-xft-dpi: -1
              gtk-cursor-theme-name: NULL
              gtk-cursor-theme-size: 0
       gtk-alternative-button-order: TRUE
        gtk-alternative-sort-arrows: TRUE
              gtk-enable-animations: TRUE
                     gtk-error-bell: TRUE
                 gtk-print-backends: "file,lpr"
          gtk-print-preview-command: "evince --unlink-tempfile --preview --print-settings %s %f"
                  gtk-enable-accels: TRUE
                      gtk-im-module: ""
           gtk-recent-files-max-age: 30
           gtk-fontconfig-timestamp: 0
               gtk-sound-theme-name: "freedesktop"
   gtk-enable-input-feedback-sounds: TRUE
            gtk-enable-event-sounds: TRUE
    gtk-primary-button-warps-slider: TRUE
  gtk-application-prefer-dark-theme: FALSE
          gtk-entry-select-on-focus: TRUE
    gtk-entry-password-hint-timeout: 0
          gtk-label-select-on-focus: TRUE
           gtk-shell-shows-app-menu: FALSE
            gtk-shell-shows-menubar: FALSE
            gtk-shell-shows-desktop: TRUE
              gtk-decoration-layout: "menu:minimize,maximize,close"
          gtk-titlebar-double-click: "toggle-maximize"
          gtk-titlebar-middle-click: "none"
           gtk-titlebar-right-click: "menu"
             gtk-dialogs-use-header: FALSE
           gtk-enable-primary-paste: TRUE
           gtk-recent-files-enabled: TRUE
                gtk-long-press-time: 500
               gtk-keynav-use-caret: FALSE
              gtk-overlay-scrolling: TRUE





Submitted by Theresa Phipps (not verified) on Sat, 02/11/2023 - 20:13


Dear administrator, Thanks for the well-presented post!

Add new comment