defaults. The location is dependent on the implementation.
This triggered a build failure on TravisCI because the location
of the default Python binary is different to what is in the Docker
container.
Previously the `test-z3` executable was run without arguments which
appears to run no tests. To fix this the `/a` argument is passed
which will run all tests that don't require arguments.
This was noticed in #1159 when @KarenHuang2016 reported a failing
test.
The Linux builds rely on Docker (using Ubuntu 16.04LTS and Ubuntu
14.04LTS) to build and test Z3 so that builds are easily reproducible.
A build status button has been added to `README.md` so that it is
easy to see the current build status.
More documentation can be found in `contrib/ci/README.md`.
This implementation currently tests 13 different configurations. If
build times become too long we can remove some of them.
Although it would be nice to test macOS builds that requires
significantly more work so I have left this as future work.
print a warning.
Now that the CMake files have been moved into their intended location
it is no longer necessary for this script to exist.
However we do not want to break out-of-tree scripts that build Z3 using
CMake to suddenly break. So the script has been modified to do nothing
except print a warning.
Eventually we should remove this script.
`contrib/cmake/bootstrap.py` script no longer needs to be executed.
The previous location of the CMake files was a compromise proposed
by @agurfinkel in #461. While this has served us well (allowing progress
to be made) over time limitations of this approach have appeared.
The main problem is that doing many git operations (e.g. pull, rebase)
means the CMake files don't get updated unless the user remembers to
run the script. This can lead to broken and confusing build system
behaviour.
This commit only does the file moving and necessary changes to
`.gitignore`. Other changes will be done in subsequent commits.
This breaks the `clean` rule when using Ninja as the CMake
generator. Unfortunately this means `clean` doesn't try to
remove the generated documentation anymore when using Ninja.
before 4cc2b292c0.
It's useful to be able to control the defaults and CMake's internal
logic for GCC/Clang is simple enough that doing this makes sense.
It would be nice to do the same for MSVC but CMake's internal
logic is more complicated so for now it's better that we just use
CMake's default.
compiler defines and flags when using MSVC.
There are lots of defines and flags that I'm unsure about so in
some cases I've changed the behaviour slightly (if I'm confident
the behaviour in the old build system is wrong) or not added the
flag/define at all but just left comments noting what the old build
system did and why I disagree with the old build system's choices.
This analogous to the `--optimize` flag in the Python/Makefile
build system except that we now support doing LTO with Clang/GCC
as well. However it is probably best to avoid doing LTO with
Clang or GCC for now because I see a bunch of warnings about
ODR violations when building with LTO.
LTO can be enabled with the new `LINK_TIME_OPTIMIZATION` option
which is off by default.
using MSVC. This is set by the old build system but we weren't setting
it. This actually MSVC's default but in an effort to try to behave
more like the old build system we will set it anyway.
The setting of overrides was broken (the CXX flags were not set but
the C flags were) and we aren't even using the C compiler any more.
The C compiler is used by the example C project but that is built
as an external project now so we don't need C support anymore.
The setting of defaults was also very fragile. CMake has quite
complicated support here (e.g. MSVC with a clang based tool chain) which
would likely not work properly with the override approach as it existed.
This means we loose some of the custom linker flags we were setting for
MSVC but we were never doing a great job of replicating the exact set of
flags used in the old build system anyway. Subsequent commits will
gradually fix this.
and install them. The target for building the documentation is
`api_docs`.
This is off by default but can be enabled with the
`BUILD_DOCUMENTATION` option. The C and C++ API documentation
is always built but the Python, ".NET", and Java documentation are
only built if they are enabled in the build system. The rationale
for this is that it would be confusing to install documentation
for API bindings that are not installed.
By default `ALWAYS_BUILD_DOCS` is on which will slow down builds
significantly but will ensure that when the `install` target is
invoked the documentation is up-to-date. Unfortunately I couldn't
find a better way to do this. `ALWAYS_BUILD_DOCS` can be disabled
to get faster builds and still have the `api_docs` target available.
file for the build and install tree.
These files allow users of CMake to use Z3 via a CMake config package.
Clients can do `find_package(Z3 CONFIG)` to get use the package from
their projects.
When generating the files for the install tree we try to generate
the files so that they are relocatable so that it shouldn't matter
if the installed files aren't in the CMAKE_INSTALL_PREFIX when
a user consumes them. As long as the relative locations of the files
aren't changed things should still work.
A new CMake cache variable `CMAKE_INSTALL_Z3_CMAKE_PACKAGE_DIR` has been
added so that the install location of the Z3 CMake package files can be
controlled.
This addresses #915 .
CMake will automatically pick up changes in git's HEAD so that
the necessary code is rebuilt when the build system is invoked.
Two new options `INCLUDE_GIT_HASH` and `INCLUDE_GIT_DESCRIBE` have been
added that enable/disable including the git hash and the output of `git
describe` respectively. By default if the source tree is a git
repository both options are on, otherwise they are false by default.
To support the `Z3GITHASH` macro a different implementation is used from
the old build system. In that build system the define is passed on the
command line. This would not work well for CMake because CMake
conservatively (and correctly) rebuilds *everything* if the flags given
to the compiler change. This would result in the entire project being
rebuilt everytime git's `HEAD` changed. Instead in this implementation
a CMake specific version of `version.h.in` (named `version.h.cmake.in`)
is added that uses the `#cmakedefine` feature of CMake's
`configure_file()` command to define `Z3GITHASH` if it is available and
not define it otherwise. This way only object files that depend on
`version.h` get re-built rather than the whole project.
It is unfortunate that the build systems now have different `version.h`
file templates. However they are very simple and I don't want to
modify how templates are handled in the python/Makefile build system.
`INTERFACE` was the not appropriate usage requirement to use. However
it only caused a problem when USE_LIB_GMP was enabled. With `INTERFACE`
`-lgmp` was not specified on the link line so `libz3.so` did not have a
reference to the library and linking against `libz3.so` by clients
would fail with missing references to symbols in `libgmp`.
We don't install Z3_DOTNET_ASSEMBLY_DLL into the gac. Instead we just copy into
installation directory.
There are several reasons for this:
* We can't install the Z3_DOTNET_ASSEMBLY_DLL into the gac in a portable
way like we can with mono (i.e. the ``-root`` flag).
* It isn't best practice to use ``gacutil.exe``
on Windows to install into the GAC, see
https://msdn.microsoft.com/en-us/library/yf1d93sz(v=vs.110).aspx .
Taking this approach should be sufficient because we can now do
something like this
```
mkdir build
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=<some_path> ../
ninja
mkdir <some_path>
ninja install
```
and then put the contents of <some_path> into a zip file which creates a redistributable zip file for Windows.
and ``Microsoft.Z3.xml`` to the root build directory rather than
``<root_build_directory>/src/api/dotnet``.
This fixes#573 which makes the behaviour consistent with the Python
build system.
using CMake 2.8.12.2. It seems ``install_jar()`` in the version of
``UseJava.cmake`` shipped with that version of CMake doesn't handle
the ``DESTINATION`` argument correctly and treats that as the
installation location so CMake would install to
``/usr/local/DESTINATION`` rather than ``/usr/locale/share``.
the ``.jar`` file is created as ``com.microsoft.z3-4.4.2.0.jar``
and a symlink named ``com.microsoft.z3.jar`` is created which points
to it in the build and install directory.
I'm not entirely happy with some parts of the implementation
* The default locations for installing ``com.microsoft.z3.jar`` and ``libz3java.so``
aren't correct. CMake cache variables have been provided that allow the user to change
where these get installed.
* The name of ``libz3java.so``. It doesn't conform to the Debian
packaging guidelines (https://www.debian.org/doc/packaging-manuals/java-policy/x126.html)
and I have not provided an option to change this.
* The fact that ``SONAME`` and ``VERSION`` are not set on ``libz3java.so``.
These issues should be addressed once we know the correct way to handle
installation.
When using Mono support for installing/uninstalling the bindings
is also implemented. For Windows install/uninstall is not implemented
because the python build system does not implement it and Microsoft's
documentation (https://msdn.microsoft.com/en-us/library/dkkx7f79.aspx)
says that the gacutil should only be used for development and not for
production.
For now a warning is just emitted if ``INSTALL_DOTNET_BINDINGS``
is enabled and the .NET toolchain is native Windows. Someone with
better knowledge of how to correctly install assemblies under Windows
should implement this or remove this message.
A notable difference from the Python build system is the
``/linkresource:`` flag is not passed to the C# compiler. This means
a user of the .NET bindings will have to copy the Z3 library (i.e.
``libz3.dll``) to their application directory manually. The reason
for this difference is that using this flag requires the working
directory to be the directory containing the Z3 library (i.e.
``libz3.dll``) but setting this up with multi-configuration generators
doesn't currently seem possible.