macro removals

clean up version cmake stuff

clean up generated cpp version stuff

make all the windows rc stuff get generated by cmake

bump release motto message

properly inject release motto into version
This commit is contained in:
Jeff 2022-05-26 12:25:55 -04:00
parent 1eba0f836e
commit f05c2ebc71
No known key found for this signature in database
GPG Key ID: 025C02EE3A092F2D
7 changed files with 57 additions and 74 deletions

View File

@ -35,14 +35,7 @@ if(APPLE)
set(LOKINET_APPLE_BUILD 0)
endif()
set(RELEASE_MOTTO "A Series of Tubes" CACHE STRING "Release motto")
add_definitions(-DLLARP_VERSION_MAJOR=${lokinet_VERSION_MAJOR})
add_definitions(-DLLARP_VERSION_MINOR=${lokinet_VERSION_MINOR})
add_definitions(-DLLARP_VERSION_PATCH=${lokinet_VERSION_PATCH})
if(RELEASE_MOTTO AND CMAKE_BUILD_TYPE MATCHES "[Rr][Ee][Ll][Ee][Aa][Ss][Ee]")
add_definitions(-DLLARP_RELEASE_MOTTO="${RELEASE_MOTTO}")
endif()
set(RELEASE_MOTTO "The Current Thing" CACHE STRING "Release motto")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

View File

@ -1,9 +1,9 @@
# We do this via a custom command that re-invokes a cmake script because we need the DEPENDS on .git/index so that we will re-run it (to regenerate the commit tag in the version) whenever the current commit changes. If we used a configure_file directly here, it would only re-run when something else causes cmake to re-run.
find_package(Git QUIET)
set(VERSIONTAG "${GIT_VERSION}")
set(GIT_INDEX_FILE "${PROJECT_SOURCE_DIR}/.git/index")
if(EXISTS ${GIT_INDEX_FILE} AND ( GIT_FOUND OR Git_FOUND) )
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp"
COMMAND "${CMAKE_COMMAND}"
@ -12,11 +12,40 @@ if(EXISTS ${GIT_INDEX_FILE} AND ( GIT_FOUND OR Git_FOUND) )
"-D" "DEST=${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp"
"-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in"
"${GIT_INDEX_FILE}")
"${GIT_INDEX_FILE}")
if(WIN32)
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/version.rc"
COMMAND "${CMAKE_COMMAND}"
"-D" "GIT=${GIT_EXECUTABLE}"
"-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in"
"-D" "DEST=${CMAKE_BINARY_DIR}/version.rc"
"-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in"
"${GIT_INDEX_FILE}")
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/lokinet_resource.h"
COMMAND "${CMAKE_COMMAND}"
"-D" "GIT=${GIT_EXECUTABLE}"
"-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/win32/resource.h.in"
"-D" "DEST=${CMAKE_BINARY_DIR}/lokinet_resource.h"
"-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/win32/resource.h.in"
"${GIT_INDEX_FILE}")
endif()
else()
message(STATUS "Git was not found! Setting version to to nogit")
set(VERSIONTAG "nogit")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" @ONLY)
if(WIN32)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" "${CMAKE_BINARY_DIR}/version.rc" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/win32/resource.h.in" "${CMAKE_BINARY_DIR}/lokinet_resource.h" @ONLY)
endif()
endif()
add_custom_target(genversion DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp")
add_custom_target(genversion_cpp DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp")
if(WIN32)
add_custom_target(genversion_rc DEPENDS "${CMAKE_BINARY_DIR}/version.rc" "${CMAKE_BINARY_DIR}/lokinet_resource.h")
else()
add_custom_target(genversion_rc)
endif()
add_custom_target(genversion DEPENDS genversion_cpp genversion_rc)

View File

@ -49,7 +49,7 @@ endif()
foreach(exe ${exetargets})
if(WIN32 AND NOT MSVC_VERSION)
target_sources(${exe} PRIVATE ../llarp/win32/version.rc)
target_sources(${exe} PRIVATE ${CMAKE_BINARY_DIR}/version.rc)
target_link_libraries(${exe} PRIVATE -static-libstdc++ -static-libgcc --static -Wl,--pic-executable,-e,mainCRTStartup,--subsystem,console:5.00)
target_link_libraries(${exe} PRIVATE ws2_32 iphlpapi)
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")

View File

@ -1,27 +1,16 @@
#include <constants/version.hpp>
#include <constants/version.h>
#include <constants/proto.hpp>
// clang-format off
#define LLARP_STRINGIFY2(val) #val
#define LLARP_STRINGIFY(val) LLARP_STRINGIFY2(val)
#define LLARP_VERSION_STR \
LLARP_STRINGIFY(LLARP_VERSION_MAJOR) \
"." LLARP_STRINGIFY(LLARP_VERSION_MINOR) "." LLARP_STRINGIFY( \
LLARP_VERSION_PATCH)
#define LLARP_VERSION_FULL LLARP_VERSION_STR "-@VERSIONTAG@"
namespace llarp
{
// clang-format off
const std::array<uint16_t, 3> VERSION{{LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH}};
const std::array<uint64_t, 4> ROUTER_VERSION{{llarp::constants::proto_version, LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH}};
const char* const VERSION_STR = LLARP_VERSION_STR;
const std::array<uint16_t, 3> VERSION{{@lokinet_VERSION_MAJOR@, @lokinet_VERSION_MINOR@, @lokinet_VERSION_PATCH@}};
const std::array<uint64_t, 4> ROUTER_VERSION{{llarp::constants::proto_version, @lokinet_VERSION_MAJOR@, @lokinet_VERSION_MINOR@, @lokinet_VERSION_PATCH@}};
const char* const VERSION_STR = "@lokinet_VERSION_MAJOR@.@lokinet_VERSION_MINOR@.@lokinet_VERSION_PATCH@";
const char* const VERSION_TAG = "@VERSIONTAG@";
const char* const VERSION_FULL = LLARP_NAME "-" LLARP_VERSION_STR "-@VERSIONTAG@";
const char* const VERSION_FULL = "lokinet-@lokinet_VERSION_MAJOR@.@lokinet_VERSION_MINOR@.@lokinet_VERSION_PATCH@-@VERSIONTAG@";
const char* const RELEASE_MOTTO = LLARP_RELEASE_MOTTO;
const char* const DEFAULT_NETID = LLARP_DEFAULT_NETID;
const char* const RELEASE_MOTTO = "@RELEASE_MOTTO@";
const char* const DEFAULT_NETID = "lokinet";
// clang-format on
} // namespace llarp

View File

@ -1,24 +0,0 @@
#pragma once
// Don't include this file directly but rather go through version.hpp instead.
// This is only here so version.cpp.in and the weird archaic windows build
// recipies can use the version.
#define LLARP_NAME "lokinet"
#define LLARP_DEFAULT_NETID "lokinet"
#ifndef LLARP_RELEASE_MOTTO
#define LLARP_RELEASE_MOTTO "(dev build)"
#endif
#if defined(_WIN32) && defined(RC_INVOKED)
#define LLARP_VERSION LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH, 0
#define MAKE_TRIPLET(X, Y, Z) TRIPLET_CAT(X, ., Y, ., Z)
#define TRIPLET_CAT(X, D1, Y, D2, Z) X##D1##Y##D2##Z
#define LLARP_VERSION_TRIPLET \
MAKE_TRIPLET(LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH)
#endif

View File

@ -13,3 +13,5 @@
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
// clang-format off
#define lokinet_VERSION @lokinet_VERSION_MAJOR@, @lokinet_VERSION_MINOR@, @lokinet_VERSION_PATCH@, 0

View File

@ -6,19 +6,13 @@
//
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#include <constants/version.h>
#include "lokinet_resource.h"
#ifdef __GNUC__ // make windows rc accept this
#include <winresrc.h>
#endif
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#define STRINGIZER(version) #version
#define VERSION_STRING(version, codename, revision) \
STRINGIZER(version) "-release [" STRINGIZER(codename) "] (rev-" STRINGIZER(revision) ")"
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 1033,1
@ -56,8 +50,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION LLARP_VERSION
PRODUCTVERSION LLARP_VERSION
FILEVERSION lokinet_VERSION
PRODUCTVERSION lokinet_VERSION
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x3L
@ -72,15 +66,15 @@ BEGIN
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "includes relay/exit functionality, such code is highly experimental on non-Linux targets"
VALUE "CompanyName", "Loki Foundation"
VALUE "FileDescription", "LokiNET daemon for Microsoft® Windows® NT™"
VALUE "FileVersion", VERSION_STRING(LLARP_VERSION_TRIPLET, LLARP_RELEASE_MOTTO, VERSIONTAG)
VALUE "InternalName", "llarpd"
VALUE "LegalCopyright", "Copyright ©2018-2020 Jeff Becker, Rick V for the Loki Foundation. All rights reserved. This software is provided under the terms of the zlib-libpng licence; see the file LICENSE for details."
VALUE "OriginalFilename", "llarpd.exe"
VALUE "Comments", "This comment has invoked its 5th ammendment constitutional right to remain silent"
VALUE "CompanyName", "OPTF"
VALUE "FileDescription", "LokiNET daemon for Windows"
VALUE "FileVersion", "@lokinet_VERSION@"
VALUE "InternalName", "lokinet"
VALUE "LegalCopyright", "Copyright (c) 2018-2022 Jeff Becker, Rick V for the OPTF. This software is provided under the terms of the GPL3; see the file LICENSE for details."
VALUE "OriginalFilename", "lokinet.exe"
VALUE "ProductName", "LokiNET for Windows"
VALUE "ProductVersion", VERSION_STRING(LLARP_VERSION_TRIPLET, LLARP_RELEASE_MOTTO, VERSIONTAG)
VALUE "ProductVersion", "@lokinet_VERSION@"
END
END
BLOCK "VarFileInfo"