Windows distribution & installer
Currently we can build using MSYS2 by installing:
pacman -S mingw-w64-x86_64-toolchain base-devel mingw-w64-x86_64-gtk2 meson
Note: It seems the default meson doesn't work (not sure why). So I simply remove it:
pacman -R meson and then download the git version: https://github.com/mesonbuild/meson/releases/tag/0.49.0 It is still important to install it first via pacman as that brings in it's dependencies (such as ninja).
Then the standard (as per documentation):
../meson/meson.py builddir --prefix=`pwd`/builddir/local_install cd builddir && ninja install # Then you can either: ./local_install/bin/dia ./run_with_dia_env app/dia
The point is that it compiles and works. The challenge then is how to distribute it?
What has been attempted
Building via Visual Studio 2017 and
There are a few
*.msc files. I believe these are for
nmake, which belongs to VS. I tried running
nmake makefile.msc from source root directory but got an error regarding missing
glib. This was traced to the inclusion from
dia-make.msc and removed from there. Then, attempting to run
nmake makefile.msc again I got errors for missing
... cl /c aadl.c aadlbox.c aadlbus.c aadldata.c aadldevice.c aadlmemory.c aadlpackage.c aadlport.c aadlprocess.c aadlprocessor.c aadlsubprogram.c aadlsystem.c aadltext.c aadlthread.c aadlthreadgroup.c edit_port_declaration.c Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27025.1 for x86 Copyright (C) Microsoft Corporation. All rights reserved. aadl.c aadl.c(26): fatal error C1083: Cannot open include file: 'object.h': No such file or directory aadlbox.c c:\msys64\home\eduard\dia\objects\aadl\aadl.h(30): fatal error C1083: Cannot open include file: 'intl.h': No such file or directory aadlbus.c ...
Building via Visual Studio and
However this also errors out with missing gtk+2.0 (not sure how to install it from VS):
C:\msys64\home\Eduard\dia>python ..\meson\meson.py --backend=vs2017 builddir-vs10 The Meson build system Version: 0.49.0 Source dir: C:\msys64\home\Eduard\dia Build dir: C:\msys64\home\Eduard\dia\builddir-vs10 Build type: native build Project name: dia Project version: 0.97.3+git Native C compiler: cl (msvc 19.16.27025.1) Native C++ compiler: cl (msvc 19.16.27025.1) Build machine cpu family: x86 Build machine cpu: x86 Found Pkg-config: NO Found CMake: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE (3.12.18081601-MSVC_2) Dependency gtk+-2.0 found: NO (tried cmake) meson.build:13:0: ERROR: Pkg-config not found. A full log can be found at C:\msys64\home\Eduard\dia\builddir-vs10\meson-logs\meson-log.txt C:\msys64\home\Eduard\dia>
Manually packaging files build in MSYS2
Dia can be run without installing to a local prefix, or using the
run_with_dia_env script by either changing the PATH or by moving it to the same location as
The problem then is that if attempted to be ran from outside of MINGW64 environment, Windows will not find the MSYS libraries. As such, they need to be copied to
However after copying all libraries I get the following:
Reverse engineering existing installer
The existing installer can be extracted using 7zip. We can then view all contained files - note that the
bin/ directory has all required
Unfortunately these are different libraries and simply replacing
dia.dll didn't work.
Figuring it out from scratch
Looking at what other projects do
This seems promising: http://wiki.inkscape.org/wiki/index.php/Compiling_Inkscape_on_Windows_with_MSYS2
Inkscape uses MSYS2 but they also build .exe (NSIS) and .msi installers.
Got it to compile (had to disable NLS:
cmake -G Ninja .. -DENABLE_NLS=0 -DWITH_NLS=0).
ninja install installs all dependencies. Can we make meson install dependencies as well?