Skip to content

Commit

Permalink
only allow static boost
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyMlashkin committed Dec 10, 2024
1 parent 7d03016 commit ea84d0b
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 64 deletions.
3 changes: 1 addition & 2 deletions crypto3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ include(CMSetupVersion)
cm_workspace(crypto3)
cm_setup_version(VERSION 0.3.0 PREFIX ${CMAKE_WORKSPACE_NAME})

option(BUILD_SHARED_LIBS "Build shared library" FALSE) # TODO: it makes no sense for header-only lib, remove
option(Boost_USE_STATIC_LIBS "Use static libraries for Boost" OFF)
option(Boost_USE_STATIC_LIBS "Use static libraries for Boost" ON)
option(BUILD_TESTS "Enable tests" TRUE) # used by CMTest module; If set to false, tests are removed from crypto3::all target. User still can build individual ones.
option(BUILD_CRYPTO3_TESTS "Enable tests" FALSE)
option(BUILD_CRYPTO3_BENCH_TESTS "Build performance benchmark tests" FALSE)
Expand Down
4 changes: 1 addition & 3 deletions crypto3/libs/blueprint/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ macro(define_blueprint_test test)

get_target_property(target_type Boost::unit_test_framework TYPE)
if(target_type STREQUAL "SHARED_LIB")
target_compile_definitions(${full_test_name} PRIVATE BOOST_TEST_DYN_LINK)
elseif(target_type STREQUAL "STATIC_LIB")

message(FATAL_ERROR "Shared lib is not supported")
endif()

target_precompile_headers(${full_test_name} REUSE_FROM crypto3_precompiled_headers)
Expand Down
17 changes: 0 additions & 17 deletions crypto3/libs/marshalling/algebra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,6 @@ if((CMAKE_COMPILER_IS_GNUCC) OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
if(NOT BUILD_SHARED_LIBS AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
endif()
elseif(MSVC)

add_definitions("/wd4503" "/wd4309" "/wd4267" "-D_SCL_SECURE_NO_WARNINGS")

if(NOT BUILD_WITH_NO_WARNINGS)
add_definitions("/WX")
endif()

if(NOT BUILD_SHARED_LIBS)
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif()
endforeach()
endif()
endif()

if(CMAKE_TOOLCHAIN_FILE AND EXISTS ${CMAKE_TOOLCHAIN_FILE})
Expand Down
17 changes: 0 additions & 17 deletions crypto3/libs/marshalling/containers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,6 @@ if((CMAKE_COMPILER_IS_GNUCC) OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
if(NOT BUILD_SHARED_LIBS AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
endif()
elseif(MSVC)

add_definitions("/wd4503" "/wd4309" "/wd4267" "-D_SCL_SECURE_NO_WARNINGS")

if(NOT BUILD_WITH_NO_WARNINGS)
add_definitions("/WX")
endif()

if(NOT BUILD_SHARED_LIBS)
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif()
endforeach()
endif()
endif()

if(CMAKE_TOOLCHAIN_FILE AND EXISTS ${CMAKE_TOOLCHAIN_FILE})
Expand Down
17 changes: 0 additions & 17 deletions crypto3/libs/marshalling/zk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,6 @@ if((CMAKE_COMPILER_IS_GNUCC) OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
if(NOT BUILD_SHARED_LIBS AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
endif()
elseif(MSVC)

add_definitions("/wd4503" "/wd4309" "/wd4267" "-D_SCL_SECURE_NO_WARNINGS")

if(NOT BUILD_WITH_NO_WARNINGS)
add_definitions("/WX")
endif()

if(NOT BUILD_SHARED_LIBS)
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif()
endforeach()
endif()
endif()

if(CMAKE_TOOLCHAIN_FILE AND EXISTS ${CMAKE_TOOLCHAIN_FILE})
Expand Down
5 changes: 0 additions & 5 deletions crypto3/libs/transpiler/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ macro(define_transpiler_test name)
set_target_properties(${full_test_name} PROPERTIES CXX_STANDARD 17)

get_target_property(target_type Boost::unit_test_framework TYPE)
if(target_type STREQUAL "SHARED_LIB")
target_compile_definitions(${full_test_name} PRIVATE BOOST_TEST_DYN_LINK)
elseif(target_type STREQUAL "STATIC_LIB")

endif()
add_custom_target(${full_test_name}_run
COMMAND $<TARGET_FILE:${full_test_name}>
DEPENDS ${full_test_name} $<TARGET_FILE:${full_test_name}>
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
pkgs = import nixpkgs {
inherit system;
overlays = [ nix-3rdparty.overlays.${system}.default ];
boost = pkgs.boost.override { enableShared = false; enabledStatic = true; };
};
in rec {
packages = rec {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ macro(define_storage_test test)

get_target_property(target_type Boost::unit_test_framework TYPE)
if(target_type STREQUAL "SHARED_LIB")
target_compile_definitions(${target_name} PRIVATE BOOST_TEST_DYN_LINK)
elseif(target_type STREQUAL "STATIC_LIB")

message(FATAL_ERROR "Shared lib is not supported")
endif()

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
Expand Down

0 comments on commit ea84d0b

Please sign in to comment.