## cmake -DBerkeleyDB_INC:STRING=/usr/include -DBerkeleyDB_LIBS:STRING=/usr/lib/aarch64-linux-gnu -DUSE_SSE2 -DUSE_LEVELDB ..
##
-project(novacoind VERSION 0.5.9 LANGUAGES C CXX)
+project(novacoind VERSION 0.5.9 LANGUAGES C CXX ASM)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set(BerkeleyDB_INC ${BerkeleyDB_ROOT}/include)
endif()
+if (NOT EXISTS ${BerkeleyDB_ROOT}/include/db_cxx.h)
+ message(FATAL_ERROR "Unable to find db_cxx.h header file in ${BerkeleyDB_ROOT}/include directory")
+endif()
+
# Set default library path for berkeley db
if (NOT BerkeleyDB_LIBS)
set(BerkeleyDB_LIBS ${BerkeleyDB_ROOT}/lib)
)
list(APPEND ALL_SOURCES ${generic_sources})
-list(APPEND ALL_LIBRARIES ${BerkeleyDB_LIBS}/libdb_cxx.a ${Boost_LIBRARIES} ixwebsocket OpenSSL::Crypto)
+list(APPEND ALL_LIBRARIES ${Boost_LIBRARIES} ixwebsocket OpenSSL::Crypto)
+
+# 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()
+ message(FATAL_ERROR "Unable to find libdb_cxx library in ${BerkeleyDB_LIBS} directory")
+endif()
if(USE_LEVELDB)
+ # Disable useless targets
+ option(LEVELDB_BUILD_TESTS "Build LevelDB's unit tests" OFF)
+ option(LEVELDB_BUILD_BENCHMARKS "Build LevelDB's benchmarks" OFF)
+ option(LEVELDB_INSTALL "Install LevelDB's header and library" OFF)
+
add_subdirectory(additional/leveldb)
list(APPEND ALL_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/txdb-leveldb.cpp)
list(APPEND ALL_LIBRARIES leveldb)
list( APPEND ALL_SOURCES ${generic_sources} ${CMAKE_CURRENT_SOURCE_DIR}/crypto/scrypt/generic/scrypt-generic.cpp )
endif()
+# Generate build info header
+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)
+
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_link_libraries(novacoind ${ALL_LIBRARIES})