mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 10:37:37 -07:00
build: auto update version info without manually deleting version.h
This commit is contained in:
parent
a6403846ef
commit
e29282d208
@ -186,7 +186,7 @@ endif()
|
|||||||
# elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
|
# elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
|
||||||
# set(BSDI TRUE)
|
# 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)
|
if(APPLE)
|
||||||
include_directories(SYSTEM /usr/include/malloc)
|
include_directories(SYSTEM /usr/include/malloc)
|
||||||
|
@ -96,6 +96,9 @@ function (monero_add_library name)
|
|||||||
PRIVATE $<TARGET_PROPERTY:${name},INTERFACE_COMPILE_DEFINITIONS>)
|
PRIVATE $<TARGET_PROPERTY:${name},INTERFACE_COMPILE_DEFINITIONS>)
|
||||||
endfunction ()
|
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(common)
|
||||||
add_subdirectory(crypto)
|
add_subdirectory(crypto)
|
||||||
add_subdirectory(ringct)
|
add_subdirectory(ringct)
|
||||||
|
@ -77,6 +77,7 @@ target_link_libraries(blockchain_import
|
|||||||
cryptonote_core
|
cryptonote_core
|
||||||
blockchain_db
|
blockchain_db
|
||||||
p2p
|
p2p
|
||||||
|
version
|
||||||
epee
|
epee
|
||||||
${Boost_FILESYSTEM_LIBRARY}
|
${Boost_FILESYSTEM_LIBRARY}
|
||||||
${Boost_SYSTEM_LIBRARY}
|
${Boost_SYSTEM_LIBRARY}
|
||||||
@ -89,8 +90,6 @@ if(ARCH_WIDTH)
|
|||||||
PUBLIC -DARCH_WIDTH=${ARCH_WIDTH})
|
PUBLIC -DARCH_WIDTH=${ARCH_WIDTH})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_dependencies(blockchain_import
|
|
||||||
version)
|
|
||||||
set_property(TARGET blockchain_import
|
set_property(TARGET blockchain_import
|
||||||
PROPERTY
|
PROPERTY
|
||||||
OUTPUT_NAME "monero-blockchain-import")
|
OUTPUT_NAME "monero-blockchain-import")
|
||||||
@ -104,6 +103,7 @@ target_link_libraries(blockchain_export
|
|||||||
cryptonote_core
|
cryptonote_core
|
||||||
blockchain_db
|
blockchain_db
|
||||||
p2p
|
p2p
|
||||||
|
version
|
||||||
epee
|
epee
|
||||||
${Boost_FILESYSTEM_LIBRARY}
|
${Boost_FILESYSTEM_LIBRARY}
|
||||||
${Boost_SYSTEM_LIBRARY}
|
${Boost_SYSTEM_LIBRARY}
|
||||||
@ -111,8 +111,6 @@ target_link_libraries(blockchain_export
|
|||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
${EXTRA_LIBRARIES})
|
${EXTRA_LIBRARIES})
|
||||||
|
|
||||||
add_dependencies(blockchain_export
|
|
||||||
version)
|
|
||||||
set_property(TARGET blockchain_export
|
set_property(TARGET blockchain_export
|
||||||
PROPERTY
|
PROPERTY
|
||||||
OUTPUT_NAME "monero-blockchain-export")
|
OUTPUT_NAME "monero-blockchain-export")
|
||||||
|
@ -55,6 +55,7 @@ monero_add_library(cryptonote_core
|
|||||||
${cryptonote_core_private_headers})
|
${cryptonote_core_private_headers})
|
||||||
target_link_libraries(cryptonote_core
|
target_link_libraries(cryptonote_core
|
||||||
PUBLIC
|
PUBLIC
|
||||||
|
version
|
||||||
common
|
common
|
||||||
cncrypto
|
cncrypto
|
||||||
blockchain_db
|
blockchain_db
|
||||||
|
@ -39,5 +39,3 @@ target_link_libraries(cryptonote_protocol
|
|||||||
p2p
|
p2p
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${EXTRA_LIBRARIES})
|
${EXTRA_LIBRARIES})
|
||||||
add_dependencies(cryptonote_protocol
|
|
||||||
version)
|
|
||||||
|
@ -94,6 +94,7 @@ target_link_libraries(daemon
|
|||||||
daemonizer
|
daemonizer
|
||||||
serialization
|
serialization
|
||||||
daemon_rpc_server
|
daemon_rpc_server
|
||||||
|
version
|
||||||
${Boost_CHRONO_LIBRARY}
|
${Boost_CHRONO_LIBRARY}
|
||||||
${Boost_FILESYSTEM_LIBRARY}
|
${Boost_FILESYSTEM_LIBRARY}
|
||||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||||
@ -102,7 +103,6 @@ target_link_libraries(daemon
|
|||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
${ZMQ_LIB}
|
${ZMQ_LIB}
|
||||||
${EXTRA_LIBRARIES})
|
${EXTRA_LIBRARIES})
|
||||||
add_dependencies(daemon version)
|
|
||||||
set_property(TARGET daemon
|
set_property(TARGET daemon
|
||||||
PROPERTY
|
PROPERTY
|
||||||
OUTPUT_NAME "monerod")
|
OUTPUT_NAME "monerod")
|
||||||
|
@ -42,8 +42,6 @@ target_link_libraries(cn_deserialize
|
|||||||
epee
|
epee
|
||||||
${CMAKE_THREAD_LIBS_INIT})
|
${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
|
||||||
add_dependencies(cn_deserialize
|
|
||||||
version)
|
|
||||||
set_property(TARGET cn_deserialize
|
set_property(TARGET cn_deserialize
|
||||||
PROPERTY
|
PROPERTY
|
||||||
OUTPUT_NAME "monero-utils-deserialize")
|
OUTPUT_NAME "monero-utils-deserialize")
|
||||||
@ -65,8 +63,6 @@ target_link_libraries(object_sizes
|
|||||||
epee
|
epee
|
||||||
${CMAKE_THREAD_LIBS_INIT})
|
${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
|
||||||
add_dependencies(object_sizes
|
|
||||||
version)
|
|
||||||
set_property(TARGET object_sizes
|
set_property(TARGET object_sizes
|
||||||
PROPERTY
|
PROPERTY
|
||||||
OUTPUT_NAME "monero-utils-object-sizes")
|
OUTPUT_NAME "monero-utils-object-sizes")
|
||||||
|
@ -47,5 +47,3 @@ target_link_libraries(p2p
|
|||||||
${Boost_THREAD_LIBRARY}
|
${Boost_THREAD_LIBRARY}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${EXTRA_LIBRARIES})
|
${EXTRA_LIBRARIES})
|
||||||
add_dependencies(p2p
|
|
||||||
version)
|
|
||||||
|
@ -117,10 +117,3 @@ target_link_libraries(daemon_rpc_server
|
|||||||
${EXTRA_LIBRARIES})
|
${EXTRA_LIBRARIES})
|
||||||
target_include_directories(daemon_rpc_server PUBLIC ${ZMQ_INCLUDE_PATH})
|
target_include_directories(daemon_rpc_server PUBLIC ${ZMQ_INCLUDE_PATH})
|
||||||
target_include_directories(obj_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)
|
|
||||||
|
@ -49,14 +49,13 @@ target_link_libraries(simplewallet
|
|||||||
common
|
common
|
||||||
mnemonics
|
mnemonics
|
||||||
p2p
|
p2p
|
||||||
|
version
|
||||||
${Boost_CHRONO_LIBRARY}
|
${Boost_CHRONO_LIBRARY}
|
||||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||||
${Boost_FILESYSTEM_LIBRARY}
|
${Boost_FILESYSTEM_LIBRARY}
|
||||||
${Boost_THREAD_LIBRARY}
|
${Boost_THREAD_LIBRARY}
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
${EXTRA_LIBRARIES})
|
${EXTRA_LIBRARIES})
|
||||||
add_dependencies(simplewallet
|
|
||||||
version)
|
|
||||||
set_property(TARGET simplewallet
|
set_property(TARGET simplewallet
|
||||||
PROPERTY
|
PROPERTY
|
||||||
OUTPUT_NAME "monero-wallet-cli")
|
OUTPUT_NAME "monero-wallet-cli")
|
||||||
|
@ -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.")
|
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")
|
set(VERSIONTAG "unknown")
|
||||||
configure_file("src/version.h.in" "${TO}")
|
configure_file("src/version.cpp.in" "${TO}")
|
||||||
else()
|
else()
|
||||||
message(STATUS "You are currently on commit ${COMMIT}")
|
message(STATUS "You are currently on commit ${COMMIT}")
|
||||||
|
|
||||||
@ -59,5 +59,5 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
configure_file("src/version.h.in" "${TO}")
|
configure_file("src/version.cpp.in" "${TO}")
|
||||||
endif()
|
endif()
|
||||||
|
9
src/version.cpp.in
Normal file
9
src/version.cpp.in
Normal file
@ -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;
|
6
src/version.h
Normal file
6
src/version.h
Normal file
@ -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;
|
@ -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
|
|
@ -84,7 +84,6 @@ target_link_libraries(wallet
|
|||||||
${Boost_REGEX_LIBRARY}
|
${Boost_REGEX_LIBRARY}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${EXTRA_LIBRARIES})
|
${EXTRA_LIBRARIES})
|
||||||
add_dependencies(wallet version)
|
|
||||||
|
|
||||||
if (NOT BUILD_GUI_DEPS)
|
if (NOT BUILD_GUI_DEPS)
|
||||||
set(wallet_rpc_sources
|
set(wallet_rpc_sources
|
||||||
@ -110,13 +109,13 @@ if (NOT BUILD_GUI_DEPS)
|
|||||||
cryptonote_core
|
cryptonote_core
|
||||||
cncrypto
|
cncrypto
|
||||||
common
|
common
|
||||||
|
version
|
||||||
${Boost_CHRONO_LIBRARY}
|
${Boost_CHRONO_LIBRARY}
|
||||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||||
${Boost_FILESYSTEM_LIBRARY}
|
${Boost_FILESYSTEM_LIBRARY}
|
||||||
${Boost_THREAD_LIBRARY}
|
${Boost_THREAD_LIBRARY}
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
${EXTRA_LIBRARIES})
|
${EXTRA_LIBRARIES})
|
||||||
add_dependencies(wallet_rpc_server version)
|
|
||||||
set_property(TARGET wallet_rpc_server
|
set_property(TARGET wallet_rpc_server
|
||||||
PROPERTY
|
PROPERTY
|
||||||
OUTPUT_NAME "monero-wallet-rpc")
|
OUTPUT_NAME "monero-wallet-rpc")
|
||||||
|
@ -40,6 +40,7 @@ target_link_libraries(core_proxy
|
|||||||
cryptonote_core
|
cryptonote_core
|
||||||
cryptonote_protocol
|
cryptonote_protocol
|
||||||
p2p
|
p2p
|
||||||
|
version
|
||||||
epee
|
epee
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
${EXTRA_LIBRARIES})
|
${EXTRA_LIBRARIES})
|
||||||
|
@ -65,6 +65,7 @@ target_link_libraries(coretests
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
cryptonote_core
|
cryptonote_core
|
||||||
p2p
|
p2p
|
||||||
|
version
|
||||||
epee
|
epee
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
${EXTRA_LIBRARIES})
|
${EXTRA_LIBRARIES})
|
||||||
|
@ -40,6 +40,7 @@ add_executable(libwallet_api_tests
|
|||||||
target_link_libraries(libwallet_api_tests
|
target_link_libraries(libwallet_api_tests
|
||||||
PRIVATE
|
PRIVATE
|
||||||
wallet
|
wallet
|
||||||
|
version
|
||||||
epee
|
epee
|
||||||
${Boost_CHRONO_LIBRARY}
|
${Boost_CHRONO_LIBRARY}
|
||||||
${Boost_SERIALIZATION_LIBRARY}
|
${Boost_SERIALIZATION_LIBRARY}
|
||||||
|
@ -78,6 +78,7 @@ target_link_libraries(unit_tests
|
|||||||
rpc
|
rpc
|
||||||
wallet
|
wallet
|
||||||
p2p
|
p2p
|
||||||
|
version
|
||||||
epee
|
epee
|
||||||
${Boost_CHRONO_LIBRARY}
|
${Boost_CHRONO_LIBRARY}
|
||||||
${Boost_THREAD_LIBRARY}
|
${Boost_THREAD_LIBRARY}
|
||||||
|
@ -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)
|
function (write_static_version_header hash)
|
||||||
set(VERSIONTAG "${hash}")
|
set(VERSIONTAG "${hash}")
|
||||||
configure_file("src/version.h.in" "version/version.h")
|
configure_file("src/version.cpp.in" "version.cpp")
|
||||||
add_custom_target(version ALL)
|
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|
||||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/version")
|
|
||||||
find_package(Git QUIET)
|
find_package(Git QUIET)
|
||||||
if ("$Format:$" STREQUAL "")
|
if ("$Format:$" STREQUAL "")
|
||||||
# We're in a tarball; use hard-coded variables.
|
# We're in a tarball; use hard-coded variables.
|
||||||
write_static_version_header("release")
|
write_static_version_header("release")
|
||||||
elseif (GIT_FOUND OR Git_FOUND)
|
elseif (GIT_FOUND OR Git_FOUND)
|
||||||
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
|
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
|
||||||
set(extra_output)
|
add_custom_target(genversion ALL
|
||||||
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}
|
|
||||||
COMMAND "${CMAKE_COMMAND}"
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
"-D" "GIT=${GIT_EXECUTABLE}"
|
"-D" "GIT=${GIT_EXECUTABLE}"
|
||||||
"-D" "TO=${CMAKE_BINARY_DIR}/version/version.h"
|
"-D" "TO=${CMAKE_BINARY_DIR}/version.cpp"
|
||||||
"-P" "src/version.cmake"
|
"-P" "src/version.cmake"
|
||||||
|
BYPRODUCTS "${CMAKE_BINARY_DIR}/version.cpp"
|
||||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
||||||
add_custom_target(version ALL
|
|
||||||
DEPENDS "${CMAKE_BINARY_DIR}/version/version.h")
|
|
||||||
else()
|
else()
|
||||||
message(STATUS "WARNING: Git was not found!")
|
message(STATUS "WARNING: Git was not found!")
|
||||||
write_static_version_header("unknown")
|
write_static_version_header("unknown")
|
||||||
|
Loading…
Reference in New Issue
Block a user