mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
FindMonero.cmake added to simply building against Monero
This commit is contained in:
parent
05a7af350a
commit
4fc33137de
8 changed files with 200 additions and 1675 deletions
146
CMakeLists.txt
146
CMakeLists.txt
|
@ -8,10 +8,37 @@ project(${PROJECT_NAME})
|
|||
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -std=c++14")
|
||||
|
||||
if (WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj -O3")
|
||||
endif()
|
||||
|
||||
|
||||
if (NOT MONERO_DIR)
|
||||
set(MONERO_DIR ~/monero)
|
||||
endif()
|
||||
|
||||
message(STATUS MONERO_DIR ": ${MONERO_DIR}")
|
||||
|
||||
set(MONERO_SOURCE_DIR ${MONERO_DIR}
|
||||
CACHE PATH "Path to the root directory for Monero")
|
||||
|
||||
# set location of monero build tree
|
||||
set(MONERO_BUILD_DIR ${MONERO_SOURCE_DIR}/build/release/
|
||||
CACHE PATH "Path to the build directory for Monero")
|
||||
|
||||
set(MY_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake"
|
||||
CACHE PATH "The path to the cmake directory of the current project")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${MY_CMAKE_DIR}")
|
||||
|
||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${MONERO_BUILD_DIR}"
|
||||
CACHE PATH "Add Monero directory for library searching")
|
||||
|
||||
include(MyUtils)
|
||||
|
||||
find_package(Monero)
|
||||
|
||||
# find boost
|
||||
find_package(Boost COMPONENTS
|
||||
system
|
||||
|
@ -26,80 +53,12 @@ find_package(Boost COMPONENTS
|
|||
REQUIRED)
|
||||
|
||||
|
||||
# set location of monero static libraries
|
||||
set(MONERO_LIBS_DIR
|
||||
/opt/monero-dev/libs)
|
||||
|
||||
# set location of moneroheaders
|
||||
set(MONERO_HEADERS_DIR
|
||||
/opt/monero-dev/headers)
|
||||
|
||||
# include monero headers
|
||||
include_directories(
|
||||
${MONERO_HEADERS_DIR}/src
|
||||
${MONERO_HEADERS_DIR}/external
|
||||
${MONERO_HEADERS_DIR}/build
|
||||
${MONERO_HEADERS_DIR}/contrib/epee/include
|
||||
${MONERO_HEADERS_DIR}/external/easylogging++
|
||||
${MONERO_HEADERS_DIR}/external/db_drivers/liblmdb)
|
||||
|
||||
if(APPLE)
|
||||
include_directories(/usr/local/opt/openssl/include)
|
||||
link_directories(/usr/local/opt/openssl/lib)
|
||||
endif()
|
||||
|
||||
# get individual monero static libraries
|
||||
# that are needed in this project
|
||||
|
||||
add_library(common STATIC IMPORTED)
|
||||
set_property(TARGET common PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libcommon.a)
|
||||
|
||||
add_library(blocks STATIC IMPORTED)
|
||||
set_property(TARGET blocks PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libblocks.a)
|
||||
|
||||
add_library(cryptoxmr STATIC IMPORTED)
|
||||
set_property(TARGET cryptoxmr
|
||||
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libcrypto.a)
|
||||
|
||||
add_library(cryptonote_basic STATIC IMPORTED)
|
||||
set_property(TARGET cryptonote_basic
|
||||
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libcryptonote_basic.a)
|
||||
|
||||
add_library(cryptonote_core STATIC IMPORTED)
|
||||
set_property(TARGET cryptonote_core
|
||||
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libcryptonote_core.a)
|
||||
|
||||
add_library(cryptonote_protocol STATIC IMPORTED)
|
||||
set_property(TARGET cryptonote_protocol
|
||||
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libcryptonote_protocol.a)
|
||||
|
||||
add_library(daemonizer STATIC IMPORTED)
|
||||
set_property(TARGET daemonizer
|
||||
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libdaemonizer.a)
|
||||
|
||||
add_library(mnemonics STATIC IMPORTED)
|
||||
set_property(TARGET mnemonics
|
||||
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libmnemonics.a)
|
||||
|
||||
add_library(epee STATIC IMPORTED)
|
||||
set_property(TARGET epee
|
||||
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libepee.a)
|
||||
|
||||
add_library(blockchain_db STATIC IMPORTED)
|
||||
set_property(TARGET blockchain_db
|
||||
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libblockchain_db.a)
|
||||
|
||||
add_library(lmdb STATIC IMPORTED)
|
||||
set_property(TARGET lmdb
|
||||
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/liblmdb.a)
|
||||
|
||||
add_library(ringct STATIC IMPORTED)
|
||||
set_property(TARGET ringct
|
||||
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libringct.a)
|
||||
|
||||
add_library(wallet STATIC IMPORTED)
|
||||
set_property(TARGET wallet
|
||||
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libwallet.a)
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32)
|
||||
add_library(unbound STATIC IMPORTED)
|
||||
|
@ -125,55 +84,7 @@ set(SOURCE_FILES
|
|||
add_executable(${PROJECT_NAME}
|
||||
${SOURCE_FILES})
|
||||
|
||||
# Get the current working branch
|
||||
execute_process(
|
||||
COMMAND git rev-parse --abbrev-ref HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_BRANCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# http://xit0.org/2013/04/cmake-use-git-branch-and-commit-details-in-project/
|
||||
# Get the latest abbreviated commit hash of the working branch
|
||||
execute_process(
|
||||
COMMAND git log -1 --format=%h
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# Get the date and time of last commit
|
||||
execute_process(
|
||||
COMMAND git log -1 --format=%cd --date=short
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_COMMIT_DATETIME
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/src/version.h.in
|
||||
${CMAKE_BINARY_DIR}/gen/version.h
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_BINARY_DIR}/gen)
|
||||
|
||||
macro(configure_files srcDir destDir)
|
||||
message(STATUS "Configuring directory ${destDir}")
|
||||
make_directory(${destDir})
|
||||
|
||||
file(GLOB templateFiles RELATIVE ${srcDir} ${srcDir}/*)
|
||||
foreach(templateFile ${templateFiles})
|
||||
set(srcTemplatePath ${srcDir}/${templateFile})
|
||||
if(NOT IS_DIRECTORY ${srcTemplatePath})
|
||||
message(STATUS "Configuring file ${templateFile}")
|
||||
configure_file(
|
||||
${srcTemplatePath}
|
||||
${destDir}/${templateFile}
|
||||
@ONLY)
|
||||
endif(NOT IS_DIRECTORY ${srcTemplatePath})
|
||||
endforeach(templateFile)
|
||||
endmacro(configure_files)
|
||||
create_git_version()
|
||||
|
||||
configure_files(${CMAKE_CURRENT_SOURCE_DIR}/src/templates ${CMAKE_CURRENT_BINARY_DIR}/templates)
|
||||
configure_files(${CMAKE_CURRENT_SOURCE_DIR}/src/templates/css ${CMAKE_CURRENT_BINARY_DIR}/templates/css)
|
||||
|
@ -196,6 +107,7 @@ set(LIBRARIES
|
|||
common
|
||||
mnemonics
|
||||
epee
|
||||
easylogging
|
||||
${Boost_LIBRARIES}
|
||||
pthread
|
||||
unbound
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue