-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GMP and Bitwuzla with ASan + UBSan support.
- Loading branch information
Showing
4 changed files
with
88 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
if(GMP_FOUND) | ||
return() | ||
endif() | ||
|
||
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) | ||
|
||
find_library(GMP_LIBRARY gmp PATHS "${PACKAGE_PREFIX_DIR}/lib" NO_CACHE REQUIRED NO_DEFAULT_PATH) | ||
add_library(GMP::GMP STATIC IMPORTED) | ||
set_target_properties(GMP::GMP PROPERTIES | ||
IMPORTED_CONFIGURATIONS "NOCONFIG" | ||
IMPORTED_LOCATION_NOCONFIG "${GMP_LIBRARY}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${PACKAGE_PREFIX_DIR}/include" | ||
) | ||
|
||
find_library(GMP_LIBRARY gmpxx PATHS "${PACKAGE_PREFIX_DIR}/lib" NO_CACHE REQUIRED NO_DEFAULT_PATH) | ||
add_library(GMP::GMPXX STATIC IMPORTED) | ||
set_target_properties(GMP::GMPXX PROPERTIES | ||
IMPORTED_CONFIGURATIONS "NOCONFIG" | ||
IMPORTED_LOCATION_NOCONFIG "${GMP_LIBRARY}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${PACKAGE_PREFIX_DIR}/include" | ||
) | ||
|
||
set(GMP_FOUND ON) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# TODO: pass compiler flags | ||
|
||
set(DEFAULT_C_CXX_FLAGS "-pedantic") | ||
|
||
if(CMAKE_OSX_SYSROOT) | ||
set(DEFAULT_C_CXX_FLAGS "${DEFAULT_C_CXX_FLAGS} -isysroot ${CMAKE_OSX_SYSROOT}") | ||
endif() | ||
|
||
set(CONFIGURE_ARGS | ||
"--enable-cxx" | ||
"--prefix" | ||
"${CMAKE_INSTALL_PREFIX}" | ||
"CC=${CMAKE_C_COMPILER}" | ||
"CXX=${CMAKE_CXX_COMPILER}" | ||
"CFLAGS=${CMAKE_C_FLAGS} ${DEFAULT_C_CXX_FLAGS}" | ||
"CXXFLAGS=${CMAKE_CXX_FLAGS} ${DEFAULT_C_CXX_FLAGS}" | ||
"LDFLAGS=${CMAKE_EXE_LINKER_FLAGS}" | ||
) | ||
|
||
if(BUILD_SHARED_LIBS) | ||
list(APPEND CONFIGURE_ARGS "--enable-shared=yes --enable-static=no") | ||
else() | ||
list(APPEND CONFIGURE_ARGS "--enable-shared=no --enable-static=yes") | ||
endif() | ||
|
||
ExternalProject_Add(gmp | ||
URL | ||
https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz | ||
URL_MD5 | ||
956dc04e864001a9c22429f761f2c283 | ||
CMAKE_CACHE_ARGS | ||
${CMAKE_ARGS} | ||
CONFIGURE_COMMAND | ||
"<SOURCE_DIR>/configure" ${CONFIGURE_ARGS} | ||
BUILD_COMMAND | ||
"make" | ||
INSTALL_COMMAND | ||
"make" "install" | ||
PREFIX | ||
gmp-prefix | ||
) | ||
|
||
# TODO: generate GMPVersion.cmake as well file | ||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/GMPConfig.cmake.in" "${CMAKE_INSTALL_PREFIX}/lib/cmake/gmp/GMPConfig.cmake" @ONLY) |