X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2FCMakeLists.txt;h=c5747e90e744c34ed15385d617f4cdcddba9df51;hb=0662b79a931f0232b0f97cd6ff644e500b94f3d1;hp=2fd5f7d5012e10bf5a3eeed8ce35940b9e7ace12;hpb=b89ba58c9e52695daed33c34c7a8eea5dcff660b;p=novacoin.git diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2fd5f7d..c5747e9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 3.4.1) ## ## mkdir build && cd build ## -## cmake -DBerkeleyDB_ROOT:STRING=/opt/homebrew/Cellar/berkeley-db@4/4.8.30 .. -## cmake -DBerkeleyDB_INC:STRING=/usr/include -DBerkeleyDB_LIBS:STRING=/usr/lib/aarch64-linux-gnu -DUSE_LEVELDB=1 .. +## cmake -DBerkeleyDB_ROOT:STRING=/opt/homebrew/Cellar/berkeley-db@4/4.8.30 -DUSE_LEVELDB=1 .. +## cmake -DUSE_LEVELDB=1 .. ## project(novacoind VERSION 0.5.9 LANGUAGES C CXX) @@ -21,16 +21,25 @@ endif() find_program(CCACHE_FOUND ccache) if(CCACHE_FOUND) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) set(CMAKE_C_COMPILER_LAUNCHER ccache) set(CMAKE_CXX_COMPILER_LAUNCHER ccache) endif(CCACHE_FOUND) -set (CMAKE_C_FLAGS "-flto -O3 -fPIC -Wno-deprecated -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2") -set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fexceptions -frtti") +if (NOT MSVC) +if (NOT WIN32) +set(FPIC "-fPIC") +endif() +set (CMAKE_C_FLAGS "-flto -O3 ${FPIC} -Wno-deprecated -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2") +set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -fexceptions -frtti") +else() +set(CMAKE_C_FLAGS "/O2") +set(CMAKE_CXX_FLAGS "/O2 /GR /EHsc") +endif() + set(CMAKE_CXX_EXTENSIONS OFF) set(Boost_USE_STATIC_LIBS ON) +set(Boost_USE_STATIC_RUNTIME ON) find_package(Boost REQUIRED COMPONENTS atomic chrono filesystem program_options system thread) set(OPENSSL_USE_STATIC_LIBS ON) find_package(OpenSSL REQUIRED) @@ -116,16 +125,16 @@ if (NOT WIN32 AND NOT APPLE) endif() # Try various libdb library file extensions -if (EXISTS ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.a) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.a) -elseif(EXISTS ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.so) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.so) -elseif(EXISTS ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.dylib) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.dylib) -elseif(EXISTS ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.lib) - list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/${BerkeleyDB_LIB_name}.lib) -else() - 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.") +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)