Skip to content

Commit

Permalink
Add Bitwuzla library
Browse files Browse the repository at this point in the history
  • Loading branch information
fvrmatteo committed Oct 30, 2024
1 parent 63dfa47 commit f380ed3
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
39 changes: 39 additions & 0 deletions BITWUZLAConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
if(BITWUZLA_FOUND)
return()
endif()

get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)

find_library(BITWUZLA_LIBRARY bitwuzla PATHS "${PACKAGE_PREFIX_DIR}/lib" NO_CACHE REQUIRED NO_DEFAULT_PATH)
add_library(BITWUZLA::BITWUZLA STATIC IMPORTED)
set_target_properties(BITWUZLA::BITWUZLA PROPERTIES
IMPORTED_CONFIGURATIONS "NOCONFIG"
IMPORTED_LOCATION_NOCONFIG "${BITWUZLA_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${PACKAGE_PREFIX_DIR}/include"
)

find_library(BITWUZLABB_LIBRARY bitwuzlabb PATHS "${PACKAGE_PREFIX_DIR}/lib" NO_CACHE REQUIRED NO_DEFAULT_PATH)
add_library(BITWUZLA::BITWUZLABB STATIC IMPORTED)
set_target_properties(BITWUZLA::BITWUZLABB PROPERTIES
IMPORTED_CONFIGURATIONS "NOCONFIG"
IMPORTED_LOCATION_NOCONFIG "${BITWUZLABB_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${PACKAGE_PREFIX_DIR}/include"
)

find_library(BITWUZLABV_LIBRARY bitwuzlabv PATHS "${PACKAGE_PREFIX_DIR}/lib" NO_CACHE REQUIRED NO_DEFAULT_PATH)
add_library(BITWUZLA::BITWUZLABV STATIC IMPORTED)
set_target_properties(BITWUZLA::BITWUZLABV PROPERTIES
IMPORTED_CONFIGURATIONS "NOCONFIG"
IMPORTED_LOCATION_NOCONFIG "${BITWUZLABV_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${PACKAGE_PREFIX_DIR}/include"
)

find_library(BITWUZLALS_LIBRARY bitwuzlals PATHS "${PACKAGE_PREFIX_DIR}/lib" NO_CACHE REQUIRED NO_DEFAULT_PATH)
add_library(BITWUZLA::BITWUZLALS STATIC IMPORTED)
set_target_properties(BITWUZLA::BITWUZLALS PROPERTIES
IMPORTED_CONFIGURATIONS "NOCONFIG"
IMPORTED_LOCATION_NOCONFIG "${BITWUZLALS_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${PACKAGE_PREFIX_DIR}/include"
)

set(BITWUZLA_FOUND ON)
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ simple_git(https://github.com/stp/stp a9bc247d98cd98213b2d0f6821dc51b823c50483
"-DSTATICCOMPILE:STRING=ON"
)
include(xed.cmake)
include(bitwuzla.cmake)
if(NOT USE_SYSTEM_LLVM)
include(llvm.cmake)
endif()
Expand Down
42 changes: 42 additions & 0 deletions bitwuzla.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
find_package(Python3 COMPONENTS Interpreter REQUIRED)
message(STATUS "Python3: ${Python3_EXECUTABLE}")

# TODO: pass compiler flags

set(CONFIGURE_ARGS
"--prefix"
"<SOURCE_DIR>/install"
"release"
)

if(BUILD_SHARED_LIBS)
list(APPEND CONFIGURE_ARGS "--shared")
else()
list(APPEND CONFIGURE_ARGS "--static")
endif()

ExternalProject_Add(bitwuzla
GIT_REPOSITORY
"https://github.com/bitwuzla/bitwuzla"
GIT_TAG
"0.6.0"
GIT_PROGRESS
ON
GIT_SHALLOW
ON
CMAKE_CACHE_ARGS
${CMAKE_ARGS}
BUILD_IN_SOURCE
1
CONFIGURE_COMMAND
"${Python3_EXECUTABLE}" "<SOURCE_DIR>/configure.py" ${CONFIGURE_ARGS}
BUILD_COMMAND
"ninja" "-C" "<SOURCE_DIR>/build" "install"
INSTALL_COMMAND
"${CMAKE_COMMAND}" -E copy_directory <SOURCE_DIR>/install "${CMAKE_INSTALL_PREFIX}"
PREFIX
bitwuzla-prefix
)

# TODO: generate BITWUZLAVersion.cmake as well file
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/BITWUZLAConfig.cmake.in" "${CMAKE_INSTALL_PREFIX}/lib/cmake/bitwuzla/BITWUZLAConfig.cmake" @ONLY)

0 comments on commit f380ed3

Please sign in to comment.