(Graphviz versions ≥ 2.41)
First, make sure that you've checked out the most recent branch via git. Don't download the repository via .zip or .tar.gz, as otherwise you'll need to add the git submodule(s) yourself. ('git init' in a folder, and then 'git clone https://gitlab.com/graphviz/graphviz.git')
Then, run 'git submodule update --init' in the root directory. This will download all submodules, which are mostly the dependencies for the Windows build.
You may need to add the ..\windows\dependencies\graphviz-build-utilities directory to your PATH environmental variable (and restart Visual Studio or the prompt with which you execute msbuild after that). This folder contains the tools Bison, Flex and SED (and future additions) with versions that are tested.
If all went right, the dependencies are now set up and you can build Graphviz.
Then browse to ..\graphviz\windows\getopt\ and open up getopt.vcxproj in Visual Studio. Building, for exaple, dot.exe is done by right-clicking dot in the solution explorer, and clicking build.
Then, in ..\graphviz\Debug\Graphviz\bin\ run 'dot.exe -c' to make a config file and everything should work.
(Graphviz versions ≥ 2.30)
The current build process for Windows using Visual Studio is fairly simple assuming all of the necessary files are available and have been put in the correct place. The build assumes you have installed binary versions of GTK 2.0 or later, Qt, and ltdl, and source versions of GTS and ann. Further instructions can be found in the Graphviz gitlab repository.
This whole process could and should be simplified. In particular, the 3rd-party software should not be stored in two places, and the Graphviz files that are made part of the release should come from the source package, and not be stored separately. In addition, the GTS and ANN build should be separate from the Graphviz build. As 3rd-party libraries, these should only be built when the source is updated.
(Graphviz versions ≥ 2.22)
We now build both Visual Studio and MinGW versions of Graphviz. In addition, the source package comes with project files for Visual Studio, so building from source should be fairly simple in either case.
export INSTALLROOT # Root install directory
export GTKDIR # Root of GTK tree
export FONTCONFIGINCLUDEDIR # Path of fontconfig include dir
export FONTCONFIGLIBDIR # Path of fontconfig lib dir
export FREETYPEINCLUDEDIR # Path of freetype2 include dir
export FREETYPELIBDIR # Path of freetype2 lib dir
export CFLAGS="-DGVDLL=1"
export CPPFLAGS="-I$GTKDIR/include -I$GTKDIR/include/freetype2 "
export LDFLAGS="-L$GTKDIR/lib -no-undefined"
export FONTCONFIG_CFLAGS=-I$GTKDIR/include/
export FONTCONFIG_LIBS="-L$FONTCONFIGLIBDIR -lfontconfig"
export FREETYPE2_CFLAGS=-I$FREETYPEINCLUDEDIR
export FREETYPE2_LIBS=-L$FREETYPELIBDIR
export PKG_CONFIG=$GTKDIR/bin/pkg-config
export PKG_CONFIG_PATH=$GTKDIR/lib/pkgconfig
export PANGOFLAGS="--with-fontconfig --with-fontconfiglibdir=$FONTCONFIGLIBDIR --with-fontconfigincludedir=$FONTCONFIGINCLUDEDIR --with-pangocairo"
./configure -C --prefix=$INSTALLROOT --without-gdk-pixbuf --with-mylibgd --disable-swig --without-x --disable-tcl --without-ipsepcola --enable-shared --disable-static --with-freetype=$GTKDIR/lib --enable-ltdl $PANGOFLAGS --without-gtk --without-gtkgl
When configure finishes, it lists all of the Graphviz features that have been
enabled. If there are problems, you can check for errors in config.log.
You may have to add or modify
other flags and environment variables for configure to give you the
settings you want. Run configure --help
to see the allowed options and environment variables.
(2.21 >= Graphviz versions > 2.14)
To simplify our build process, especially as most Windows users only want a binary version of the software, the Graphviz build for Windows now uses uwin, an open-source Unix layer on top of Windows. In this environment, we can use essentially the same tools and process used on Unix. In particular, we do not have to maintain multiple build files.
To build Graphviz:
Presumably, a similar approach would work with Cygwin or MinGW. The following are some notes by Steve Roush describing how he made a static build of the libraries on MinGW.
here is the command line I used to build "simple.c" (dot.demo/simple.c), after adding a few lines based on https://mailman.research.att.com/pipermail/graphviz-interest/2006q2/003586.html
X=simple;gcc -v -I'/usr/local/include/graphviz' -I'/usr/local/include'
-o $X -O $X.c -L/usr/local/lib -L/usr/local/lib/graphviz -lgvc -lgraph
-lpathplan -lcdt -lgvplugin_core -lgvplugin_dot_layout
-lgvplugin_neao_layout -lgvplugin_gd -lgvplugin_pango -lgvc -lpathplan
If you desire to build directly using Visual Studio or other non-Unix-based environment, you will need to derive the necessary information from the supplied Makefiles.
(2.14 >= Graphviz versions >= 2.3)
We build Graphviz on Windows using the MS Visual C++ 6.0 compiler only. The simplest way to build the software from source on Windows is as follows:
Once built, all of the libraries and programs will be found in either the Release or Debug subdirectory of the corresponding source directory. If you wish to install the software somewhere, edit the file $ROOT\install.bat to set the variable root to be the absolute pathname of the directory where you want the software installed, and then run the script $ROOT\install.bat from the $ROOT directory.
If you want to change source files, you can just do it and rebuild. If, however, you want to add new files or projects, you will have to redo the makefiles or scripts.
If you have problems or questions, please contact us at erg@research.att.com.