From e7d21494b4465438a50a7b8c7ac0a99b5259708e Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Thu, 23 Feb 2017 23:44:23 +0000 Subject: [PATCH] versioning added to CMakeLists.txt --- CMakeLists.txt | 56 ++++++++++++++++++++++++++++++++------ README.md | 25 ++++++++++++----- src/CMakeLists.txt | 3 +- src/YourMoneroRequests.cpp | 1 + src/YourMoneroRequests.h | 2 ++ src/monero_headers.h | 2 ++ src/version.h.in | 13 +++++++++ 7 files changed, 85 insertions(+), 17 deletions(-) create mode 100644 src/version.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 4308cda..7d23d10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,13 @@ cmake_minimum_required(VERSION 3.2) -project(restbed_xmr) + +set(PROJECT_NAME + openmonero) + +project(${PROJECT_NAME}) + set(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -std=c++14") + "${CMAKE_CXX_FLAGS} -std=c++11") # find boost find_package(Boost COMPONENTS @@ -30,6 +35,7 @@ set(MONERO_HEADERS_DIR include_directories( ${MONERO_HEADERS_DIR}/src ${MONERO_HEADERS_DIR}/external + ${MONERO_HEADERS_DIR}/build ${MONERO_HEADERS_DIR}/external/easylogging++ ${MONERO_HEADERS_DIR}/contrib/epee/include ${MONERO_HEADERS_DIR}/external/db_drivers/liblmdb) @@ -97,13 +103,39 @@ include_directories(${Boost_INCLUDE_DIRS}) include_directories( "ext/restbed/source") -# add src/ subfolder -add_subdirectory(src/) -# add ext/ subfolder -add_subdirectory(ext/) +# 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}") @@ -125,14 +157,20 @@ endmacro(configure_files) configure_files(${CMAKE_CURRENT_SOURCE_DIR}/config ${CMAKE_CURRENT_BINARY_DIR}/config) +# add src/ subfolder +add_subdirectory(src/) + +# add ext/ subfolder +add_subdirectory(ext/) + + set(SOURCE_FILES main.cpp) -add_executable(restbed_xmr +add_executable(${PROJECT_NAME} ${SOURCE_FILES}) - -target_link_libraries(restbed_xmr +target_link_libraries(${PROJECT_NAME} myxrm myext restbed diff --git a/README.md b/README.md index c103414..d5bf153 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,10 @@ to use, host and modify. Additionally, the following features were added/changed - added dynamic fees for testnet. - minimum mixin set to 4. +## Screenshot + +![Open Monero](https://raw.githubusercontent.com/moneroexamples/restbed-xmr/master/screenshot/screen1.png) + ## Limitations @@ -37,7 +41,6 @@ Open Monero is not as fast as MyMonero. This is because it is basic, easy to und they can't be restarted without user logging in back, as Open Monero does not store viewkeys. - ## Host it yourself The Open Monero consists of four components that need to be setup for it to work: @@ -54,19 +57,25 @@ The Open Monero consists of four components that need to be setup for it to work with Monero deamon. -## Screenshot +## Example setup on Ubuntu 16.04 -![Open Monero](https://raw.githubusercontent.com/moneroexamples/restbed-xmr/master/screenshot/screen1.png) +Below are example instructions on how to setup up and run Open Monero on Ubuntu 16.04. + +#### Mysql/Mariadb + +#### Lighttpd -## Compilation on Ubuntu +#### Monero libraries -Before proceeding, please make sure that Monero's libraries and header files are setup correctly, -as shown here: +Monero's libraries and header files are setup is described here: - [compile-monero-on-ubuntu-16-04](https://github.com/moneroexamples/compile-monero-09-on-ubuntu-16-04) +#### Compilation of the Open Monero + ```bash -sudo apt install libmysql++-dev +# need mysql++ libraries +sudo apt install libmysql++-dev git clone https://github.com/moneroexamples/restbed-xmr.git @@ -79,6 +88,8 @@ cmake .. make ``` +#### Run Open Monero + ## Scrap notes ### Generate your own ssl certificate diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 611c9ff..a0627ff 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,7 +12,8 @@ set(SOURCE_FILES ssqlses.cpp YourMoneroRequests.cpp TxSearch.cpp - OutputInputIdentification.cpp) + OutputInputIdentification.cpp + version.h.in) # make static library called libmyxrm # that we are going to link to diff --git a/src/YourMoneroRequests.cpp b/src/YourMoneroRequests.cpp index 2db0c1d..67229c2 100644 --- a/src/YourMoneroRequests.cpp +++ b/src/YourMoneroRequests.cpp @@ -4,6 +4,7 @@ #define MYSQLPP_SSQLS_NO_STATICS 1 + #include "YourMoneroRequests.h" #include "ssqlses.h" diff --git a/src/YourMoneroRequests.h b/src/YourMoneroRequests.h index ede1109..54a9ca2 100644 --- a/src/YourMoneroRequests.h +++ b/src/YourMoneroRequests.h @@ -9,6 +9,8 @@ #include +#include "version.h" + #include "CurrentBlockchainStatus.h" #include "MySqlAccounts.h" diff --git a/src/monero_headers.h b/src/monero_headers.h index df9b0f2..2a7907d 100644 --- a/src/monero_headers.h +++ b/src/monero_headers.h @@ -16,6 +16,8 @@ #define FEE_ESTIMATE_GRACE_BLOCKS 10 +#include "release/version/version.h" + #include "net/http_client.h" #include "storages/http_abstract_invoke.h" diff --git a/src/version.h.in b/src/version.h.in new file mode 100644 index 0000000..ef62e86 --- /dev/null +++ b/src/version.h.in @@ -0,0 +1,13 @@ +// +// Created by mwo on 23/11/16. +// + +#ifndef XMRBLOCKS_VERSION_H_IN_H +#define XMRBLOCKS_VERSION_H_IN_H + +#define GIT_BRANCH "@GIT_BRANCH@" +#define GIT_COMMIT_HASH "@GIT_COMMIT_HASH@" +#define GIT_COMMIT_DATETIME "@GIT_COMMIT_DATETIME@" + + +#endif //XMRBLOCKS_VERSION_H_IN_H