config.h should always be included, a build without it never happens.
The checks on Linux always succeed, because autotools automatically
defines HAVE_CONFIG_H on all the Makefiles. On Windows this is not the
case. Removing all the checks revealed that multiple projects did not
include config.h because HAVE_CONFIG_H wasn't defined. This was the case
for at least the following projects:
- acyclic
- bcomps
- ccomps
- dijkstra
- ingraphs
- gc
- gml2gv
- graphml2gv
- gv2gml
- gvcolor
- gvgen
- mm2gv
- nop
- pathplan
- rbtree
- sccmap
- topfish
- tred
Added `windows\include` to the additional include directories and adding
some library paths solves some, but not all problems that emerged when the
check was removed and some code actually got compiled that wasn't compiled
before.
Casting `strcmp` to `__compar_fn_t` doesn't work on Windows, the build
fails. Instead, cast `strcmp` to the required function type:
`(int(*)(const void*, const void*)`
`bsearch` is used in this function to find a string in a string array. It's not needed to pass the address of `tok` to the function, because `tok` is already a pointer. `gvrender_comparestr` should then cast the values to `(const char)` instead of `*(char**)`, because `s1` and `s2` are strings, not pointers to a string. With this change the function only calls `strcmp`, so passing `strcmp` to `bsearch` has the same effect and `gvrender_comparestr` can be removed.
This gets rid of all the `-Wcast-qual` warnings as well.
There are now two environments, one where the variable DOCKER_BUILD is true and one where it is false. False means a normal build on the Travis build image, true means docker will be used to run a build on a CentOS 7 image. The setup of the CentOS 7 image is done in the Dockerfile in `ci/centos7`. It takes a clean CentOS 7 image and installs the required build utilities and dependencies for a minimal build.
This flag causes errors in the Docker build. Removing it still results in a succesfull build and the previous changelogs indicate that this flag should be removed.
From the Qt documentation (http://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5#QCoreApplication::UnicodeUTF8_is_deprecated):
QCoreApplication::UnicodeUTF8 is deprecated
This enum type used to define the 8-bit encoding of character string arguments to translate(). This enum is now obsolete and UTF-8 will be used in all cases. So remove all instances of QCoreApplication::UnicodeUTF8.
Erwin Janssen [Mon, 29 Aug 2016 20:16:59 +0000 (22:16 +0200)]
Resolved "macro redefinition" warnings.
On Windows, the Linux build does not throw this warning, the warning C4005
"macro redefinition" is thrown several hundered times. Most of these could
be prepended by an `#undef`, this resolves the warning.
Erwin Janssen [Mon, 29 Aug 2016 11:54:08 +0000 (13:54 +0200)]
Windows: set <DebugInformationFormat> to default.
Set the <DebugInformationFormat> to default for the release configuration.
The value it had (Zi) is the same as the default value, so the
<DebugInformationFormat> can be safely removed.
Erwin Janssen [Mon, 29 Aug 2016 11:11:51 +0000 (13:11 +0200)]
Windows: Change release output directory
Use $(SolutionDir)Release\Graphviz\bin\ instead of
$(SolutionDir)Graphviz\bin\. This is more consistent and allows for an
easier artifact selection on Appveyor.
Erwin Janssen [Mon, 29 Aug 2016 10:00:52 +0000 (12:00 +0200)]
Windows: enabled Debug build for all projects.
Not all project would build when using the Debug configuration, and some
projects had conflicting settings that didn't allow a Debug build. Both
are fixed.
Erwin Janssen [Thu, 25 Aug 2016 18:01:16 +0000 (20:01 +0200)]
Appveyor: produce two artifacts
Produce two artifacts: one with all the files that are generated during
the build (PDB files for debug, etc.) and one without. The last one is
most suited as a release.
Erwin Janssen [Thu, 25 Aug 2016 13:25:31 +0000 (15:25 +0200)]
Windows: Removed false <RandomizedBaseAddress>
Some project had <RandomizedBaseAddress> set to false. Setting this to
false disables ASLR which is a nice security feature. These options are
removed because the default value for <RandomizedBaseAddress> is true.
Erwin Janssen [Tue, 23 Aug 2016 00:58:58 +0000 (02:58 +0200)]
Appveyor: Reduce build output noise.
Before the build, delete the file "C:\Program Files
(x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets",
Otherwise several "target does not exist and will be ignored" messages are
printed.
Erwin Janssen [Tue, 23 Aug 2016 00:40:24 +0000 (02:40 +0200)]
Windows: Compiling with /MT instead of /MD
On a release build, compile all projects with /MT instead of /MD. This
means that required system libraries are staticly linked instead, so no
DLL is needed. Before this change, the user was required to install the
SDK, this is no longer the case.
The only exception is gvplugin_gd. This can't be compiled with /MT,
because it's dependency libgd is compiled with /MD.
Erwin Janssen [Mon, 22 Aug 2016 23:46:08 +0000 (01:46 +0200)]
Windows: Disable warning C4996
Disable MSVC warning C4996. This warning mostly fires on completely valid
code and fixing this warning compromises code portability, while the code
quality isn't improved substantially.
Fix bug in SparseMatrix_copy tries to copy a pattern matrix which does
have values.
If a matrix is constructed using _from_coordinate_arrays, it calls
from_coordinate_arrays_internal with SUM_REPEATED_ALL. The latter function then
calls sum_repeated_entries. This causes values to be added to the array
Later, if the matrix is passed to make_undirected, this calls symmetrize,
which may call _copy. If _copy uses _new, the new array will use the input
array's type (pattern) and not create memory values, causing the memcpy to fail.
These three warnings could be resolved without making functional changes in the code. Also initialized the three local variables in this function to zero.
Erwin Janssen [Wed, 10 Aug 2016 08:37:12 +0000 (10:37 +0200)]
Travis: clean build steps.
Because the results of `make install` when using a prefix aren't binaries suitable to be released, some build steps can either be removed or simpified.
Erwin Janssen [Mon, 8 Aug 2016 13:49:04 +0000 (15:49 +0200)]
Tests added for current behaviour command line.
This commit adds some tests that "document" the current behavior of the command line interface. When refactoring command line interface (like the parsing code), the observable behavior of the command line interface should stay the same, this is to ensure backwards compatibility. These tests are a start, it covers some basic command line operations (printing the version and usage), but show some interesting things. Mainly that the order of the flags is very important.
- `dot -Vrandom` prints the version, but `dot -randomV` causes an error.
- `dot -?V` prints the usage, but `dot -V?` prints the version.
While it may be desirable to change this, when refactoring this behavior should stay the same. Changing the existing interface should be done in Graphviz 3.
Erwin Janssen [Mon, 8 Aug 2016 10:08:42 +0000 (12:08 +0200)]
Travis: Install Criterion
Adds the installation of Criterion to the `install` step in the Travis configuration. A submodule is used so changes in the Criterion repository can't break the build. A submodule points to a specific commit.
Erwin Janssen [Mon, 8 Aug 2016 09:59:34 +0000 (11:59 +0200)]
Simple unit test added.
This unit test serves to validate the configuration and installation of the Criterion unit testing framework. This test will only be compiled and run if Criterion is installed.
Erwin Janssen [Mon, 8 Aug 2016 09:21:55 +0000 (11:21 +0200)]
Check for unit test framework in configure.ac
Criterion is a unit testing framework for C and C++ and it's C99 compatible. It allows for fast test writing because, unlike a lot of other C unit test frameworks, it doesn't require a lot of boilerplate code.
This check in configure.ac checks if Criterion is installed on the system.
There were several Wundef warnings in ast_common.h.in. Because this file is included in a lot of other files, these warnings showed up often. This change fixed 1119 warnings in total.