Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ endif()
set(PACKAGE_NAME "Tapyrus Core")
set(CLIENT_VERSION_MAJOR 0)
set(CLIENT_VERSION_MINOR 7)
set(CLIENT_VERSION_REVISION 0)
set(CLIENT_VERSION_BUILD 1)
set(CLIENT_VERSION_BUILD 2)
set(CLIENT_VERSION_RC 0)
set(CLIENT_VERSION_IS_RELEASE "true")

Expand Down
37 changes: 36 additions & 1 deletion cmake/module/AddWindowsResources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,40 @@

include_guard(GLOBAL)

# Generate a per-binary VERSIONINFO .rc file from the shared
# src/tapyrus-win-res.rc.in template, substituting the binary's name and
# description. Sets ${out_var} in the caller's scope to the generated file's
# path so it can be passed straight to add_windows_resources().
#
# Optional keyword args:
# PRODUCT_NAME <name> - StringFileInfo ProductName, if it differs from the
# binary name (e.g. the GUI binary is "tapyrus-qt"
# but its product name is the "Tapyrus Core" brand).
# Defaults to binary_name.
# ICON <path> - absolute path to a .ico file to embed as IDI_ICON1
# (only the GUI binary needs this). Omitted entirely
# if not given.
function(configure_windows_rc binary_name file_description out_var)
cmake_parse_arguments(RC "" "PRODUCT_NAME;ICON" "" ${ARGN})
if(NOT RC_PRODUCT_NAME)
set(RC_PRODUCT_NAME ${binary_name})
endif()
set(TAPYRUS_RC_BINARY_NAME ${binary_name})
set(TAPYRUS_RC_FILE_DESCRIPTION ${file_description})
set(TAPYRUS_RC_PRODUCT_NAME ${RC_PRODUCT_NAME})
if(RC_ICON)
set(TAPYRUS_RC_ICON_LINE "IDI_ICON1 ICON DISCARDABLE \"${RC_ICON}\"")
else()
set(TAPYRUS_RC_ICON_LINE "")
endif()
set(rc_file ${CMAKE_CURRENT_BINARY_DIR}/${binary_name}-res.rc)
# Always resolve the shared template relative to the project root, not the
# caller's CMAKE_CURRENT_SOURCE_DIR, since this is called from multiple
# subdirectories (src/, src/qt/).
configure_file(${PROJECT_SOURCE_DIR}/src/tapyrus-win-res.rc.in ${rc_file} @ONLY)
set(${out_var} ${rc_file} PARENT_SCOPE)
endfunction()

macro(add_windows_resources target rc_file)
if(WIN32)
target_sources(${target} PRIVATE ${rc_file})
Expand All @@ -12,7 +46,8 @@ macro(add_windows_resources target rc_file)
)
# Disable automatic include directory propagation for .rc files
# because windres cannot handle CMake generator expressions.
# The .rc files use relative paths for their includes anyway.
# The generated .rc files only include <windows.h>, which windres
# finds via its own toolchain search path.
set_source_files_properties(${rc_file} PROPERTIES
INCLUDE_DIRECTORIES ""
COMPILE_OPTIONS ""
Expand Down
3 changes: 0 additions & 3 deletions cmake/tapyrus-build-config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
/* Minor version */
#define CLIENT_VERSION_MINOR @CLIENT_VERSION_MINOR@

/* Revision */
#define CLIENT_VERSION_REVISION @CLIENT_VERSION_REVISION@

/* Copyright holder(s) before %s replacement */
#define COPYRIGHT_HOLDERS "@COPYRIGHT_HOLDERS@"

Expand Down
6 changes: 3 additions & 3 deletions share/qt/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
<string>APPL</string>

<key>CFBundleGetInfoString</key>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@, Copyright © 2009-@COPYRIGHT_YEAR@ @COPYRIGHT_HOLDERS_FINAL@</string>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_BUILD@, Copyright © 2009-@COPYRIGHT_YEAR@ @COPYRIGHT_HOLDERS_FINAL@</string>

<key>CFBundleShortVersionString</key>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@</string>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_BUILD@</string>

<key>CFBundleVersion</key>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@</string>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_BUILD@</string>

<key>CFBundleSignature</key>
<string>????</string>
Expand Down
4 changes: 2 additions & 2 deletions share/setup.nsi.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SetCompressor /SOLID lzma

# General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)"
!define VERSION @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@
!define VERSION @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_BUILD@
!define COMPANY "@PACKAGE_NAME@ project"
!define URL @PACKAGE_URL@

Expand Down Expand Up @@ -59,7 +59,7 @@ CRCCheck on
XPStyle on
BrandingText " "
ShowInstDetails show
VIProductVersion ${VERSION}.@CLIENT_VERSION_BUILD@
VIProductVersion ${VERSION}.0
VIAddVersionKey ProductName "@PACKAGE_NAME@"
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey CompanyName "${COMPANY}"
Expand Down
14 changes: 10 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
include(AddWindowsResources)

configure_file(${PROJECT_SOURCE_DIR}/cmake/tapyrus-build-config.h.in tapyrus-config.h USE_SOURCE_PERMISSIONS @ONLY)
if(WIN32)
configure_windows_rc(tapyrusd "tapyrusd (Tapyrus node with a JSON-RPC server)" TAPYRUSD_RC_FILE)
configure_windows_rc(tapyrus-cli "tapyrus-cli (JSON-RPC client for ${PACKAGE_NAME})" TAPYRUS_CLI_RC_FILE)
configure_windows_rc(tapyrus-tx "tapyrus-tx (CLI Tapyrus transaction editor utility)" TAPYRUS_TX_RC_FILE)
configure_windows_rc(tapyrus-genesis "tapyrus-genesis (CLI Tapyrus genesis block generate utility)" TAPYRUS_GENESIS_RC_FILE)
endif()
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})

include(AddBoostIfNeeded)
Expand Down Expand Up @@ -264,7 +270,7 @@ if(BUILD_DAEMON)
add_executable(tapyrusd
tapyrusd.cpp
)
add_windows_resources(tapyrusd tapyrus-res.rc)
add_windows_resources(tapyrusd "${TAPYRUSD_RC_FILE}")
target_link_libraries(tapyrusd PRIVATE
core_interface
tapyrus_server
Expand Down Expand Up @@ -298,7 +304,7 @@ target_link_libraries(tapyrus_cli
# tapyrus Core RPC client
if(BUILD_CLI)
add_executable(tapyrus-cli tapyrus-cli.cpp)
add_windows_resources(tapyrus-cli tapyrus-cli-res.rc)
add_windows_resources(tapyrus-cli "${TAPYRUS_CLI_RC_FILE}")
target_link_libraries(tapyrus-cli
core_interface
tapyrus_cli
Expand All @@ -314,7 +320,7 @@ endif()

if(BUILD_UTILS)
add_executable(tapyrus-tx tapyrus-tx.cpp)
add_windows_resources(tapyrus-tx tapyrus-tx-res.rc)
add_windows_resources(tapyrus-tx "${TAPYRUS_TX_RC_FILE}")
target_link_libraries(tapyrus-tx
core_interface
tapyrus_common
Expand All @@ -328,7 +334,7 @@ endif()

if(BUILD_GENESIS)
add_executable(tapyrus-genesis tapyrus-genesis.cpp)
add_windows_resources(tapyrus-genesis tapyrus-genesis-res.rc)
add_windows_resources(tapyrus-genesis "${TAPYRUS_GENESIS_RC_FILE}")
target_link_libraries(tapyrus-genesis
core_interface
tapyrus_server
Expand Down
5 changes: 1 addition & 4 deletions src/clientversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@

static std::string FormatVersion(int nVersion)
{
if (nVersion % 100 == 0)
return strprintf("%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100);
else
return strprintf("%d.%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, nVersion % 100);
return strprintf("%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100);
}

std::string FormatFullVersion()
Expand Down
5 changes: 2 additions & 3 deletions src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <tapyrus-config.h>

// Check that required client information is defined
#if !defined(CLIENT_VERSION_MAJOR) || !defined(CLIENT_VERSION_MINOR) || !defined(CLIENT_VERSION_REVISION) || !defined(CLIENT_VERSION_BUILD) || !defined(CLIENT_VERSION_IS_RELEASE) || !defined(COPYRIGHT_YEAR)
#if !defined(CLIENT_VERSION_MAJOR) || !defined(CLIENT_VERSION_MINOR) || !defined(CLIENT_VERSION_BUILD) || !defined(CLIENT_VERSION_IS_RELEASE) || !defined(COPYRIGHT_YEAR)
#error Client version information missing: version is not defined by tapyrus-config.h or in any other way
#endif

Expand Down Expand Up @@ -37,8 +37,7 @@
static const int CLIENT_VERSION =
1000000 * CLIENT_VERSION_MAJOR
+ 10000 * CLIENT_VERSION_MINOR
+ 100 * CLIENT_VERSION_REVISION
+ 1 * CLIENT_VERSION_BUILD;
+ 100 * CLIENT_VERSION_BUILD;

std::string FormatFullVersion();
std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments);
Expand Down
7 changes: 6 additions & 1 deletion src/qt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "
endif()

add_executable(tapyrus-qt)
add_windows_resources(tapyrus-qt res/tapyrus-qt-res.rc)
if(WIN32)
configure_windows_rc(tapyrus-qt "${PACKAGE_NAME} (GUI node for Tapyrus)" TAPYRUS_QT_RC_FILE
PRODUCT_NAME "${PACKAGE_NAME}"
ICON "${CMAKE_CURRENT_SOURCE_DIR}/res/icons/tapyrus.ico")
endif()
add_windows_resources(tapyrus-qt "${TAPYRUS_QT_RC_FILE}")

target_link_libraries(tapyrus-qt
core_interface
Expand Down
38 changes: 0 additions & 38 deletions src/qt/res/tapyrus-qt-res.rc

This file was deleted.

36 changes: 0 additions & 36 deletions src/tapyrus-cli-res.rc

This file was deleted.

36 changes: 0 additions & 36 deletions src/tapyrus-genesis-res.rc

This file was deleted.

36 changes: 0 additions & 36 deletions src/tapyrus-res.rc

This file was deleted.

36 changes: 0 additions & 36 deletions src/tapyrus-tx-res.rc

This file was deleted.

Loading
Loading