Updates from BitShares FC #22
2 changed files with 19 additions and 19 deletions
|
|
@ -15,6 +15,8 @@ INCLUDE(GetPrerequisites)
|
||||||
INCLUDE( VersionMacros )
|
INCLUDE( VersionMacros )
|
||||||
INCLUDE( SetupTargetMacros )
|
INCLUDE( SetupTargetMacros )
|
||||||
INCLUDE(GetGitRevisionDescription)
|
INCLUDE(GetGitRevisionDescription)
|
||||||
|
INCLUDE(CheckLibraryExists)
|
||||||
|
INCLUDE(CheckLibcxxAtomic)
|
||||||
|
|
||||||
get_git_head_revision(GIT_REFSPEC FC_GIT_REVISION_SHA)
|
get_git_head_revision(GIT_REFSPEC FC_GIT_REVISION_SHA)
|
||||||
get_git_unix_timestamp(FC_GIT_REVISION_UNIX_TIMESTAMP)
|
get_git_unix_timestamp(FC_GIT_REVISION_UNIX_TIMESTAMP)
|
||||||
|
|
@ -159,7 +161,7 @@ IF( WIN32 )
|
||||||
SET(Boost_LIBRARIES ${BOOST_LIBRARIES_TEMP} ${Boost_LIBRARIES})
|
SET(Boost_LIBRARIES ${BOOST_LIBRARIES_TEMP} ${Boost_LIBRARIES})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
set( PLATFORM_SPECIFIC_LIBS wsock32.lib ws2_32.lib userenv.lib)
|
LIST(APPEND PLATFORM_SPECIFIC_LIBS wsock32.lib ws2_32.lib userenv.lib)
|
||||||
# iphlpapi.lib
|
# iphlpapi.lib
|
||||||
|
|
||||||
ELSE(WIN32)
|
ELSE(WIN32)
|
||||||
|
|
@ -186,6 +188,9 @@ IF(NOT "$ENV{OPENSSL_ROOT_DIR}" STREQUAL "")
|
||||||
message(STATUS "Setting up OpenSSL root and include vars to ${OPENSSL_ROOT_DIR}, ${OPENSSL_INCLUDE_DIR}")
|
message(STATUS "Setting up OpenSSL root and include vars to ${OPENSSL_ROOT_DIR}, ${OPENSSL_INCLUDE_DIR}")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
IF( LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB )
|
||||||
|
LIST( APPEND PLATFORM_SPECIFIC_LIBS atomic )
|
||||||
|
ENDIF( LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB )
|
||||||
|
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
|
|
||||||
|
|
@ -383,7 +388,9 @@ target_include_directories(fc
|
||||||
IF(NOT WIN32)
|
IF(NOT WIN32)
|
||||||
set(LINK_USR_LOCAL_LIB -L/usr/local/lib)
|
set(LINK_USR_LOCAL_LIB -L/usr/local/lib)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
target_link_libraries( fc PUBLIC ${LINK_USR_LOCAL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${editline_libraries} secp256k1 )
|
target_link_libraries( fc PUBLIC ${LINK_USR_LOCAL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES}
|
||||||
|
${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library}
|
||||||
|
${editline_libraries} secp256k1 ${CMAKE_REQUIRED_LIBRARIES} )
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set_source_files_properties( src/network/http/websocket.cpp PROPERTIES COMPILE_FLAGS "/bigobj" )
|
set_source_files_properties( src/network/http/websocket.cpp PROPERTIES COMPILE_FLAGS "/bigobj" )
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,10 @@ INCLUDE(CheckCXXSourceCompiles)
|
||||||
|
|
||||||
# Sometimes linking against libatomic is required for atomic ops, if
|
# Sometimes linking against libatomic is required for atomic ops, if
|
||||||
# the platform doesn't support lock-free atomics.
|
# the platform doesn't support lock-free atomics.
|
||||||
#
|
|
||||||
# We could modify LLVM's CheckAtomic module and have it check for 64-bit
|
|
||||||
# atomics instead. However, we would like to avoid careless uses of 64-bit
|
|
||||||
# atomics inside LLVM over time on 32-bit platforms.
|
|
||||||
|
|
||||||
function(check_cxx_atomics varname)
|
function(check_cxx_atomics varname)
|
||||||
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs -std=c++11 -nostdinc++ -isystem ${LIBCXX_SOURCE_DIR}/include")
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11")
|
||||||
if (${LIBCXX_GCC_TOOLCHAIN})
|
if (${LIBCXX_GCC_TOOLCHAIN})
|
||||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
|
||||||
endif()
|
endif()
|
||||||
|
|
@ -24,27 +20,24 @@ function(check_cxx_atomics varname)
|
||||||
endif()
|
endif()
|
||||||
check_cxx_source_compiles("
|
check_cxx_source_compiles("
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <atomic>
|
#include <boost/lockfree/queue.hpp>
|
||||||
std::atomic<uintptr_t> x;
|
|
||||||
std::atomic<uintmax_t> y;
|
boost::lockfree::queue<uint32_t*> q;
|
||||||
int main(int, char**) {
|
int main(int, char**) {
|
||||||
return x + y;
|
uint32_t* a;
|
||||||
|
uint32_t* b;
|
||||||
|
q.push(a);
|
||||||
|
q.pop(b);
|
||||||
}
|
}
|
||||||
" ${varname})
|
" ${varname})
|
||||||
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||||
endfunction(check_cxx_atomics)
|
endfunction(check_cxx_atomics)
|
||||||
|
|
||||||
# Perform the check for 64bit atomics without libatomic. It may have been
|
# Perform the check for 64bit atomics without libatomic.
|
||||||
# added to the required libraries during in the configuration of LLVM, which
|
|
||||||
# would cause the check for CXX atomics without libatomic to incorrectly pass.
|
|
||||||
set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
|
||||||
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "atomic")
|
|
||||||
check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB)
|
check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB)
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES})
|
|
||||||
|
|
||||||
check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
|
|
||||||
# If not, check if the library exists, and atomics work with it.
|
# If not, check if the library exists, and atomics work with it.
|
||||||
if(NOT LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB)
|
if(NOT LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB)
|
||||||
|
check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
|
||||||
if(LIBCXX_HAS_ATOMIC_LIB)
|
if(LIBCXX_HAS_ATOMIC_LIB)
|
||||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
|
||||||
check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
|
check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue