mirror of https://github.com/oxen-io/lokinet
Merge pull request #1923 from majestrate/replace-llarp-proto-verison-macros-2022-05-26
final fixups before 0.9.9 tagpull/1924/head
commit
229e1277fd
@ -1,22 +1,41 @@
|
|||||||
|
# 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")
|
set(GIT_INDEX_FILE "${PROJECT_SOURCE_DIR}/.git/index")
|
||||||
if(EXISTS ${GIT_INDEX_FILE} AND ( GIT_FOUND OR Git_FOUND) )
|
find_package(Git)
|
||||||
|
if(EXISTS "${GIT_INDEX_FILE}" AND ( GIT_FOUND OR Git_FOUND) )
|
||||||
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
|
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
|
||||||
|
set(genversion_args "-DGIT=${GIT_EXECUTABLE}")
|
||||||
|
foreach(v lokinet_VERSION lokinet_VERSION_MAJOR lokinet_VERSION_MINOR lokinet_VERSION_PATCH RELEASE_MOTTO)
|
||||||
|
list(APPEND genversion_args "-D${v}=${${v}}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp"
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp"
|
||||||
COMMAND "${CMAKE_COMMAND}"
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
"-D" "GIT=${GIT_EXECUTABLE}"
|
${genversion_args}
|
||||||
"-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in"
|
"-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in"
|
||||||
"-D" "DEST=${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp"
|
"-D" "DEST=${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp"
|
||||||
"-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake"
|
"-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake"
|
||||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in"
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in"
|
||||||
"${GIT_INDEX_FILE}")
|
"${GIT_INDEX_FILE}")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Git was not found! Setting version to to nogit")
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" @ONLY)
|
||||||
set(VERSIONTAG "nogit")
|
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_target(genversion DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp")
|
|
||||||
|
if(WIN32)
|
||||||
|
foreach(exe IN ITEMS lokinet lokinet-vpn lokinet-bootstrap)
|
||||||
|
set(lokinet_EXE_NAME "${exe}.exe")
|
||||||
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" "${CMAKE_BINARY_DIR}/${exe}.rc" @ONLY)
|
||||||
|
set_property(SOURCE "${CMAKE_BINARY_DIR}/${exe}.rc" PROPERTY GENERATED 1)
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_target(genversion_cpp DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp")
|
||||||
|
if(WIN32)
|
||||||
|
add_custom_target(genversion_rc DEPENDS "${CMAKE_BINARY_DIR}/lokinet.rc" "${CMAKE_BINARY_DIR}/lokinet-vpn.rc" "${CMAKE_BINARY_DIR}/lokinet-bootstrap.rc")
|
||||||
|
else()
|
||||||
|
add_custom_target(genversion_rc)
|
||||||
|
endif()
|
||||||
|
add_custom_target(genversion DEPENDS genversion_cpp genversion_rc)
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit b48aef693b39a2408931c4ba25580648423c81a7
|
Subproject commit 79193e58fb26624d40cd2e95156f78160f2b9b3e
|
@ -1 +1 @@
|
|||||||
Subproject commit 5c72a57eca120750ecf557ce5a668fb38242956b
|
Subproject commit eadb37c7654150bef18497773718f15ef843734a
|
@ -1,13 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef LLARP_PROTO_VERSION
|
namespace llarp::constants
|
||||||
#define LLARP_PROTO_VERSION (0)
|
{
|
||||||
#endif
|
/// current network wide protocol version
|
||||||
|
// TODO: enum class
|
||||||
|
constexpr auto proto_version = 0;
|
||||||
|
|
||||||
#ifndef LLARP_ETH_PROTO
|
} // namespace llarp::constants
|
||||||
#define LLARP_ETH_PROTO (0xD1CE)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef LLARP_KEYFILE_VERSION
|
|
||||||
#define LLARP_KEYFILE_VERSION (1)
|
|
||||||
#endif
|
|
||||||
|
@ -1,27 +1,16 @@
|
|||||||
#include <constants/version.hpp>
|
#include <constants/version.hpp>
|
||||||
#include <constants/version.h>
|
|
||||||
#include <constants/proto.hpp>
|
#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
|
namespace llarp
|
||||||
{
|
{
|
||||||
// clang-format off
|
// clang-format off
|
||||||
const std::array<uint16_t, 3> VERSION{{LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH}};
|
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_PROTO_VERSION, LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_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 = LLARP_VERSION_STR;
|
const char* const VERSION_STR = "@lokinet_VERSION_MAJOR@.@lokinet_VERSION_MINOR@.@lokinet_VERSION_PATCH@";
|
||||||
const char* const VERSION_TAG = "@VERSIONTAG@";
|
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 RELEASE_MOTTO = "@RELEASE_MOTTO@";
|
||||||
const char* const DEFAULT_NETID = LLARP_DEFAULT_NETID;
|
const char* const DEFAULT_NETID = "lokinet";
|
||||||
// clang-format on
|
// clang-format on
|
||||||
} // namespace llarp
|
} // namespace llarp
|
||||||
|
@ -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
|
|
@ -1,15 +0,0 @@
|
|||||||
//{{NO_DEPENDENCIES}}
|
|
||||||
// Microsoft Visual C++ generated include file.
|
|
||||||
// Used by version.rc
|
|
||||||
//
|
|
||||||
|
|
||||||
// Next default values for new objects
|
|
||||||
//
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
|
||||||
#endif
|
|
||||||
#endif
|
|
@ -0,0 +1 @@
|
|||||||
|
CreateShortCut '$SMPROGRAMS\$STARTMENU_FOLDER\Lokinet.lnk' '$INSTDIR\share\gui\lokinet-gui.exe'
|
@ -0,0 +1 @@
|
|||||||
|
CreateShortCut '$SMPROGRAMS\$STARTMENU_FOLDER\Lokinet.lnk' '$INSTDIR\share\gui\lokinet-gui.exe'
|
@ -0,0 +1,7 @@
|
|||||||
|
ifFileExists $INSTDIR\bin\tuntap-install.exe 0 +2
|
||||||
|
ExecWait '$INSTDIR\bin\tuntap-install.exe /S'
|
||||||
|
ExecWait '$INSTDIR\bin\lokinet.exe --install'
|
||||||
|
ExecWait 'sc failure lokinet reset= 60 actions= restart/1000'
|
||||||
|
ExecWait '$INSTDIR\bin\lokinet.exe -g C:\ProgramData\lokinet\lokinet.ini'
|
||||||
|
CopyFiles '$INSTDIR\share\bootstrap.signed' C:\ProgramData\lokinet\bootstrap.signed
|
||||||
|
|
@ -0,0 +1,6 @@
|
|||||||
|
IfFileExists $INSTDIR\bin\lokinet.exe 0 +3
|
||||||
|
ExecWait 'net stop lokinet'
|
||||||
|
ExecWait '$INSTDIR\bin\lokinet.exe --remove'
|
||||||
|
|
||||||
|
IfFileExists $INSTDIR\share\gui\lokinet.exe 0 +2
|
||||||
|
ExecWait 'taskkill /f /t /im lokinet-gui.exe'
|
@ -0,0 +1,5 @@
|
|||||||
|
ExecWait 'net stop lokinet'
|
||||||
|
ExecWait 'taskkill /f /t /im lokinet-gui.exe'
|
||||||
|
ExecWait '$INSTDIR\bin\lokinet.exe --remove'
|
||||||
|
RMDir /r /REBOOTOK C:\ProgramData\lokinet
|
||||||
|
|
Loading…
Reference in New Issue