3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-26 04:56:03 +00:00

Fix Julia bindings linker errors on Windows MSVC

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-08-18 01:12:58 +00:00
parent ba50899782
commit 3ec4dbd65d

View file

@ -1,5 +1,32 @@
find_package(JlCxx REQUIRED) find_package(JlCxx REQUIRED)
# Check for Windows MSVC + MinGW library compatibility issues
if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Get the JlCxx library path to check its format
get_target_property(JLCXX_LIB_PATH JlCxx::cxxwrap_julia IMPORTED_LOCATION)
if(NOT JLCXX_LIB_PATH)
get_target_property(JLCXX_LIB_PATH JlCxx::cxxwrap_julia IMPORTED_LOCATION_RELEASE)
endif()
if(NOT JLCXX_LIB_PATH)
get_target_property(JLCXX_LIB_PATH JlCxx::cxxwrap_julia IMPORTED_IMPLIB)
endif()
if(NOT JLCXX_LIB_PATH)
get_target_property(JLCXX_LIB_PATH JlCxx::cxxwrap_julia IMPORTED_IMPLIB_RELEASE)
endif()
if(JLCXX_LIB_PATH AND JLCXX_LIB_PATH MATCHES "\\.dll\\.a$")
message(FATAL_ERROR
"Julia bindings build error: Incompatible CxxWrap library format detected.\n"
"The found libcxxwrap_julia library (${JLCXX_LIB_PATH}) is a MinGW import library (.dll.a), "
"but Z3 is being built with MSVC which requires .lib format.\n\n"
"Solutions:\n"
"1. Use MinGW/GCC instead of MSVC to build Z3\n"
"2. Install a MSVC-compatible version of CxxWrap\n"
"3. Disable Julia bindings with -DZ3_BUILD_JULIA_BINDINGS=OFF\n\n"
"For more information, see: https://github.com/JuliaInterop/CxxWrap.jl#compiling-the-c-code")
endif()
endif()
add_library(z3jl SHARED z3jl.cpp) add_library(z3jl SHARED z3jl.cpp)
target_link_libraries(z3jl PRIVATE JlCxx::cxxwrap_julia libz3) target_link_libraries(z3jl PRIVATE JlCxx::cxxwrap_julia libz3)
target_include_directories(z3jl PRIVATE target_include_directories(z3jl PRIVATE