Adding required stuff for static compilation

This commit is contained in:
Mate Soos 2022-06-30 03:22:04 +08:00 committed by chriseth
parent 1e9206e01a
commit 2d8adb7651
5 changed files with 16 additions and 9 deletions

View File

@ -35,6 +35,14 @@ endif()
option(SOLC_LINK_STATIC "Link solc executable statically on supported platforms" OFF)
option(SOLC_STATIC_STDLIBS "Link solc against static versions of libgcc and libstdc++ on supported platforms" OFF)
option(STRICT_Z3_VERSION "Use the latest version of Z3" ON)
option(STATICCOMPILE "Compile to static executable" OFF)
if (STATICCOMPILE)
set(BUILD_SHARED_LIBS OFF)
set(Boost_USE_STATIC_LIBS ON)
set(SOLC_STATIC_STDLIBS ON)
set(SOLC_LINK_STATIC ON)
set(CMAKE_EXE_LINKER_FLAGS "-static")
endif()
# Setup cccache.
include(EthCcache)

View File

@ -37,15 +37,15 @@ if (${USE_Z3_DLOPEN})
endif()
add_library(smtutil ${sources} ${z3_SRCS} ${cvc4_SRCS})
target_link_libraries(smtutil PUBLIC solutil Boost::boost)
target_link_libraries(smtutil LINK_PUBLIC solutil Boost::boost)
if (${USE_Z3_DLOPEN})
target_include_directories(smtutil PUBLIC ${Z3_HEADER_PATH})
target_link_libraries(smtutil PUBLIC ${CMAKE_DL_LIBS})
target_include_directories(smtutil LINK_PUBLIC ${Z3_HEADER_PATH})
target_link_libraries(smtutil LINK_PUBLIC ${CMAKE_DL_LIBS})
elseif (${Z3_FOUND})
target_link_libraries(smtutil PUBLIC z3::libz3)
target_link_libraries(smtutil LINK_PUBLIC z3::libz3)
endif()
if (${CVC4_FOUND})
target_link_libraries(smtutil PUBLIC CVC4::CVC4)
target_link_libraries(smtutil LINK_PUBLIC CVC4::CVC4)
endif()

View File

@ -175,4 +175,4 @@ set(sources
)
add_library(solidity ${sources})
target_link_libraries(solidity PUBLIC yul evmasm langutil smtutil solutil Boost::boost fmt::fmt-header-only)
target_link_libraries(solidity LINK_PUBLIC yul evmasm langutil smtutil solutil Boost::boost fmt::fmt-header-only)

View File

@ -223,4 +223,4 @@ add_library(yul
optimiser/VarNameCleaner.h
)
target_link_libraries(yul PUBLIC evmasm solutil langutil smtutil fmt::fmt-header-only)
target_link_libraries(yul LINK_PUBLIC evmasm solutil langutil smtutil fmt::fmt-header-only)

View File

@ -50,9 +50,8 @@ target_link_libraries(yul-phaser PRIVATE phaser)
install(TARGETS yul-phaser DESTINATION "${CMAKE_INSTALL_BINDIR}")
add_executable(satsolver satsolver-main.cpp)
target_link_libraries(satsolver PUBLIC solidity range-v3 Boost::boost Boost::program_options)
add_executable(solsmt solsmt.cpp)
target_link_libraries(solsmt PRIVATE smtutil solutil range-v3 Boost::boost Boost::program_options)
target_link_libraries(solsmt LINK_PRIVATE smtutil solutil range-v3 Boost::boost Boost::program_options)