fix for mingw not playing nicely with libunbound configure, fix for correctly finding static libs on various operating systems

This commit is contained in:
Riccardo Spagni 2014-10-06 22:29:07 +02:00
parent b05e27f8b1
commit 2cf94c1321
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
5 changed files with 27 additions and 16 deletions

View file

@ -213,12 +213,17 @@ endif()
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if(MINGW)
set(Boost_LIBRARIES "${Boost_LIBRARIES};pthread;mswsock;ws2_32")
find_library(PTHREAD pthread)
find_library(MSWSOCK mswsock)
find_library(WS2_32 ws2_32)
set(EXTRA_LIBRARIES ${PTHREAD} ${MSWSOCK} ${WS2_32})
elseif(APPLE OR FREEBSD)
set(Boost_LIBRARIES "${Boost_LIBRARIES}")
set(EXTRA_LIBRARIES "")
elseif(NOT MSVC)
set(Boost_LIBRARIES "${Boost_LIBRARIES};ld")
#set(Boost_LIBRARIES "${Boost_LIBRARIES};rt;pthread")
find_library(RT rt)
find_library(PTHREAD pthread)
find_library(DL dl)
set(EXTRA_LIBRARIES ${RT} ${PTHREAD} ${DL})
endif()
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/version")

View file

@ -101,11 +101,14 @@ IF(!UNBOUND_INCLUDE_DIR OR STATIC)
IF(MINGW)
set(ENV{USE_WINSOCK} 1)
set(ENV{CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
set(ENV{GCC_PREFIX} ${GCC_PREFIX})
set(ENV{CMAKE_FIND_ROOT_PATH} ${CMAKE_FIND_ROOT_PATH})
EXTERNALPROJECT_ADD(
libunbound
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/unbound
URL ${CMAKE_CURRENT_SOURCE_DIR}/unbound/
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/unbound/configure --prefix=${CMAKE_FIND_ROOT_PATH} --build=${GCC_PREFIX} --host=${GCC_PREFIX} --disable-shared --enable-static --sysconfdir=${CMAKE_FIND_ROOT_PATH}/etc --localstatedir=${CMAKE_FIND_ROOT_PATH}/var --sbindir=${CMAKE_FIND_ROOT_PATH}/bin --disable-gost --disable-rpath --with-libevent=no --with-libexpat=${CMAKE_FIND_ROOT_PATH} --without-pyunbound --without-pythonmodule --with-ssl=${CMAKE_FIND_ROOT_PATH} --without-pthreads --with-libunbound-only
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/unbound/monero-config.sh
BUILD_COMMAND $(MAKE)
UPDATE_COMMAND ""
PATCH_COMMAND ""

3
external/unbound/monero-config.sh vendored Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
./configure --prefix=${CMAKE_FIND_ROOT_PATH} --build=${GCC_PREFIX} --host=${GCC_PREFIX} --disable-shared --enable-static --sysconfdir=${CMAKE_FIND_ROOT_PATH}/etc --localstatedir=${CMAKE_FIND_ROOT_PATH}/var --sbindir=${CMAKE_FIND_ROOT_PATH}/bin --disable-gost --disable-rpath --with-libevent=no --with-libexpat=${CMAKE_FIND_ROOT_PATH} --without-pyunbound --without-pythonmodule --with-ssl=${CMAKE_FIND_ROOT_PATH} --without-pthreads --with-libunbound-only

View file

@ -63,14 +63,14 @@ add_library(mnemonics ${MNEMONICS})
add_executable(daemon ${DAEMON} ${P2P} ${CRYPTONOTE_PROTOCOL})
add_executable(connectivity_tool ${CONN_TOOL})
add_executable(simpleminer ${MINER})
target_link_libraries(daemon rpc cryptonote_core crypto common ${UNBOUND_LIBRARY} ${UPNP_LIBRARIES} ${Boost_LIBRARIES})
target_link_libraries(connectivity_tool cryptonote_core crypto common ${UNBOUND_LIBRARY} ${Boost_LIBRARIES})
target_link_libraries(simpleminer cryptonote_core crypto common ${UNBOUND_LIBRARY} ${Boost_LIBRARIES})
target_link_libraries(daemon rpc cryptonote_core crypto common ${UNBOUND_LIBRARY} ${UPNP_LIBRARIES} ${Boost_LIBRARIES} ${EXTRA_LIBRARIES})
target_link_libraries(connectivity_tool cryptonote_core crypto common ${UNBOUND_LIBRARY} ${Boost_LIBRARIES} ${EXTRA_LIBRARIES})
target_link_libraries(simpleminer cryptonote_core crypto common ${UNBOUND_LIBRARY} ${Boost_LIBRARIES} ${EXTRA_LIBRARIES})
add_library(rpc ${RPC})
add_library(wallet ${WALLET})
target_link_libraries(wallet mnemonics)
add_executable(simplewallet ${SIMPLEWALLET} )
target_link_libraries(simplewallet wallet rpc cryptonote_core crypto common mnemonics ${UNBOUND_LIBRARY} ${UPNP_LIBRARIES} ${Boost_LIBRARIES})
target_link_libraries(simplewallet wallet rpc cryptonote_core crypto common mnemonics ${UNBOUND_LIBRARY} ${UPNP_LIBRARIES} ${Boost_LIBRARIES} ${EXTRA_LIBRARIES})
add_dependencies(daemon version)
add_dependencies(rpc version)
add_dependencies(simplewallet version)

View file

@ -61,16 +61,16 @@ add_executable(unit_tests ${UNIT_TESTS})
add_executable(net_load_tests_clt net_load_tests/clt.cpp)
add_executable(net_load_tests_srv net_load_tests/srv.cpp)
target_link_libraries(core_proxy cryptonote_core common crypto ${UNBOUND_LIBRARY} ${UPNP_LIBRARIES} ${Boost_LIBRARIES})
target_link_libraries(coretests cryptonote_core common crypto ${UNBOUND_LIBRARY} ${Boost_LIBRARIES})
target_link_libraries(core_proxy cryptonote_core common crypto ${UNBOUND_LIBRARY} ${UPNP_LIBRARIES} ${Boost_LIBRARIES} ${EXTRA_LIBRARIES})
target_link_libraries(coretests cryptonote_core common crypto ${UNBOUND_LIBRARY} ${Boost_LIBRARIES} ${EXTRA_LIBRARIES})
target_link_libraries(difficulty-tests cryptonote_core)
target_link_libraries(functional_tests cryptonote_core wallet common crypto ${UNBOUND_LIBRARY} ${Boost_LIBRARIES})
target_link_libraries(functional_tests cryptonote_core wallet common crypto ${UNBOUND_LIBRARY} ${Boost_LIBRARIES} ${EXTRA_LIBRARIES})
target_link_libraries(hash-tests crypto)
target_link_libraries(hash-target-tests crypto cryptonote_core)
target_link_libraries(performance_tests cryptonote_core common crypto ${UNBOUND_LIBRARY} ${Boost_LIBRARIES})
target_link_libraries(unit_tests gtest_main cryptonote_core wallet crypto common ${UNBOUND_LIBRARY} ${Boost_LIBRARIES})
target_link_libraries(net_load_tests_clt cryptonote_core common crypto gtest_main ${UNBOUND_LIBRARY} ${Boost_LIBRARIES})
target_link_libraries(net_load_tests_srv cryptonote_core common crypto gtest_main ${UNBOUND_LIBRARY} ${Boost_LIBRARIES})
target_link_libraries(performance_tests cryptonote_core common crypto ${UNBOUND_LIBRARY} ${Boost_LIBRARIES} ${EXTRA_LIBRARIES})
target_link_libraries(unit_tests gtest_main cryptonote_core wallet crypto common ${UNBOUND_LIBRARY} ${Boost_LIBRARIES} ${EXTRA_LIBRARIES})
target_link_libraries(net_load_tests_clt cryptonote_core common crypto gtest_main ${UNBOUND_LIBRARY} ${Boost_LIBRARIES} ${EXTRA_LIBRARIES})
target_link_libraries(net_load_tests_srv cryptonote_core common crypto gtest_main ${UNBOUND_LIBRARY} ${Boost_LIBRARIES} ${EXTRA_LIBRARIES})
if(NOT MSVC)
set_property(TARGET gtest gtest_main unit_tests net_load_tests_clt net_load_tests_srv APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-sign-compare")