X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2FCMakeLists.txt;h=dfe1acede0c5cb653b2fa5f183c68c81de2186f8;hb=74c5026796217f4d51b42aeb727cb04b4f5ce807;hp=4306290f926d1fd7e5913a75dbed18a87b9100e3;hpb=9984fe54b7ee8185928b687edfb2e15cd465f509;p=novacoin.git diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4306290..dfe1ace 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -53,6 +53,15 @@ endif() # Set default library path for berkeley db if (NOT BerkeleyDB_LIBS) set(BerkeleyDB_LIBS ${BerkeleyDB_ROOT}/lib) +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") +# Workaround for linux distributions +set(BerkeleyDB_LIBS ${BerkeleyDB_LIBS}/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu) +endif() +endif() + +# Set default library name for berkeley db +if (NOT BerkeleyDB_LIB_name) +set(BerkeleyDB_LIB_name libdb_cxx) endif() set(generic_sources @@ -96,28 +105,27 @@ set(generic_sources list(APPEND ALL_SOURCES ${generic_sources}) list(APPEND ALL_LIBRARIES ${Boost_LIBRARIES} ixwebsocket OpenSSL::Crypto) +# Windows-specific libraries +if (WIN32) + list(APPEND ALL_LIBRARIES kernel32 user32 gdi32 comdlg32 winspool winmm shell32 comctl32 ole32 oleaut32 uuid rpcrt4 advapi32 ws2_32 mswsock shlwapi) +endif() + +# Some systems need rt library +if (NOT WIN32 AND NOT APPLE) + list(APPEND ALL_LIBRARIES rt) +endif() + # Try various libdb library file extensions -if (EXISTS ${BerkeleyDB_LIBS}/libdb_cxx.a) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/libdb_cxx.a) -elseif(EXISTS ${BerkeleyDB_LIBS}/libdb_cxx.so) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/libdb_cxx.so) -elseif(EXISTS ${BerkeleyDB_LIBS}/libdb_cxx.dylib) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/libdb_cxx.dylib) -elseif(EXISTS ${BerkeleyDB_LIBS}/libdb_cxx.dll) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/libdb_cxx.dll) -else() - set(BerkeleyDB_LIBS ${BerkeleyDB_ROOT}/lib/x86_64-linux-gnu) - if (EXISTS ${BerkeleyDB_LIBS}/libdb_cxx.a) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/libdb_cxx.a) - elseif(EXISTS ${BerkeleyDB_LIBS}/libdb_cxx.so) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/libdb_cxx.so) - elseif(EXISTS ${BerkeleyDB_LIBS}/libdb_cxx.dylib) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/libdb_cxx.dylib) - elseif(EXISTS ${BerkeleyDB_LIBS}/libdb_cxx.dll) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/libdb_cxx.dll) - else() - message(FATAL_ERROR "Unable to find libdb_cxx library in ${BerkeleyDB_LIBS} directory. Try to specify either library path via BerkeleyDB_LIBS or berkeley db root path via BerkeleyDB_ROOT variable.") - endif() +foreach(ext a so dylib lib) +if (EXISTS ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.${ext}) + list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.${ext}) + set (BDB_FOUND True) + break() +endif() +endforeach() + +if (NOT BDB_FOUND) + message(FATAL_ERROR "Unable to find ${BerkeleyDB_LIB_name} library in ${BerkeleyDB_LIBS} directory. Try to specify either library path via BerkeleyDB_LIBS or berkeley db root path via BerkeleyDB_ROOT variable. You can also use BerkeleyDB_LIB_name variable to provide alternative file name search for.") endif() if(USE_LEVELDB) @@ -146,10 +154,10 @@ execute_process ( COMMAND sh -c "${CMAKE_CURRENT_SOURCE_DIR}/../share/genbuild.sh ${CMAKE_CURRENT_SOURCE_DIR}/build.h" OUTPUT_VARIABLE outVar ) -list(APPEND ALL_DEFINITIONS HAVE_BUILD_INFO) +list(APPEND ALL_DEFINITIONS HAVE_BUILD_INFO USE_IPV6) add_executable(novacoind ${ALL_SOURCES}) -target_include_directories(novacoind PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/json ${BerkeleyDB_INC} ${CMAKE_CURRENT_SOURCE_DIR}/additional/leveldb/helpers ${Boost_INCLUDE_DIRS}) +target_include_directories(novacoind PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/json ${BerkeleyDB_INC} ${CMAKE_CURRENT_SOURCE_DIR}/additional/sse2neon ${CMAKE_CURRENT_SOURCE_DIR}/additional/leveldb/helpers ${Boost_INCLUDE_DIRS}) target_link_libraries(novacoind ${ALL_LIBRARIES}) target_compile_features(novacoind PUBLIC cxx_std_17)