Skip to content

Commit

Permalink
book: Added Libxml, Librsvg, Gettext and Libadwaita demo (#1178)
Browse files Browse the repository at this point in the history
* Add Libxml Librsvg and Gettext 

They are needed to parse user interface (xml) files as well as to display icons.

* Compile libadwaita demo for widgets previews

With the previous commit adding Libxml, Librsvg and Gettext, it is now possible to compile the libadwaita demo.

* Fix accidental typo

* Fix scalable/apps/ and symbolic/apps/ on Windows

Introduce a workaround to display icons correctly on Windows.
https://gitlab.gnome.org/GNOME/gtk/-/issues/5303

* Assumes xcopy destination specifies a directory

* Add a warning for gettext
  • Loading branch information
wroyca committed Nov 28, 2022
1 parent 41028c9 commit 6ce49d0
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 9 deletions.
44 changes: 36 additions & 8 deletions book/src/installation_windows.md
Expand Up @@ -33,6 +33,10 @@ Make sure to check the box "Desktop development with C++" during the installatio
Download git from [gitforwindows.org](https://gitforwindows.org/).


### CMake
Download CMake from [https://cmake.org/download/](https://cmake.org/download/)


### Python

Download python from [python.org](https://www.python.org/downloads).
Expand All @@ -48,6 +52,14 @@ pip install meson ninja
```


### Gettext 0.21

> **Warning**
> **To avoid any potential problems, we strongly recommend the static version.**
Download Gettext 0.21 from [mlocati.github.io](https://mlocati.github.io/articles/gettext-iconv-windows.html).


### Pkg-config

Download pkg-config-lite from [sourceforge.net](https://sourceforge.net/projects/pkgconfiglite/).
Expand All @@ -64,6 +76,13 @@ C:\pkg-config-lite-0.28-1\bin
C:\gnome\bin
```

3. Go back to `Environment variables`
4. Under `User variables` click on `New` and add:

- Variable name: `PKG_CONFIG_PATH`
- Variable value: `C:\gnome\lib\pkgconfig`


### Compile and install GTK 4

From the Windows start menu, search for `x64 Native Tools Command Prompt for VS 2019`.
Expand All @@ -73,18 +92,27 @@ From there, run the following commands:
```powershell
cd /
git clone https://gitlab.gnome.org/GNOME/gtk.git --depth 1
git clone https://gitlab.gnome.org/GNOME/libxml2.git --depth 1
git clone https://gitlab.gnome.org/GNOME/librsvg.git --depth 1
cd gtk
meson setup builddir --prefix=C:/gnome -Dbuild-tests=false -Dmedia-gstreamer=disabled
meson install -C builddir
```

### Set `PKG_CONFIG_PATH` environment variable
cd /
1. Go to settings -> Search and open `Advanced system settings` -> Click on `Environment variables`
2. Under `User variables` click on `New` and add:
cd libxml2
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=C:\gnome -D LIBXML2_WITH_ICONV=OFF -D LIBXML2_WITH_LZMA=OFF -D LIBXML2_WITH_PYTHON=OFF -D LIBXML2_WITH_ZLIB=OFF
cmake --build build --config Release
cmake --install build
cd /
- Variable name: `PKG_CONFIG_PATH`
- Variable value: `C:\gnome\lib\pkgconfig`
cd librsvg/win32
where python
nmake /f generate-msvc.mak generate-nmake-files PYTHON=<output from last command>
xcopy /s C:\gnome\include\cairo C:\gnome\include
nmake /f Makefile.vc CFG=release install PREFIX=C:\gnome
cd /
```


## GNU toolchain
Expand All @@ -109,7 +137,7 @@ That will open a terminal configured to use MinGW x64 tools.
There, execute the following commands to install `GTK 4`, `pkgconf` and `gcc`.

```sh
pacman -S mingw-w64-x86_64-gtk4 mingw-w64-x86_64-pkgconf mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-gtk4 mingw-w64-x86_64-gettext mingw-w64-x86_64-libxml2 mingw-w64-x86_64-librsvg mingw-w64-x86_64-pkgconf mingw-w64-x86_64-gcc
```


Expand Down
8 changes: 7 additions & 1 deletion book/src/libadwaita.md
Expand Up @@ -59,6 +59,12 @@ From there, run the following commands:
cd /
git clone https://gitlab.gnome.org/GNOME/libadwaita.git --depth 1
cd libadwaita
meson setup builddir -Dprefix=C:/gnome -Dintrospection=disabled -Dvapi=false -Dexamples=false
meson setup builddir -Dprefix=C:/gnome -Dintrospection=disabled -Dvapi=false
meson install -C builddir
# This is a workaround for https://gitlab.gnome.org/GNOME/gtk/-/issues/5303.
# NOTE: The cache must be rebuilt every time you add new icons.
xcopy /s /i C:\gnome\share\icons\hicolor\scalable\apps C:\gnome\share\icons\hicolor\scalable\actions
gtk4-update-icon-cache.exe -t -f C:\gnome\share\icons\hicolor
```

0 comments on commit 6ce49d0

Please sign in to comment.