Browse Source

Use BUILD_SHARED_LIB

cl-refactor
chriseth 10 years ago
parent
commit
a895217db6
  1. 13
      cmake/EthCompilerSettings.cmake
  2. 6
      libdevcore/CMakeLists.txt
  3. 6
      libdevcrypto/CMakeLists.txt
  4. 6
      libethcore/CMakeLists.txt
  5. 6
      libethereum/CMakeLists.txt
  6. 6
      libethereumx/CMakeLists.txt
  7. 6
      libevm/CMakeLists.txt
  8. 6
      libevmcore/CMakeLists.txt
  9. 6
      liblll/CMakeLists.txt
  10. 6
      libnatspec/CMakeLists.txt
  11. 6
      libp2p/CMakeLists.txt
  12. 6
      libserpent/CMakeLists.txt
  13. 6
      libsolidity/CMakeLists.txt
  14. 6
      libtestutils/CMakeLists.txt
  15. 6
      libweb3jsonrpc/CMakeLists.txt
  16. 6
      libwebthree/CMakeLists.txt
  17. 6
      libwhisper/CMakeLists.txt
  18. 18
      secp256k1/CMakeLists.txt
  19. 6
      solc/CMakeLists.txt

13
cmake/EthCompilerSettings.cmake

@ -8,7 +8,6 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE") set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -DETH_RELEASE") set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -DETH_RELEASE")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_RELEASE") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_RELEASE")
set(ETH_SHARED 1)
if (PROFILING) if (PROFILING)
set(CMAKE_CXX_FLAGS "-g ${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "-g ${CMAKE_CXX_FLAGS}")
@ -31,7 +30,6 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE") set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -DETH_RELEASE") set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -DETH_RELEASE")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_DEBUG") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_DEBUG")
set(ETH_SHARED 1)
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++ -fcolor-diagnostics -Qunused-arguments -DBOOST_ASIO_HAS_CLANG_LIBCXX") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++ -fcolor-diagnostics -Qunused-arguments -DBOOST_ASIO_HAS_CLANG_LIBCXX")
@ -55,8 +53,10 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# stack size 16MB # stack size 16MB
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ignore:4099,4075 /STACK:16777216") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ignore:4099,4075 /STACK:16777216")
# windows likes static # windows likes static
set(ETH_STATIC 1) if (NOT ETH_STATIC)
message("Forcing static linkage for MSVC.")
set(ETH_STATIC 1)
endif ()
else () else ()
message(WARNING "Your compiler is not tested, if you run into any issues, we'd welcome any patches.") message(WARNING "Your compiler is not tested, if you run into any issues, we'd welcome any patches.")
endif () endif ()
@ -72,3 +72,8 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
endif () endif ()
endif () endif ()
if(ETH_STATIC)
set(BUILD_SHARED_LIBS OFF)
else()
set(BUILD_SHARED_LIBS ON)
endif(ETH_STATIC)

6
libdevcore/CMakeLists.txt

@ -20,11 +20,7 @@ set(EXECUTABLE devcore)
file(GLOB HEADERS "*.h") file(GLOB HEADERS "*.h")
if(ETH_STATIC) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
target_link_libraries(${EXECUTABLE} ${Boost_THREAD_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${Boost_THREAD_LIBRARIES})
target_link_libraries(${EXECUTABLE} ${Boost_SYSTEM_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${Boost_SYSTEM_LIBRARIES})

6
libdevcrypto/CMakeLists.txt

@ -17,11 +17,7 @@ include_directories(${LEVELDB_INCLUDE_DIRS})
set(EXECUTABLE devcrypto) set(EXECUTABLE devcrypto)
file(GLOB HEADERS "*.h") file(GLOB HEADERS "*.h")
if(ETH_STATIC) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
target_link_libraries(${EXECUTABLE} ${Boost_FILESYSTEM_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${Boost_FILESYSTEM_LIBRARIES})
target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARIES})

6
libethcore/CMakeLists.txt

@ -24,11 +24,7 @@ set(EXECUTABLE ethcore)
file(GLOB HEADERS "*.h") file(GLOB HEADERS "*.h")
if(ETH_STATIC) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
target_link_libraries(${EXECUTABLE} ethash) target_link_libraries(${EXECUTABLE} ethash)
target_link_libraries(${EXECUTABLE} devcrypto) target_link_libraries(${EXECUTABLE} devcrypto)

6
libethereum/CMakeLists.txt

@ -19,11 +19,7 @@ set(EXECUTABLE ethereum)
file(GLOB HEADERS "*.h") file(GLOB HEADERS "*.h")
if (ETH_STATIC) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
target_link_libraries(${EXECUTABLE} evm) target_link_libraries(${EXECUTABLE} evm)
target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} lll)

6
libethereumx/CMakeLists.txt

@ -11,11 +11,7 @@ set(EXECUTABLE ethereumx)
file(GLOB HEADERS "*.h") file(GLOB HEADERS "*.h")
if (ETH_STATIC) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) target_link_libraries(${EXECUTABLE} ${LEVELDB_LS})
target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LS}) target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LS})

6
libevm/CMakeLists.txt

@ -20,11 +20,7 @@ set(EXECUTABLE evm)
file(GLOB HEADERS "*.h") file(GLOB HEADERS "*.h")
if (ETH_STATIC) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
target_link_libraries(${EXECUTABLE} ethcore) target_link_libraries(${EXECUTABLE} ethcore)
target_link_libraries(${EXECUTABLE} devcrypto) target_link_libraries(${EXECUTABLE} devcrypto)

6
libevmcore/CMakeLists.txt

@ -19,11 +19,7 @@ set(EXECUTABLE evmcore)
file(GLOB HEADERS "*.h") file(GLOB HEADERS "*.h")
if (ETH_STATIC) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
target_link_libraries(${EXECUTABLE} devcore) target_link_libraries(${EXECUTABLE} devcore)
target_link_libraries(${EXECUTABLE} devcrypto) target_link_libraries(${EXECUTABLE} devcrypto)

6
liblll/CMakeLists.txt

@ -19,11 +19,7 @@ set(EXECUTABLE lll)
file(GLOB HEADERS "*.h") file(GLOB HEADERS "*.h")
if(ETH_STATIC) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} evmcore)
target_link_libraries(${EXECUTABLE} devcore) target_link_libraries(${EXECUTABLE} devcore)

6
libnatspec/CMakeLists.txt

@ -22,11 +22,7 @@ file(GLOB HEADERS "*.h")
qt5_add_resources(NATSPECQRC natspec.qrc) qt5_add_resources(NATSPECQRC natspec.qrc)
if (ETH_STATIC) add_library(${EXECUTABLE} ${RESOURCE_ADDED} ${SRC_LIST} ${HEADERS} ${NATSPECQRC})
add_library(${EXECUTABLE} STATIC ${RESOURCE_ADDED} ${SRC_LIST} ${HEADERS} ${NATSPECQRC})
else()
add_library(${EXECUTABLE} SHARED ${RESOURCE_ADDED} ${SRC_LIST} ${HEADERS} ${NATSPECQRC})
endif()
target_link_libraries(${EXECUTABLE} Qt5::Core) target_link_libraries(${EXECUTABLE} Qt5::Core)
target_link_libraries(${EXECUTABLE} Qt5::Qml) target_link_libraries(${EXECUTABLE} Qt5::Qml)

6
libp2p/CMakeLists.txt

@ -25,11 +25,7 @@ set(EXECUTABLE p2p)
file(GLOB HEADERS "*.h") file(GLOB HEADERS "*.h")
if(ETH_STATIC) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
if (MINIUPNPC_FOUND) if (MINIUPNPC_FOUND)
target_link_libraries(${EXECUTABLE} ${MINIUPNPC_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${MINIUPNPC_LIBRARIES})

6
libserpent/CMakeLists.txt

@ -17,11 +17,7 @@ set(EXECUTABLE serpent)
file(GLOB HEADERS "*.h") file(GLOB HEADERS "*.h")
if(ETH_STATIC) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} lll)
target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} evmcore)

6
libsolidity/CMakeLists.txt

@ -19,11 +19,7 @@ set(EXECUTABLE solidity)
file(GLOB HEADERS "*.h") file(GLOB HEADERS "*.h")
if (ETH_STATIC) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
target_link_libraries(${EXECUTABLE} ${JSONCPP_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${JSONCPP_LIBRARIES})
target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} evmcore)

6
libtestutils/CMakeLists.txt

@ -23,11 +23,7 @@ if (NOT JSONRPC)
list(REMOVE_ITEM HEADERS "./FixedWebThreeServer.h") list(REMOVE_ITEM HEADERS "./FixedWebThreeServer.h")
endif() endif()
if (ETH_STATIC) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
target_link_libraries(${EXECUTABLE} ${Boost_FILESYSTEM_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${Boost_FILESYSTEM_LIBRARIES})
target_link_libraries(${EXECUTABLE} ${JSONCPP_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${JSONCPP_LIBRARIES})

6
libweb3jsonrpc/CMakeLists.txt

@ -20,11 +20,7 @@ set(EXECUTABLE web3jsonrpc)
file(GLOB HEADERS "*.h") file(GLOB HEADERS "*.h")
if (ETH_STATIC) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else ()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif ()
target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARIES})
target_link_libraries(${EXECUTABLE} ${JSONCPP_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${JSONCPP_LIBRARIES})

6
libwebthree/CMakeLists.txt

@ -19,11 +19,7 @@ set(EXECUTABLE webthree)
file(GLOB HEADERS "*.h") file(GLOB HEADERS "*.h")
if (ETH_STATIC) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARIES})

6
libwhisper/CMakeLists.txt

@ -19,11 +19,7 @@ set(EXECUTABLE whisper)
file(GLOB HEADERS "*.h") file(GLOB HEADERS "*.h")
if (ETH_STATIC) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARIES})

18
secp256k1/CMakeLists.txt

@ -14,22 +14,14 @@ file(GLOB HEADERS "*.h")
if (APPLE OR UNIX) if (APPLE OR UNIX)
if (ETH_STATIC) add_library(${EXECUTABLE} ${EXECUTABLE}.c field_5x52_asm.asm)
add_library(${EXECUTABLE} STATIC ${EXECUTABLE}.c field_5x52_asm.asm)
else()
add_library(${EXECUTABLE} SHARED ${EXECUTABLE}.c field_5x52_asm.asm)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DUSE_FIELD_GMP -DUSE_NUM_GMP -DUSE_FIELD_INV_NUM") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DUSE_FIELD_GMP -DUSE_NUM_GMP -DUSE_FIELD_INV_NUM")
target_link_libraries(${EXECUTABLE} ${GMP_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${GMP_LIBRARIES})
elseif (CMAKE_COMPILER_IS_MINGW) elseif (CMAKE_COMPILER_IS_MINGW)
include_directories(${Boost_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS})
if (ETH_STATIC) add_library(${EXECUTABLE} ${EXECUTABLE}.c field_5x52_asm.asm)
add_library(${EXECUTABLE} STATIC ${EXECUTABLE}.c field_5x52_asm.asm)
else()
add_library(${EXECUTABLE} SHARED ${EXECUTABLE}.c field_5x52_asm.asm)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -W -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -DUSE_FIELD_GMP -DUSE_NUM_GMP -DUSE_FIELD_INV_NUM") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -W -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -DUSE_FIELD_GMP -DUSE_NUM_GMP -DUSE_FIELD_INV_NUM")
target_link_libraries(${EXECUTABLE} ${GMP_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${GMP_LIBRARIES})
@ -37,11 +29,7 @@ else()
include_directories(${Boost_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS})
if (ETH_STATIC) add_library(${EXECUTABLE} ${EXECUTABLE}.c)
add_library(${EXECUTABLE} STATIC ${EXECUTABLE}.c)
else()
add_library(${EXECUTABLE} SHARED ${EXECUTABLE}.c)
endif()
# /TP - compile project as cpp project # /TP - compile project as cpp project
set_target_properties(${EXECUTABLE} PROPERTIES COMPILE_FLAGS "/TP /wd4244") set_target_properties(${EXECUTABLE} PROPERTIES COMPILE_FLAGS "/TP /wd4244")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_NUM_BOOST -DUSE_FIELD_10X26 -DUSE_FIELD_INV_BUILTIN") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_NUM_BOOST -DUSE_FIELD_10X26 -DUSE_FIELD_INV_BUILTIN")

6
solc/CMakeLists.txt

@ -19,9 +19,5 @@ target_link_libraries(${EXECUTABLE} solidity)
install( TARGETS ${EXECUTABLE} DESTINATION bin ) install( TARGETS ${EXECUTABLE} DESTINATION bin )
if (ETH_STATIC) add_library(soljson jsonCompiler.cpp ${HEADERS})
add_library(soljson STATIC jsonCompiler.cpp ${HEADERS})
else()
add_library(soljson SHARED jsonCompiler.cpp ${HEADERS})
endif()
target_link_libraries(soljson solidity) target_link_libraries(soljson solidity)

Loading…
Cancel
Save