aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/blockchain_utilities/CMakeLists.txt6
-rw-r--r--src/cryptonote_core/CMakeLists.txt1
-rw-r--r--src/cryptonote_protocol/CMakeLists.txt2
-rw-r--r--src/daemon/CMakeLists.txt2
-rw-r--r--src/debug_utilities/CMakeLists.txt4
-rw-r--r--src/p2p/CMakeLists.txt2
-rw-r--r--src/rpc/CMakeLists.txt7
-rw-r--r--src/simplewallet/CMakeLists.txt3
-rw-r--r--src/version.cmake4
-rw-r--r--src/version.cpp.in9
-rw-r--r--src/version.h6
-rw-r--r--src/version.h.in4
-rw-r--r--src/wallet/CMakeLists.txt3
-rw-r--r--tests/core_proxy/CMakeLists.txt1
-rw-r--r--tests/core_tests/CMakeLists.txt1
-rw-r--r--tests/libwallet_api_tests/CMakeLists.txt1
-rw-r--r--tests/unit_tests/CMakeLists.txt1
-rw-r--r--version.cmake47
20 files changed, 63 insertions, 46 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 486a80b4e..842eea734 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -186,7 +186,7 @@ endif()
# elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
# set(BSDI TRUE)
-include_directories(external/easylogging++ src contrib/epee/include external "${CMAKE_BINARY_DIR}/version")
+include_directories(external/easylogging++ src contrib/epee/include external)
if(APPLE)
include_directories(SYSTEM /usr/include/malloc)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e3cb7cfd6..3e0bfb59c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -96,6 +96,9 @@ function (monero_add_library name)
PRIVATE $<TARGET_PROPERTY:${name},INTERFACE_COMPILE_DEFINITIONS>)
endfunction ()
+set_source_files_properties(${CMAKE_BINARY_DIR}/version.cpp PROPERTIES GENERATED ON)
+monero_add_library(version ${CMAKE_BINARY_DIR}/version.cpp)
+
add_subdirectory(common)
add_subdirectory(crypto)
add_subdirectory(ringct)
diff --git a/src/blockchain_utilities/CMakeLists.txt b/src/blockchain_utilities/CMakeLists.txt
index ffdaad4af..0eaf71084 100644
--- a/src/blockchain_utilities/CMakeLists.txt
+++ b/src/blockchain_utilities/CMakeLists.txt
@@ -77,6 +77,7 @@ target_link_libraries(blockchain_import
cryptonote_core
blockchain_db
p2p
+ version
epee
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
@@ -89,8 +90,6 @@ if(ARCH_WIDTH)
PUBLIC -DARCH_WIDTH=${ARCH_WIDTH})
endif()
-add_dependencies(blockchain_import
- version)
set_property(TARGET blockchain_import
PROPERTY
OUTPUT_NAME "monero-blockchain-import")
@@ -104,6 +103,7 @@ target_link_libraries(blockchain_export
cryptonote_core
blockchain_db
p2p
+ version
epee
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
@@ -111,8 +111,6 @@ target_link_libraries(blockchain_export
${CMAKE_THREAD_LIBS_INIT}
${EXTRA_LIBRARIES})
-add_dependencies(blockchain_export
- version)
set_property(TARGET blockchain_export
PROPERTY
OUTPUT_NAME "monero-blockchain-export")
diff --git a/src/cryptonote_core/CMakeLists.txt b/src/cryptonote_core/CMakeLists.txt
index 7c43323d4..7b73eebd1 100644
--- a/src/cryptonote_core/CMakeLists.txt
+++ b/src/cryptonote_core/CMakeLists.txt
@@ -55,6 +55,7 @@ monero_add_library(cryptonote_core
${cryptonote_core_private_headers})
target_link_libraries(cryptonote_core
PUBLIC
+ version
common
cncrypto
blockchain_db
diff --git a/src/cryptonote_protocol/CMakeLists.txt b/src/cryptonote_protocol/CMakeLists.txt
index 4ce380a48..347e48eee 100644
--- a/src/cryptonote_protocol/CMakeLists.txt
+++ b/src/cryptonote_protocol/CMakeLists.txt
@@ -39,5 +39,3 @@ target_link_libraries(cryptonote_protocol
p2p
PRIVATE
${EXTRA_LIBRARIES})
-add_dependencies(cryptonote_protocol
- version)
diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt
index 782667867..d0fc1d846 100644
--- a/src/daemon/CMakeLists.txt
+++ b/src/daemon/CMakeLists.txt
@@ -94,6 +94,7 @@ target_link_libraries(daemon
daemonizer
serialization
daemon_rpc_server
+ version
${Boost_CHRONO_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
@@ -102,7 +103,6 @@ target_link_libraries(daemon
${CMAKE_THREAD_LIBS_INIT}
${ZMQ_LIB}
${EXTRA_LIBRARIES})
-add_dependencies(daemon version)
set_property(TARGET daemon
PROPERTY
OUTPUT_NAME "monerod")
diff --git a/src/debug_utilities/CMakeLists.txt b/src/debug_utilities/CMakeLists.txt
index 99198dc57..7a82c12d9 100644
--- a/src/debug_utilities/CMakeLists.txt
+++ b/src/debug_utilities/CMakeLists.txt
@@ -42,8 +42,6 @@ target_link_libraries(cn_deserialize
epee
${CMAKE_THREAD_LIBS_INIT})
-add_dependencies(cn_deserialize
- version)
set_property(TARGET cn_deserialize
PROPERTY
OUTPUT_NAME "monero-utils-deserialize")
@@ -65,8 +63,6 @@ target_link_libraries(object_sizes
epee
${CMAKE_THREAD_LIBS_INIT})
-add_dependencies(object_sizes
- version)
set_property(TARGET object_sizes
PROPERTY
OUTPUT_NAME "monero-utils-object-sizes")
diff --git a/src/p2p/CMakeLists.txt b/src/p2p/CMakeLists.txt
index 0704940b5..2e34db5d1 100644
--- a/src/p2p/CMakeLists.txt
+++ b/src/p2p/CMakeLists.txt
@@ -47,5 +47,3 @@ target_link_libraries(p2p
${Boost_THREAD_LIBRARY}
PRIVATE
${EXTRA_LIBRARIES})
-add_dependencies(p2p
- version)
diff --git a/src/rpc/CMakeLists.txt b/src/rpc/CMakeLists.txt
index b5c38b1a8..23bb6aaae 100644
--- a/src/rpc/CMakeLists.txt
+++ b/src/rpc/CMakeLists.txt
@@ -117,10 +117,3 @@ target_link_libraries(daemon_rpc_server
${EXTRA_LIBRARIES})
target_include_directories(daemon_rpc_server PUBLIC ${ZMQ_INCLUDE_PATH})
target_include_directories(obj_daemon_rpc_server PUBLIC ${ZMQ_INCLUDE_PATH})
-
-
-add_dependencies(rpc
- version)
-
-add_dependencies(daemon_rpc_server
- version)
diff --git a/src/simplewallet/CMakeLists.txt b/src/simplewallet/CMakeLists.txt
index 443e9b87e..b56085b8f 100644
--- a/src/simplewallet/CMakeLists.txt
+++ b/src/simplewallet/CMakeLists.txt
@@ -49,14 +49,13 @@ target_link_libraries(simplewallet
common
mnemonics
p2p
+ version
${Boost_CHRONO_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${EXTRA_LIBRARIES})
-add_dependencies(simplewallet
- version)
set_property(TARGET simplewallet
PROPERTY
OUTPUT_NAME "monero-wallet-cli")
diff --git a/src/version.cmake b/src/version.cmake
index 623d3cf1f..45a97cd20 100644
--- a/src/version.cmake
+++ b/src/version.cmake
@@ -36,7 +36,7 @@ if(RET)
message(WARNING "Cannot determine current commit. Make sure that you are building either from a Git working tree or from a source archive.")
set(VERSIONTAG "unknown")
- configure_file("src/version.h.in" "${TO}")
+ configure_file("src/version.cpp.in" "${TO}")
else()
message(STATUS "You are currently on commit ${COMMIT}")
@@ -59,5 +59,5 @@ else()
endif()
endif()
- configure_file("src/version.h.in" "${TO}")
+ configure_file("src/version.cpp.in" "${TO}")
endif()
diff --git a/src/version.cpp.in b/src/version.cpp.in
new file mode 100644
index 000000000..320a8d58a
--- /dev/null
+++ b/src/version.cpp.in
@@ -0,0 +1,9 @@
+#define DEF_MONERO_VERSION_TAG "@VERSIONTAG@"
+#define DEF_MONERO_VERSION "0.11.0.0"
+#define DEF_MONERO_RELEASE_NAME "Helium Hydra"
+#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
+
+const char* const MONERO_VERSION_TAG = DEF_MONERO_VERSION_TAG;
+const char* const MONERO_VERSION = DEF_MONERO_VERSION;
+const char* const MONERO_RELEASE_NAME = DEF_MONERO_RELEASE_NAME;
+const char* const MONERO_VERSION_FULL = DEF_MONERO_VERSION_FULL;
diff --git a/src/version.h b/src/version.h
new file mode 100644
index 000000000..d1d06c790
--- /dev/null
+++ b/src/version.h
@@ -0,0 +1,6 @@
+#pragma once
+
+extern const char* const MONERO_VERSION_TAG;
+extern const char* const MONERO_VERSION;
+extern const char* const MONERO_RELEASE_NAME;
+extern const char* const MONERO_VERSION_FULL;
diff --git a/src/version.h.in b/src/version.h.in
deleted file mode 100644
index 281b52db4..000000000
--- a/src/version.h.in
+++ /dev/null
@@ -1,4 +0,0 @@
-#define MONERO_VERSION_TAG "@VERSIONTAG@"
-#define MONERO_VERSION "0.11.0.0"
-#define MONERO_RELEASE_NAME "Helium Hydra"
-#define MONERO_VERSION_FULL MONERO_VERSION "-" MONERO_VERSION_TAG
diff --git a/src/wallet/CMakeLists.txt b/src/wallet/CMakeLists.txt
index 639080051..fe87d0de1 100644
--- a/src/wallet/CMakeLists.txt
+++ b/src/wallet/CMakeLists.txt
@@ -84,7 +84,6 @@ target_link_libraries(wallet
${Boost_REGEX_LIBRARY}
PRIVATE
${EXTRA_LIBRARIES})
-add_dependencies(wallet version)
if (NOT BUILD_GUI_DEPS)
set(wallet_rpc_sources
@@ -110,13 +109,13 @@ if (NOT BUILD_GUI_DEPS)
cryptonote_core
cncrypto
common
+ version
${Boost_CHRONO_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${EXTRA_LIBRARIES})
- add_dependencies(wallet_rpc_server version)
set_property(TARGET wallet_rpc_server
PROPERTY
OUTPUT_NAME "monero-wallet-rpc")
diff --git a/tests/core_proxy/CMakeLists.txt b/tests/core_proxy/CMakeLists.txt
index d22fecc9c..d2dc93cf0 100644
--- a/tests/core_proxy/CMakeLists.txt
+++ b/tests/core_proxy/CMakeLists.txt
@@ -40,6 +40,7 @@ target_link_libraries(core_proxy
cryptonote_core
cryptonote_protocol
p2p
+ version
epee
${CMAKE_THREAD_LIBS_INIT}
${EXTRA_LIBRARIES})
diff --git a/tests/core_tests/CMakeLists.txt b/tests/core_tests/CMakeLists.txt
index c1d3161bc..a24bd4fce 100644
--- a/tests/core_tests/CMakeLists.txt
+++ b/tests/core_tests/CMakeLists.txt
@@ -65,6 +65,7 @@ target_link_libraries(coretests
PRIVATE
cryptonote_core
p2p
+ version
epee
${CMAKE_THREAD_LIBS_INIT}
${EXTRA_LIBRARIES})
diff --git a/tests/libwallet_api_tests/CMakeLists.txt b/tests/libwallet_api_tests/CMakeLists.txt
index 51375440b..4c5542d91 100644
--- a/tests/libwallet_api_tests/CMakeLists.txt
+++ b/tests/libwallet_api_tests/CMakeLists.txt
@@ -40,6 +40,7 @@ add_executable(libwallet_api_tests
target_link_libraries(libwallet_api_tests
PRIVATE
wallet
+ version
epee
${Boost_CHRONO_LIBRARY}
${Boost_SERIALIZATION_LIBRARY}
diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt
index a7f120443..63abe928d 100644
--- a/tests/unit_tests/CMakeLists.txt
+++ b/tests/unit_tests/CMakeLists.txt
@@ -79,6 +79,7 @@ target_link_libraries(unit_tests
rpc
wallet
p2p
+ version
epee
${Boost_CHRONO_LIBRARY}
${Boost_THREAD_LIBRARY}
diff --git a/version.cmake b/version.cmake
index 80f1c40b8..75343c381 100644
--- a/version.cmake
+++ b/version.cmake
@@ -1,32 +1,49 @@
+# Copyright (c) 2014-2017, The Monero Project
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this list of
+# conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice, this list
+# of conditions and the following disclaimer in the documentation and/or other
+# materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors may be
+# used to endorse or promote products derived from this software without specific
+# prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
function (write_static_version_header hash)
set(VERSIONTAG "${hash}")
- configure_file("src/version.h.in" "version/version.h")
- add_custom_target(version ALL)
+ configure_file("src/version.cpp.in" "version.cpp")
endfunction ()
-file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/version")
find_package(Git QUIET)
if ("$Format:$" STREQUAL "")
# We're in a tarball; use hard-coded variables.
write_static_version_header("release")
elseif (GIT_FOUND OR Git_FOUND)
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
- set(extra_output)
- if (CMAKE_GENERATOR MATCHES "Ninja")
- # Ninja will not rerun the command every time if the file doesn't change,
- # so inject this bogus output so that it always runs.
- set(extra_output "${CMAKE_SOURCE_DIR}/.force-git-version-check")
- endif ()
- add_custom_command(
- OUTPUT "${CMAKE_BINARY_DIR}/version/version.h"
- ${extra_output}
+ add_custom_target(genversion ALL
COMMAND "${CMAKE_COMMAND}"
"-D" "GIT=${GIT_EXECUTABLE}"
- "-D" "TO=${CMAKE_BINARY_DIR}/version/version.h"
+ "-D" "TO=${CMAKE_BINARY_DIR}/version.cpp"
"-P" "src/version.cmake"
+ BYPRODUCTS "${CMAKE_BINARY_DIR}/version.cpp"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
- add_custom_target(version ALL
- DEPENDS "${CMAKE_BINARY_DIR}/version/version.h")
else()
message(STATUS "WARNING: Git was not found!")
write_static_version_header("unknown")