mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-22 12:28:53 +00:00
Merge pull request #2442
e29282d2
build: auto update version info without manually deleting version.h (stoffu)
This commit is contained in:
commit
b911130a46
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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")
|
||||
|
@ -55,6 +55,7 @@ monero_add_library(cryptonote_core
|
||||
${cryptonote_core_private_headers})
|
||||
target_link_libraries(cryptonote_core
|
||||
PUBLIC
|
||||
version
|
||||
common
|
||||
cncrypto
|
||||
blockchain_db
|
||||
|
@ -39,5 +39,3 @@ target_link_libraries(cryptonote_protocol
|
||||
p2p
|
||||
PRIVATE
|
||||
${EXTRA_LIBRARIES})
|
||||
add_dependencies(cryptonote_protocol
|
||||
version)
|
||||
|
@ -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")
|
||||
|
@ -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")
|
||||
|
@ -47,5 +47,3 @@ target_link_libraries(p2p
|
||||
${Boost_THREAD_LIBRARY}
|
||||
PRIVATE
|
||||
${EXTRA_LIBRARIES})
|
||||
add_dependencies(p2p
|
||||
version)
|
||||
|
@ -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)
|
||||
|
@ -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")
|
||||
|
@ -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()
|
||||
|
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}
|
||||
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")
|
||||
|
@ -40,6 +40,7 @@ target_link_libraries(core_proxy
|
||||
cryptonote_core
|
||||
cryptonote_protocol
|
||||
p2p
|
||||
version
|
||||
epee
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${EXTRA_LIBRARIES})
|
||||
|
@ -65,6 +65,7 @@ target_link_libraries(coretests
|
||||
PRIVATE
|
||||
cryptonote_core
|
||||
p2p
|
||||
version
|
||||
epee
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${EXTRA_LIBRARIES})
|
||||
|
@ -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}
|
||||
|
@ -79,6 +79,7 @@ target_link_libraries(unit_tests
|
||||
rpc
|
||||
wallet
|
||||
p2p
|
||||
version
|
||||
epee
|
||||
${Boost_CHRONO_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)
|
||||
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")
|
||||
|
Loading…
Reference in New Issue
Block a user