mirror of
https://github.com/Z3Prover/z3
synced 2025-04-27 19:05:51 +00:00
[CMake] Implement support for building the .NET bindings.
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.
This commit is contained in:
parent
6a2a8e06d7
commit
20d3bf4d0c
8 changed files with 390 additions and 0 deletions
20
contrib/cmake/src/api/dotnet/cmake_uninstall_gac.cmake.in
Normal file
20
contrib/cmake/src/api/dotnet/cmake_uninstall_gac.cmake.in
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Uninstall assembly from the GAC
|
||||
set(GAC_ROOT "$ENV{DESTDIR}@CMAKE_INSTALL_FULL_LIBDIR@")
|
||||
execute_process(COMMAND
|
||||
"@DOTNET_GACUTIL_EXECUTABLE@"
|
||||
# Note ``-us`` takes assembly file name rather than
|
||||
# ``-u`` which takes an assembly display name
|
||||
"-us"
|
||||
"@Z3_DOTNET_ASSEMBLY_NAME@"
|
||||
"-f"
|
||||
"-package" "@GAC_PKG_NAME@"
|
||||
"-root" "${GAC_ROOT}"
|
||||
WORKING_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@"
|
||||
RESULT_VARIABLE gacutil_exit_code
|
||||
)
|
||||
|
||||
if ("${gacutil_exit_code}" EQUAL 0)
|
||||
message(STATUS "Uninstalled \"@Z3_DOTNET_ASSEMBLY_NAME@\" from the GAC")
|
||||
else()
|
||||
message(FATAL_ERROR "Failed to uninstall \"@Z3_DOTNET_ASSEMBLY_NAME@\" from the GAC")
|
||||
endif()
|
Loading…
Add table
Add a link
Reference in a new issue