3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00
Commit graph

5303 commits

Author SHA1 Message Date
Dan Liew
beb21126e2 Move where the Z3 API header files to be scanned by the Python scripts
is declared out of ``src/api/CMakeLists.txt`` and into
``src/CMakeLists.txt``. We will need this list to generate the
``api_dll.def`` module definition file for MSVC. Whilst I'm here
also fix a stray use of ``USES_TERMINAL`` in ``add_custom_command()``.
2016-03-04 15:26:09 +00:00
Dan Liew
46ac368f86 Refactor `mk_def_file()` so that it is usable externally via a new
function ``mk_def_file_internal()`` which is called by a
new ``mk_def_file.py`` script. This will allow other build systems to
generate the ``api_dll.def`` file.
2016-03-04 15:26:09 +00:00
Dan Liew
ce54f6d957 Fix racing MSVC CMake build. The `libz3` target must have a different
OUTPUT_NAME than the ``shell`` target to avoid conflicting file names.
2016-03-04 15:26:09 +00:00
Dan Liew
246a105006 Force incremental linking to be off for MSVC. Whilst I'm here copy
the stacksize flag used in the Python building system.

This was an effort to try and stop the Visual Studio build from emitting
the error message

```
70>LINK : fatal error LNK1104: cannot open file
'C:\Users\dan\dev\z3-1\build_console\Debug\z3.ilk'
```

Unfortunately this has not fixed the issue.
2016-03-04 15:26:09 +00:00
Dan Liew
ca6c41e411 Don't append ${OpenMP_CXX_FLAGS} to Z3_DEPENDENT_LIBS. This is wrong
because this is passed to ``target_link_libraries()``. It just so
happens that ``target_link_libraries()`` will interpret arguments
starting with a dash as a flag to pass to the linker (i.e. in this
case ``-fopenmp``). However in the case of MSVC that flag is ``/openmp``
which is the interpreted as a file path which will lead to a linker
failure later because the linker can't find the file ``\openmp.obj``.
2016-03-04 15:26:09 +00:00
Dan Liew
7ac9172600 Fix CMake configure under CMake 3.1 with MSVC under Windows. 2016-03-04 15:26:09 +00:00
Dan Liew
e8a9209577 Add sanity check to make sure in-source CMake builds are disallowed. 2016-03-04 15:26:09 +00:00
Dan Liew
32e51eda2e Only CMake >= 3.2 supports the `USES_TERMINAL` argument to
add_custom_command()
2016-03-04 15:26:09 +00:00
Dan Liew
9f5f8f128f CMake 2.8.12 doesn't support the `continue()` command. 2016-03-04 15:26:09 +00:00
Dan Liew
e1584cc9c7 CMake 2.8.12 does not support the `LANGUAGES` argument. 2016-03-04 15:26:09 +00:00
Dan Liew
251527603d Implement a CMake build system.
This is a large rework of my first attempt at this (#459).

This implementation calls into the recently implemented python scripts
to generate the necessary generated ``.h`` and ``.cpp`` files but is
independent from Python building system otherwise.  Unlike the Python
build system, the generated files are emitted into the build tree to
avoid polluting the source tree. The build system is setup to refuse to
configure if it detects generated files in the source tree. If your
source tree is dirty you can run ``git clean -fx`` to clean your working
directory.

Currently the build succeeds on Linux using CMake 3.4.3 using
the "Unix Makefiles" generator with gcc or clang.

The following notable features are implemented:

* Building of the C and C++ examples and the ``test-z3`` executable.
  These are included from the ``all`` target so you have to tell the
  build system (e.g. make) to build them manually.

* Install (``make install``) and uninstall (``make uninstall``) of libz3
  and its header files. This supports ``DESTDIR`` out of the box because
  CMake supports it.

* An option (``BUILD_LIBZ3_SHARED``) to build libz3 as a static or dynamic library.

* Support for using/not using OpenMP (``USE_OPENMP``)

* Support for using/not using libgmp (``USE_LIB_GMP``)

* Setting the SOVERSION for libz3. I'm not sure if I'm setting the
* number correctly though. This is required by Linux distrubtions that
  wills ship libz3. This needs discussion.

The following notable features are currently not implemented
and are left for future work.

* Support for ARM.
* Support for the foci2 library.
* Support for creating/installing/uninstalling the dotnet, java, python and ml
  bindings.
* Full support for MSVC. Although I've tried to write the CMake code
  with MSVC in mind not all the correct flags are passed to it.
* Support for using the git hash.

This new build system has several advantages other the old build system.

* It is easier for outside contributors to contribute to Z3 when the
  build system is something more standard.
* Incremental builds work properly. With the old build system when
  new code is pulled down the old build directory would need to thrown
  out and a new fresh build had to be performed because the build system
  didn't know how to correctly rebuild the project (e.g. couldn't handle
  new sources being added/removed, compiler flags changing, generated
  files changing, etc...). This is a MASSIVE boost to productivity!
* We now have access rich array of features that CMake provides for
  building C/C++ projects. This means less time spent implementing
  custom build system logic in Python that is already supported by
  CMake.
* CMake supports many IDEs out of the box so it should be fairly
  straight forward to build Z3 with Visual Studio (once support for MSVC
  is added), Xcode, Eclipse CDT, CLion, ..etc.
2016-03-04 15:26:09 +00:00
Dan Liew
db34baa979 Partially refactor the code in `update_api.py` so that it can
be used as a script for other build systems and is callable via
a new ``generate_files()`` function from ``mk_util.py``. This removes
the horrible ``_execfile()`` hack that was previously in ``mk_util.py``.

Unfortunately lots of bad code is still in ``update_api.py`` but
fixing all of its problems is too much work right now.
2016-03-04 15:26:09 +00:00
Dan Liew
2b3fe3d02c Refactor `mk_gparams_register_modules()` so that it is usable externally via a new
function ``mk_gparams_register_modules_internal()`` which is called by a
new ``mk_gparams_register_modules_cpp.py`` script. This will allow other build systems to
generate the ``gparams_register_modules.cpp`` files.
2016-03-04 15:22:00 +00:00
Dan Liew
2f7f022605 Refactor `mk_mem_initializer_cpp()` so that it is usable externally via a new
function ``mk_mem_initializer_cpp_internal()`` which is called by a
new ``mk_mem_initializer_cpp.py`` script. This will allow other build systems to
generate the ``mem_initializer.cpp`` files.
2016-03-04 15:22:00 +00:00
Dan Liew
a13438818f Refactor `mk_install_tactic_cpp()` so that it is usable externally via a new
function ``mk_install_tactic_cpp_internal()`` which is called by a
new ``mk_install_tactic_cpp.py`` script. This will allow other build systems to
generate the ``install_tactic.cpp`` files.
2016-03-04 15:22:00 +00:00
Dan Liew
ef58179462 Refactor `mk_pat_db()` so that it is usable externally via a new function
``mk_pat_db_internal()`` which is called by a new ``mk_pat_db.py`` script. This
will allow other build systems to generate the ``database.h`` file.
2016-03-04 15:22:00 +00:00
Dan Liew
9558dc14fb Refactor `exec_pyg_scripts()` so that it is usable externally
via a new ``pyg2hpp.py`` script. This will allow other build systems to
take ``pyg`` files and generate the corresponding ``hpp`` files.
2016-03-04 15:22:00 +00:00
Christoph M. Wintersteiger
c9a5676346 Merge branch 'master' of https://github.com/Z3Prover/z3 into new-ml-api 2016-03-04 15:15:16 +00:00
Christoph M. Wintersteiger
cf5910e041 typos 2016-03-04 15:08:03 +00:00
Christoph M. Wintersteiger
bfd836e911 Merge branch 'master' of https://github.com/Z3Prover/z3 into new-ml-api 2016-03-04 14:49:41 +00:00
Christoph M. Wintersteiger
a51201298c Bugfix for assumptions in inc_sat_solver 2016-03-04 14:42:38 +00:00
Christoph M. Wintersteiger
b2eb5b7170 Merge branch 'master' of https://github.com/Z3Prover/z3 2016-03-04 13:09:50 +00:00
Christoph M. Wintersteiger
8cc3ba5a8b fixed FP Python doctest examples 2016-03-04 13:09:42 +00:00
Christoph M. Wintersteiger
bd73bd9177 Merge branch 'master' of https://github.com/Z3Prover/z3 into new-ml-api 2016-03-03 17:11:58 +00:00
Nikolaj Bjorner
6fef24edb4 recursive function definitions; combine model-building functionality
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2016-03-03 08:07:06 -08:00
Nikolaj Bjorner
50b2389e7f Merge branch 'master' of https://github.com/Z3Prover/z3 2016-03-03 07:59:13 -08:00
Nikolaj Bjorner
7c6540e18f recursive function definitions; combine model-building functionality
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2016-03-03 07:59:03 -08:00
Christoph M. Wintersteiger
1aeea763ff Assertion fix in inc_sat_solver 2016-03-02 18:39:28 +00:00
Christoph M. Wintersteiger
e79960b253 Merge branch 'master' of https://github.com/Z3Prover/z3 into new-ml-api 2016-03-02 18:27:30 +00:00
Christoph M. Wintersteiger
bf40bb8005 Bugfix for inc_sat_solver 2016-03-02 18:27:01 +00:00
Christoph M. Wintersteiger
68416bf6bc whitespace 2016-03-02 18:25:56 +00:00
Christoph M. Wintersteiger
bddf416064 Merge branch 'master' of https://github.com/Z3Prover/z3 2016-03-02 18:06:22 +00:00
Christoph M. Wintersteiger
dbf9609b4c added assertion 2016-03-02 18:06:14 +00:00
Christoph M. Wintersteiger
f128c76f23 whitespace 2016-03-02 18:05:14 +00:00
Christoph M. Wintersteiger
b27977ea90 Merge branch 'master' of https://github.com/Z3Prover/z3 into new-ml-api 2016-03-02 15:14:12 +00:00
Christoph M. Wintersteiger
6fa2338edc Merge pull request #471 from 4tXJ7f/patch-1
[Z3py] Fix documentation in FPSortRef
2016-03-02 14:14:54 +00:00
Nikolaj Bjorner
1a081936ac Merge branch 'master' of https://github.com/Z3Prover/z3 2016-03-01 22:31:53 -08:00
Nikolaj Bjorner
a25336a899 fix test build, working on rec-functions and automata complementation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2016-03-01 22:31:44 -08:00
Andres Nötzli
18b9cd1948 [Z3py] Fix documentation in FPSortRef 2016-03-01 18:56:20 -08:00
Christoph M. Wintersteiger
1e86175c03 Merge branch 'master' of https://github.com/Z3Prover/z3 2016-03-01 21:21:32 +00:00
Christoph M. Wintersteiger
59e695f2be Bugfixes for FP numerals in Python
Relates to #464, #470
2016-03-01 21:21:25 +00:00
Nikolaj Bjorner
9b6963d112 Merge branch 'master' of https://github.com/Z3Prover/z3 2016-03-01 09:48:53 -08:00
Nikolaj Bjorner
67397bf71e enable logic parameter update to configure SMTLIB logic
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2016-03-01 09:48:24 -08:00
Christoph M. Wintersteiger
0cb8193cdd logic fix 2016-03-01 17:42:33 +00:00
Christoph M. Wintersteiger
4fe4db6657 build fix for static libray on Windows 2016-03-01 17:34:45 +00:00
Nikolaj Bjorner
7f51ecab37 enable logic parameter update to configure SMTLIB logic
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2016-03-01 09:26:14 -08:00
Nikolaj Bjorner
31c58b0999 Merge branch 'master' of https://github.com/Z3Prover/z3 2016-03-01 08:46:51 -08:00
Nikolaj Bjorner
908f09a9df update logic
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2016-03-01 08:46:43 -08:00
Christoph M. Wintersteiger
c171170bed Fixed FP string input conversions.
Fixes #464
2016-03-01 15:31:33 +00:00
Christoph M. Wintersteiger
b6e43b6d7b Merge pull request #468 from 4tXJ7f/fix_fp_neq
[Z3py] Consistent behavior of eq and ne for FP
2016-03-01 14:07:28 +00:00