From: Gereon Kremer Date: Thu, 28 Oct 2021 19:30:13 +0000 (-0700) Subject: Combine `--static` and `--static-binary` (#7520) X-Git-Tag: cvc5-1.0.0~936 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6fb31c779f91fa22186052224ceb38d48ba41fa9;p=cvc5.git Combine `--static` and `--static-binary` (#7520) This PR combines the two configure flags --static and --static-binary into a single --static. Consequently, the two corresponding cmake variables are combined as well. The two variables have been implying each other for some time now and were only used to build not-completely-static binaries for MacOS, which is now done automatically anyway. --- diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82916f26b..1acc26c5a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: include: - name: ubuntu:production os: ubuntu-latest - config: production --auto-download --all-bindings --editline --docs --static-binary + config: production --auto-download --all-bindings --editline --docs --static cache-key: production python-bindings: true build-documentation: true @@ -19,7 +19,7 @@ jobs: - name: macos:production os: macos-11 - config: production --auto-download --all-bindings --editline --static-binary + config: production --auto-download --all-bindings --editline --static cache-key: production python-bindings: true check-examples: true diff --git a/CMakeLists.txt b/CMakeLists.txt index f5abf6ea6..1afb2cfc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,9 +86,7 @@ cvc5_option(ENABLE_STATISTICS "Enable statistics") cvc5_option(ENABLE_TRACING "Enable tracing") cvc5_option(ENABLE_UNIT_TESTING "Enable unit testing") cvc5_option(ENABLE_VALGRIND "Enable valgrind instrumentation") -cvc5_option(ENABLE_STATIC_LIBRARY "Enable building static library") -cvc5_option(ENABLE_STATIC_BINARY - "Build static binaries with statically linked system libraries") +cvc5_option(ENABLE_STATIC_BUILD "Enable building static libraries and binary") cvc5_option(ENABLE_AUTO_DOWNLOAD "Enable automatic download of dependencies") cvc5_option(ENABLE_IPO "Enable interprocedural optimization") # >> 2-valued: ON OFF @@ -224,18 +222,6 @@ if(ENABLE_IPO) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) endif() - -#-----------------------------------------------------------------------------# -# Option defaults (three-valued options (cvc5_option(...))) -# -# These options are only set if their value is IGNORE. Otherwise, the user -# already set the option, which we don't want to overwrite. - -if(ENABLE_STATIC_BINARY) - message(STATUS "Enable static library for static binary build.") - cvc5_set_option(ENABLE_STATIC_LIBRARY ON) -endif() - #-----------------------------------------------------------------------------# # Only enable unit testing if assertions are enabled. Otherwise, unit tests @@ -463,7 +449,7 @@ include(IWYU) #-----------------------------------------------------------------------------# include(ConfigureCvc5) -if(ENABLE_STATIC_BINARY) +if(ENABLE_STATIC_BUILD) set(CVC5_STATIC_BUILD ON) endif() @@ -504,7 +490,7 @@ include(CMakePackageConfigHelpers) # (in the assumption that only reasonably experienced users use this and # also that custom installation prefixes are not used for longer periods of # time anyway). Also, we print a big warning with further instructions. -if(NOT ENABLE_STATIC_BINARY) +if(NOT ENABLE_STATIC_BUILD) # Get the libraries that cvc5 links against get_target_property(libs cvc5-shared INTERFACE_LINK_LIBRARIES) set(LIBS_SHARED_FROM_DEPS "") @@ -615,8 +601,7 @@ print_config("Profiling (gprof) " ${ENABLE_PROFILING}) print_config("Unit tests " ${ENABLE_UNIT_TESTING}) print_config("Valgrind " ${ENABLE_VALGRIND}) message("") -print_config("Static library " ${ENABLE_STATIC_LIBRARY}) -print_config("Static binary " ${ENABLE_STATIC_BINARY}) +print_config("Static build " ${ENABLE_STATIC_BUILD}) print_config("Python bindings " ${BUILD_BINDINGS_PYTHON}) print_config("Java bindings " ${BUILD_BINDINGS_JAVA}) print_config("Python2 " ${USE_PYTHON2}) diff --git a/INSTALL.rst b/INSTALL.rst index 7df21cb4c..8c2b67315 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -33,7 +33,7 @@ dependencies. We also have a Homebrew Tap available at https://github.com/CVC4/homebrew-cvc4 . Note that linking system libraries statically is `strongly discouraged `_ -on macOS. Using ``./configure.sh --static-binary`` will thus produce a binary +on macOS. Using ``./configure.sh --static`` will thus produce a binary that uses static versions of all our dependencies, but is still a dynamically linked binary. @@ -45,7 +45,7 @@ Cross-compiling cvc5 with Mingw-w64 can be done as follows: .. code:: bash - ./configure.sh --win64 --static-binary + ./configure.sh --win64 --static cd # default is ./build make # use -jN for parallel build with N threads @@ -431,6 +431,6 @@ linked LGPL libraries perform the following steps: .. code:: - ./configure.sh --static-binary + ./configure.sh --static 7. Follow remaining steps from `build instructions <#building-cvc5>`_ diff --git a/cmake/ConfigCompetition.cmake b/cmake/ConfigCompetition.cmake index 2b17d8073..e479c15d0 100644 --- a/cmake/ConfigCompetition.cmake +++ b/cmake/ConfigCompetition.cmake @@ -32,7 +32,7 @@ cvc5_set_option(ENABLE_DUMPING OFF) # enable_muzzle=yes cvc5_set_option(ENABLE_MUZZLE ON) # enable_valgrind=no -cvc5_set_option(ENABLE_STATIC_BINARY ON) +cvc5_set_option(ENABLE_STATIC_BUILD ON) cvc5_set_option(ENABLE_UNIT_TESTING OFF) # By default, we include all dependencies in our competition build that are diff --git a/cmake/FindANTLR3.cmake b/cmake/FindANTLR3.cmake index e389e15f0..bc4afda23 100644 --- a/cmake/FindANTLR3.cmake +++ b/cmake/FindANTLR3.cmake @@ -33,7 +33,7 @@ if(ANTLR3_JAR AND ANTLR3_INCLUDE_DIR AND ANTLR3_LIBRARIES) check_system_version("ANTLR3") endif() -if(ENABLE_STATIC_LIBRARY AND ANTLR3_FOUND_SYSTEM) +if(ENABLE_STATIC_BUILD AND ANTLR3_FOUND_SYSTEM) force_static_library() find_library(ANTLR3_STATIC_LIBRARIES NAMES antlr3c) if(NOT ANTLR3_STATIC_LIBRARIES) diff --git a/cmake/FindCLN.cmake b/cmake/FindCLN.cmake index 11bf8ed98..3f83b61e2 100644 --- a/cmake/FindCLN.cmake +++ b/cmake/FindCLN.cmake @@ -33,7 +33,7 @@ if(CLN_INCLUDE_DIR AND CLN_LIBRARIES) check_system_version("CLN") endif() -if(ENABLE_STATIC_LIBRARY AND CLN_FOUND_SYSTEM) +if(ENABLE_STATIC_BUILD AND CLN_FOUND_SYSTEM) force_static_library() find_library(CLN_STATIC_LIBRARIES NAMES cln) if(NOT CLN_STATIC_LIBRARIES) @@ -94,7 +94,7 @@ set_target_properties(CLN_SHARED PROPERTIES target_link_libraries(CLN_SHARED INTERFACE GMP_SHARED) -if(ENABLE_STATIC_LIBRARY) +if(ENABLE_STATIC_BUILD) add_library(CLN_STATIC STATIC IMPORTED GLOBAL) set_target_properties(CLN_STATIC PROPERTIES IMPORTED_LOCATION "${CLN_STATIC_LIBRARIES}" diff --git a/cmake/FindGMP.cmake b/cmake/FindGMP.cmake index 5a849153b..bea0e1bf1 100644 --- a/cmake/FindGMP.cmake +++ b/cmake/FindGMP.cmake @@ -42,7 +42,7 @@ if(GMP_INCLUDE_DIR AND GMP_LIBRARIES) check_system_version("GMP") endif() -if(ENABLE_STATIC_LIBRARY AND GMP_FOUND_SYSTEM) +if(ENABLE_STATIC_BUILD AND GMP_FOUND_SYSTEM) force_static_library() find_library(GMP_STATIC_LIBRARIES NAMES gmp) if(NOT GMP_STATIC_LIBRARIES) @@ -132,7 +132,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") set_target_properties(GMP_SHARED PROPERTIES IMPORTED_IMPLIB "${GMP_LIBRARIES}") endif() -if(ENABLE_STATIC_LIBRARY) +if(ENABLE_STATIC_BUILD) add_library(GMP_STATIC STATIC IMPORTED GLOBAL) set_target_properties(GMP_STATIC PROPERTIES IMPORTED_LOCATION "${GMP_STATIC_LIBRARIES}" @@ -150,7 +150,7 @@ if(GMP_FOUND_SYSTEM) else() message(STATUS "Building GMP ${GMP_VERSION}: ${GMP_LIBRARIES}") add_dependencies(GMP_SHARED GMP-EP) - if(ENABLE_STATIC_LIBRARY) + if(ENABLE_STATIC_BUILD) add_dependencies(GMP_STATIC GMP-EP) endif() endif() diff --git a/cmake/FindPoly.cmake b/cmake/FindPoly.cmake index f363147cc..e19e1c57d 100644 --- a/cmake/FindPoly.cmake +++ b/cmake/FindPoly.cmake @@ -37,7 +37,7 @@ if(Poly_INCLUDE_DIR check_system_version("Poly") endif() -if(ENABLE_STATIC_LIBRARY AND Poly_FOUND_SYSTEM) +if(ENABLE_STATIC_BUILD AND Poly_FOUND_SYSTEM) force_static_library() find_library(Poly_STATIC_LIBRARIES NAMES poly) find_library(PolyXX_STATIC_LIBRARIES NAMES polyxx) @@ -158,7 +158,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") set_target_properties(Polyxx_SHARED PROPERTIES IMPORTED_IMPLIB "${PolyXX_LIBRARIES}") endif() -if(ENABLE_STATIC_LIBRARY) +if(ENABLE_STATIC_BUILD) add_library(Poly_STATIC STATIC IMPORTED GLOBAL) set_target_properties(Poly_STATIC PROPERTIES IMPORTED_LOCATION "${Poly_STATIC_LIBRARIES}" @@ -194,7 +194,7 @@ else() DESTINATION ${CMAKE_INSTALL_LIBDIR} ) - if(ENABLE_STATIC_LIBRARY) + if(ENABLE_STATIC_BUILD) add_dependencies(Poly_STATIC Poly-EP) add_dependencies(Polyxx_STATIC Poly-EP) endif() diff --git a/configure.sh b/configure.sh index a8bf19b79..641be5c18 100755 --- a/configure.sh +++ b/configure.sh @@ -31,8 +31,6 @@ General options; Features: The following flags enable optional features (disable with --no-