mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Used consistent wording for HotPocket.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
###
|
||||
# ##
|
||||
# Compile-time timestamping library
|
||||
#
|
||||
#
|
||||
|
||||
# Adapted from https://github.com/kraiskil/cmake_timestamp
|
||||
# This is only used for the Hot Pocket kill switch.
|
||||
# This is only used for the HotPocket kill switch.
|
||||
|
||||
#CMake 3.12 made using OBJECT libraries much nicer, so we use that.
|
||||
# CMake 3.12 made using OBJECT libraries much nicer, so we use that.
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
# Set CMake variable BUILD_TIME to 'now'. This 'now' is the time
|
||||
@@ -13,26 +13,25 @@ cmake_minimum_required(VERSION 3.12)
|
||||
string(TIMESTAMP BUILD_TIME "%s" UTC)
|
||||
|
||||
# Compile the library that contains the global variables
|
||||
add_library( killswitch OBJECT killswitch.c)
|
||||
add_library(killswitch OBJECT killswitch.c)
|
||||
target_compile_definitions(
|
||||
killswitch
|
||||
PRIVATE -DBUILD_TIME="${BUILD_TIME}"
|
||||
)
|
||||
target_include_directories( killswitch
|
||||
target_include_directories(killswitch
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
)
|
||||
|
||||
#Add a dummy target that removes the CMake variable BUILD_TIME from CMake's cache.
|
||||
#this forces CMake to be-rerun when we hit this target.
|
||||
# Add a dummy target that removes the CMake variable BUILD_TIME from CMake's cache.
|
||||
# this forces CMake to be-rerun when we hit this target.
|
||||
add_custom_target(
|
||||
clear_cache
|
||||
COMMAND ${CMAKE_COMMAND} -U BUILD_TIME ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
|
||||
#Have the cache clearing be run before trying to build the killswitch library.
|
||||
#This (I think) is the same as a PRE_BUILD custom_command. But PRE_BUILD is
|
||||
#available for VS generators only, on others it is synonymous to PRE_LINK,
|
||||
#i.e. "post compile"
|
||||
# Have the cache clearing be run before trying to build the killswitch library.
|
||||
# This (I think) is the same as a PRE_BUILD custom_command. But PRE_BUILD is
|
||||
# available for VS generators only, on others it is synonymous to PRE_LINK,
|
||||
# i.e. "post compile"
|
||||
add_dependencies(killswitch clear_cache)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ uint64_t build_time_sec = 0;
|
||||
|
||||
/**
|
||||
* Returns true if kill switch is activated (allowed time has expired).
|
||||
* Otherwise returns false (can keep using Hot Pocket).
|
||||
* Otherwise returns false (can keep using HotPocket).
|
||||
* @param epoch_ms Current time in epoch milliseconds.
|
||||
*/
|
||||
bool kill_switch(const uint64_t epoch_ms)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Based on https://github.com/kraiskil/cmake_timestamp
|
||||
|
||||
This whole folder exists to get the CMAKE compile/link time into the binary so we can perform
|
||||
Hot Pocket time-based kill switch check. This folder must be removed when we no longer need the kill switch.
|
||||
HotPocket time-based kill switch check. This folder must be removed when we no longer need the kill switch.
|
||||
|
||||
Reference in New Issue
Block a user