onion-wownero-blockchain-ex.../CMakeLists.txt

212 lines
5.7 KiB
CMake
Raw Normal View History

2016-04-12 07:15:33 +00:00
cmake_minimum_required(VERSION 2.8)
2016-04-06 06:53:37 +00:00
set(PROJECT_NAME
2016-04-15 21:59:39 +00:00
xmrblocks)
2016-04-06 06:53:37 +00:00
2016-04-12 03:31:26 +00:00
2016-04-06 06:53:37 +00:00
project(${PROJECT_NAME})
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -std=c++14")
2017-02-02 14:17:43 +00:00
if (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj -O3")
endif()
2016-04-06 06:53:37 +00:00
# find boost
find_package(Boost COMPONENTS
system
filesystem
thread
date_time
chrono
regex
serialization
program_options
date_time
REQUIRED)
# set location of monero static libraries
set(MONERO_LIBS_DIR
2016-09-06 10:34:07 +00:00
/opt/monero-dev/libs)
2016-04-06 06:53:37 +00:00
# set location of moneroheaders
set(MONERO_HEADERS_DIR
2016-09-06 10:34:07 +00:00
/opt/monero-dev/headers)
2016-04-06 06:53:37 +00:00
# include monero headers
include_directories(
${MONERO_HEADERS_DIR}/src
${MONERO_HEADERS_DIR}/external
2017-01-30 21:36:32 +00:00
${MONERO_HEADERS_DIR}/build
2016-04-06 06:53:37 +00:00
${MONERO_HEADERS_DIR}/contrib/epee/include
2017-01-16 21:40:07 +00:00
${MONERO_HEADERS_DIR}/external/easylogging++
2016-04-06 06:53:37 +00:00
${MONERO_HEADERS_DIR}/external/db_drivers/liblmdb)
2017-01-13 16:25:36 +00:00
if(APPLE)
include_directories(/usr/local/opt/openssl/include)
link_directories(/usr/local/opt/openssl/lib)
endif()
2016-04-06 06:53:37 +00:00
# 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)
2016-12-19 01:47:19 +00:00
add_library(cryptoxmr STATIC IMPORTED)
set_property(TARGET cryptoxmr
2016-04-06 06:53:37 +00:00
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libcrypto.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)
2016-12-24 08:40:28 +00:00
add_library(mnemonics STATIC IMPORTED)
set_property(TARGET mnemonics
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libmnemonics.a)
2017-01-16 21:40:07 +00:00
add_library(epee STATIC IMPORTED)
set_property(TARGET epee
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libepee.a)
2016-04-06 06:53:37 +00:00
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)
2016-09-06 10:34:07 +00:00
add_library(ringct STATIC IMPORTED)
set_property(TARGET ringct
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libringct.a)
2016-04-06 06:53:37 +00:00
2016-09-28 02:21:14 +00:00
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)
set_property(TARGET unbound PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libunbound.a)
endif()
2017-02-02 14:17:43 +00:00
2016-04-06 06:53:37 +00:00
# include boost headers
include_directories(${Boost_INCLUDE_DIRS})
include_directories("ext/mstch/include")
# add ext/ subfolder
add_subdirectory(ext/)
# add src/ subfolder
add_subdirectory(src/)
set(SOURCE_FILES
main.cpp)
2016-04-12 03:31:26 +00:00
#ADD_CUSTOM_TARGET(driver DEPENDS src/templates/index.html)
2016-04-08 06:14:42 +00:00
2016-04-06 06:53:37 +00:00
add_executable(${PROJECT_NAME}
${SOURCE_FILES})
2016-11-24 00:58:42 +00:00
# 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)
2016-04-12 03:31:26 +00:00
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)
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)
2016-04-30 01:35:48 +00:00
configure_files(${CMAKE_CURRENT_SOURCE_DIR}/src/templates/partials ${CMAKE_CURRENT_BINARY_DIR}/templates/partials)
2016-04-12 03:31:26 +00:00
2017-01-19 05:05:24 +00:00
set(LIBRARIES
2016-04-06 06:53:37 +00:00
myxrm
myext
mstch
2016-09-28 02:21:14 +00:00
wallet
2016-04-06 06:53:37 +00:00
cryptonote_core
cryptonote_protocol
2016-04-06 06:53:37 +00:00
blockchain_db
2016-12-19 01:47:19 +00:00
cryptoxmr
2016-04-06 06:53:37 +00:00
blocks
lmdb
2016-09-06 10:34:07 +00:00
ringct
common
2016-12-24 08:40:28 +00:00
mnemonics
2017-01-16 21:40:07 +00:00
epee
2016-04-06 06:53:37 +00:00
${Boost_LIBRARIES}
pthread
unbound
curl
2016-12-19 01:47:19 +00:00
crypto
ssl)
2017-01-19 05:05:24 +00:00
2017-02-02 14:17:43 +00:00
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT WIN32)
2017-01-19 05:05:24 +00:00
set(LIBRARIES ${LIBRARIES} unwind)
2017-01-13 16:25:36 +00:00
endif()
2017-01-19 05:05:24 +00:00
2017-02-02 14:17:43 +00:00
if (WIN32)
set(LIBRARIES ${LIBRARIES}
wsock32
ntdll
ws2_32
Iphlpapi
)
else()
set(LIBRARIES ${LIBRARIES} dl)
endif()
2017-01-19 05:05:24 +00:00
target_link_libraries(${PROJECT_NAME} ${LIBRARIES})