Skip to content

Commit

Permalink
rename additional build options #2709
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
  • Loading branch information
NikolajBjorner committed Nov 19, 2019
1 parent 48554f0 commit 53a01a0
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 102 deletions.
22 changes: 11 additions & 11 deletions README-CMake.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,18 +242,18 @@ The following useful options can be passed to CMake whilst configuring.
* ``CMAKE_INSTALL_Z3_CMAKE_PACKAGE_DIR`` - STRING. The path to install CMake package files (e.g. ``/usr/lib/cmake/z3``).
* ``CMAKE_INSTALL_API_BINDINGS_DOC`` - STRING. The path to install documentation for API bindings.
* ``Z3_ENABLE_TRACING_FOR_NON_DEBUG`` - BOOL. If set to ``TRUE`` enable tracing in non-debug builds, if set to ``FALSE`` disable tracing in non-debug builds. Note in debug builds tracing is always enabled.
* ``BUILD_LIBZ3_SHARED`` - BOOL. If set to ``TRUE`` build libz3 as a shared library otherwise build as a static library.
* ``Z3_BUILD_LIBZ3_SHARED`` - BOOL. If set to ``TRUE`` build libz3 as a shared library otherwise build as a static library.
* ``Z3_ENABLE_EXAMPLE_TARGETS`` - BOOL. If set to ``TRUE`` add the build targets for building the API examples.
* ``Z3_USE_LIB_GMP`` - BOOL. If set to ``TRUE`` use the GNU multiple precision library. If set to ``FALSE`` use an internal implementation.
* ``PYTHON_EXECUTABLE`` - STRING. The python executable to use during the build.
* ``BUILD_PYTHON_BINDINGS`` - BOOL. If set to ``TRUE`` then Z3's python bindings will be built.
* ``INSTALL_PYTHON_BINDINGS`` - BOOL. If set to ``TRUE`` and ``BUILD_PYTHON_BINDINGS`` is ``TRUE`` then running the ``install`` target will install Z3's Python bindings.
* ``BUILD_DOTNET_BINDINGS`` - BOOL. If set to ``TRUE`` then Z3's .NET bindings will be built.
* ``INSTALL_DOTNET_BINDINGS`` - BOOL. If set to ``TRUE`` and ``BUILD_DOTNET_BINDINGS`` is ``TRUE`` then running the ``install`` target will install Z3's .NET bindings.
* ``DOTNET_CSC_EXECUTABLE`` - STRING. The path to the C# compiler to use. Only relevant if ``BUILD_DOTNET_BINDINGS`` is set to ``TRUE``.
* ``DOTNET_GACUTIL_EXECUTABLE`` - STRING. The path to the gacutil program to use. Only relevant if ``BUILD_DOTNET_BINDINGS`` is set to ``TRUE``.
* ``BUILD_JAVA_BINDINGS`` - BOOL. If set to ``TRUE`` then Z3's Java bindings will be built.
* ``INSTALL_JAVA_BINDINGS`` - BOOL. If set to ``TRUE`` and ``BUILD_JAVA_BINDINGS`` is ``TRUE`` then running the ``install`` target will install Z3's Java bindings.
* ``Z3_PYTHON_EXECUTABLE`` - STRING. The python executable to use during the build.
* ``Z3_BUILD_PYTHON_BINDINGS`` - BOOL. If set to ``TRUE`` then Z3's python bindings will be built.
* ``Z3_INSTALL_PYTHON_BINDINGS`` - BOOL. If set to ``TRUE`` and ``BUILD_PYTHON_BINDINGS`` is ``TRUE`` then running the ``install`` target will install Z3's Python bindings.
* ``Z3_BUILD_DOTNET_BINDINGS`` - BOOL. If set to ``TRUE`` then Z3's .NET bindings will be built.
* ``Z3_INSTALL_DOTNET_BINDINGS`` - BOOL. If set to ``TRUE`` and ``BUILD_DOTNET_BINDINGS`` is ``TRUE`` then running the ``install`` target will install Z3's .NET bindings.
* ``Z3_DOTNET_CSC_EXECUTABLE`` - STRING. The path to the C# compiler to use. Only relevant if ``BUILD_DOTNET_BINDINGS`` is set to ``TRUE``.
* ``Z3_DOTNET_GACUTIL_EXECUTABLE`` - STRING. The path to the gacutil program to use. Only relevant if ``BUILD_DOTNET_BINDINGS`` is set to ``TRUE``.
* ``Z3_BUILD_JAVA_BINDINGS`` - BOOL. If set to ``TRUE`` then Z3's Java bindings will be built.
* ``Z3_INSTALL_JAVA_BINDINGS`` - BOOL. If set to ``TRUE`` and ``BUILD_JAVA_BINDINGS`` is ``TRUE`` then running the ``install`` target will install Z3's Java bindings.
* ``Z3_JAVA_JAR_INSTALLDIR`` - STRING. The path to directory to install the Z3 Java ``.jar`` file. This path should be relative to ``CMAKE_INSTALL_PREFIX``.
* ``Z3_JAVA_JNI_LIB_INSTALLDIRR`` - STRING. The path to directory to install the Z3 Java JNI bridge library. This path should be relative to ``CMAKE_INSTALL_PREFIX``.
* ``Z3_INCLUDE_GIT_DESCRIBE`` - BOOL. If set to ``TRUE`` and the source tree of Z3 is a git repository then the output of ``git describe`` will be included in the build.
Expand All @@ -276,7 +276,7 @@ On the command line these can be passed to ``cmake`` using the ``-D`` option. In
Example

```
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_TRACING=FALSE ../
cmake -DCMAKE_BUILD_TYPE=Release -DZ3_ENABLE_TRACING_FOR_NON_DEBUG=FALSE ../
```

Expand Down
58 changes: 0 additions & 58 deletions cmake/modules/FindDotNetToolchain.cmake

This file was deleted.

24 changes: 12 additions & 12 deletions contrib/ci/scripts/build_z3_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,39 +59,39 @@ fi
# Python bindings?
if [ "X${PYTHON_BINDINGS}" = "X1" ]; then
ADDITIONAL_Z3_OPTS+=( \
'-DBUILD_PYTHON_BINDINGS=ON' \
'-DINSTALL_PYTHON_BINDINGS=ON' \
'-DZ3_BUILD_PYTHON_BINDINGS=ON' \
'-DZ3_INSTALL_PYTHON_BINDINGS=ON' \
)
else
ADDITIONAL_Z3_OPTS+=( \
'-DBUILD_PYTHON_BINDINGS=OFF' \
'-DINSTALL_PYTHON_BINDINGS=OFF' \
'-DZ3_BUILD_PYTHON_BINDINGS=OFF' \
'-DZ3_INSTALL_PYTHON_BINDINGS=OFF' \
)
fi

# .NET bindings?
if [ "X${DOTNET_BINDINGS}" = "X1" ]; then
ADDITIONAL_Z3_OPTS+=( \
'-DBUILD_DOTNET_BINDINGS=ON' \
'-DINSTALL_DOTNET_BINDINGS=ON' \
'-DZ3_BUILD_DOTNET_BINDINGS=ON' \
'-DZ3_INSTALL_DOTNET_BINDINGS=ON' \
)
else
ADDITIONAL_Z3_OPTS+=( \
'-DBUILD_DOTNET_BINDINGS=OFF' \
'-DINSTALL_DOTNET_BINDINGS=OFF' \
'-DZ3_BUILD_DOTNET_BINDINGS=OFF' \
'-DZ3_INSTALL_DOTNET_BINDINGS=OFF' \
)
fi

# Java bindings?
if [ "X${JAVA_BINDINGS}" = "X1" ]; then
ADDITIONAL_Z3_OPTS+=( \
'-DBUILD_JAVA_BINDINGS=ON' \
'-DINSTALL_JAVA_BINDINGS=ON' \
'-DZ3_BUILD_JAVA_BINDINGS=ON' \
'-DZ3_INSTALL_JAVA_BINDINGS=ON' \
)
else
ADDITIONAL_Z3_OPTS+=( \
'-DBUILD_JAVA_BINDINGS=OFF' \
'-DINSTALL_JAVA_BINDINGS=OFF' \
'-DZ3_BUILD_JAVA_BINDINGS=OFF' \
'-DZ3_INSTALL_JAVA_BINDINGS=OFF' \
)
fi

Expand Down
26 changes: 13 additions & 13 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ set (object_files "")
foreach (component ${Z3_LIBZ3_COMPONENTS_LIST})
list(APPEND object_files $<TARGET_OBJECTS:${component}>)
endforeach()
if (BUILD_LIBZ3_SHARED)
if (Z3_BUILD_LIBZ3_SHARED)
set(lib_type "SHARED")
else()
set(lib_type "STATIC")
Expand Down Expand Up @@ -220,35 +220,35 @@ add_subdirectory(test)
################################################################################
# Z3 API bindings
################################################################################
option(BUILD_PYTHON_BINDINGS "Build Python bindings for Z3" OFF)
if (BUILD_PYTHON_BINDINGS)
if (NOT BUILD_LIBZ3_SHARED)
option(Z3_BUILD_PYTHON_BINDINGS "Build Python bindings for Z3" OFF)
if (Z3_BUILD_PYTHON_BINDINGS)
if (NOT Z3_BUILD_LIBZ3_SHARED)
message(FATAL_ERROR "The python bindings will not work with a static libz3. "
"You either need to disable BUILD_PYTHON_BINDINGS or enable BUILD_LIBZ3_SHARED")
"You either need to disable Z3_BUILD_PYTHON_BINDINGS or enable Z3_BUILD_LIBZ3_SHARED")
endif()
add_subdirectory(api/python)
endif()

################################################################################
# .NET bindings
################################################################################
option(BUILD_DOTNET_BINDINGS "Build .NET bindings for Z3" OFF)
if (BUILD_DOTNET_BINDINGS)
if (NOT BUILD_LIBZ3_SHARED)
option(Z3_BUILD_DOTNET_BINDINGS "Build .NET bindings for Z3" OFF)
if (Z3_BUILD_DOTNET_BINDINGS)
if (NOT Z3_BUILD_LIBZ3_SHARED)
message(FATAL_ERROR "The .NET bindings will not work with a static libz3. "
"You either need to disable BUILD_DOTNET_BINDINGS or enable BUILD_LIBZ3_SHARED")
"You either need to disable Z3_BUILD_DOTNET_BINDINGS or enable Z3_BUILD_LIBZ3_SHARED")
endif()
add_subdirectory(api/dotnet)
endif()

################################################################################
# Java bindings
################################################################################
option(BUILD_JAVA_BINDINGS "Build Java bindings for Z3" OFF)
if (BUILD_JAVA_BINDINGS)
if (NOT BUILD_LIBZ3_SHARED)
option(Z3_BUILD_JAVA_BINDINGS "Build Java bindings for Z3" OFF)
if (Z3_BUILD_JAVA_BINDINGS)
if (NOT Z3_BUILD_LIBZ3_SHARED)
message(FATAL_ERROR "The Java bindings will not work with a static libz3. "
"You either need to disable BUILD_JAVA_BINDINGS or enable BUILD_LIBZ3_SHARED")
"You either need to disable Z3_BUILD_JAVA_BINDINGS or enable Z3_BUILD_LIBZ3_SHARED")
endif()
add_subdirectory(api/java)
endif()
Expand Down
4 changes: 2 additions & 2 deletions src/api/dotnet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ DOTNET_REGISTER_LOCAL_REPOSITORY(${Z3_DOTNET_LOCALREPO_NAME} ${PROJECT_BINARY_DI
# the build step depends on the 'purge' target, making sure that
# a user will always restore the freshly-built package.
###############################################################################
option(INSTALL_DOTNET_BINDINGS "Install .NET bindings when invoking install target" ON)
option(Z3_INSTALL_DOTNET_BINDINGS "Install .NET bindings when invoking install target" ON)

if(INSTALL_DOTNET_BINDINGS)
if(Z3_INSTALL_DOTNET_BINDINGS)
install(FILES "${PROJECT_BINARY_DIR}/Microsoft.Z3/Microsoft.Z3.${Z3_DOTNET_NUPKG_VERSION}.nupkg" DESTINATION "${CMAKE_INSTALL_LIBDIR}/z3.nuget")
# move the local repo to the installation directory (cancel the build-time repo)
install(CODE "include(${CMAKE_CURRENT_LIST_DIR}/../../../cmake/modules/FindDotnet.cmake)\n DOTNET_REGISTER_LOCAL_REPOSITORY(\"${Z3_DOTNET_LOCALREPO_NAME}\" \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/z3.nuget\")")
Expand Down
2 changes: 1 addition & 1 deletion src/api/dotnet/cmake_install_gac.cmake.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Install assembly to the GAC
set(GAC_ROOT "$ENV{DESTDIR}@CMAKE_INSTALL_FULL_LIBDIR@")
execute_process(COMMAND
"@DOTNET_GACUTIL_EXECUTABLE@"
"@Z3_DOTNET_GACUTIL_EXECUTABLE@"
"-i"
"@Z3_DOTNET_ASSEMBLY_DLL@"
"-f"
Expand Down
2 changes: 1 addition & 1 deletion src/api/dotnet/cmake_uninstall_gac.cmake.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Uninstall assembly from the GAC
set(GAC_ROOT "$ENV{DESTDIR}@CMAKE_INSTALL_FULL_LIBDIR@")
execute_process(COMMAND
"@DOTNET_GACUTIL_EXECUTABLE@"
"@Z3_DOTNET_GACUTIL_EXECUTABLE@"
# Note ``-us`` takes assembly file name rather than
# ``-u`` which takes an assembly display name
"-us"
Expand Down
4 changes: 2 additions & 2 deletions src/api/java/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ add_jar(z3JavaJar
###############################################################################
# Install
###############################################################################
option(INSTALL_JAVA_BINDINGS "Install Java bindings when invoking install target" ON)
if (INSTALL_JAVA_BINDINGS)
option(Z3_INSTALL_JAVA_BINDINGS "Install Java bindings when invoking install target" ON)
if (Z3_INSTALL_JAVA_BINDINGS)
# Provide cache variables for the install locations that the user can change.
# This defaults to ``/usr/local/java`` which seems to be the location for ``.jar``
# files on Linux distributions
Expand Down
4 changes: 2 additions & 2 deletions src/api/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ add_custom_target(build_z3_python_bindings
###############################################################################
# Install
###############################################################################
option(INSTALL_PYTHON_BINDINGS "Install Python bindings when invoking install target" ON)
if (INSTALL_PYTHON_BINDINGS)
option(Z3_INSTALL_PYTHON_BINDINGS "Install Python bindings when invoking install target" ON)
if (Z3_INSTALL_PYTHON_BINDINGS)
message(STATUS "Emitting rules to install Z3 python bindings")
# Try to guess the installation path for the bindings
if (NOT DEFINED CMAKE_INSTALL_PYTHON_PKG_DIR)
Expand Down

0 comments on commit 53a01a0

Please sign in to comment.