add enabling and disabling setdate

This commit is contained in:
2025-04-29 05:00:39 -05:00
parent 82a3131e1b
commit b4ad435aab
5 changed files with 18 additions and 4 deletions

View File

@ -53,6 +53,7 @@ option(TESSESFRAMEWORK_ENABLE_APPS "Enable Tesses Framework cli apps" ON)
option(TESSESFRAMEWORK_INSTALL_DEVELOPMENT "Enable Installing Tesses Framework Development Packages" ON) option(TESSESFRAMEWORK_INSTALL_DEVELOPMENT "Enable Installing Tesses Framework Development Packages" ON)
option(TESSESFRAMEWORK_ENABLE_STATIC "Enable Tesses Framework Static Libraries" ON) option(TESSESFRAMEWORK_ENABLE_STATIC "Enable Tesses Framework Static Libraries" ON)
option(TESSESFRAMEWORK_ENABLE_SHARED "Enable Tesses Framework Shared Libraries" ON) option(TESSESFRAMEWORK_ENABLE_SHARED "Enable Tesses Framework Shared Libraries" ON)
option(TESSESFRAMEWORK_ENABLE_SETDATE "Enable setting date to file" ON)
option(TESSESFRAMEWORK_LOGTOFILE "TessesFramework Log to file" OFF) option(TESSESFRAMEWORK_LOGTOFILE "TessesFramework Log to file" OFF)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include)
@ -119,10 +120,16 @@ target_link_libraries(${TessesFramework_TARGET} PUBLIC ws2_32)
endif() endif()
if(NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "NintendoWii" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "NintendoGameCube")) if(NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "NintendoWii" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "NintendoGameCube"))
if(TESSESFRAMEWORK_ENABLE_THREADING)
set(THREADS_PREFER_PTHREAD_FLAG ON) set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
target_link_libraries(${TessesFramework_TARGET} PRIVATE Threads::Threads) target_link_libraries(${TessesFramework_TARGET} PRIVATE Threads::Threads)
endif() endif()
endif()
if(TESSESFRAMEWORK_ENABLE_SETDATE)
target_compile_definitions(${TessesFramework_TARGET} PUBLIC TESSESFRAMEWORK_ENABLE_SETDATE)
endif()
endfunction() endfunction()
include(GNUInstallDirs) include(GNUInstallDirs)

View File

@ -5,9 +5,10 @@ include("${CMAKE_CURRENT_LIST_DIR}/TessesFrameworkTargets.cmake")
check_required_components(TessesFramework) check_required_components(TessesFramework)
if(NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "NintendoWii" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "NintendoGameCube")) if(NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "NintendoWii" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "NintendoGameCube"))
if(@TESSESFRAMEWORK_ENABLE_THREADING@)
set(THREADS_PREFER_PTHREAD_FLAG ON) set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
endif()
endif() endif()
set(TESSESFRAMEWORK_ENABLE_LIBWEBCAM @TESSESFRAMEWORK_ENABLE_LIBWEBCAM@) set(TESSESFRAMEWORK_ENABLE_LIBWEBCAM @TESSESFRAMEWORK_ENABLE_LIBWEBCAM@)

View File

@ -4,6 +4,7 @@
#include <variant> #include <variant>
#include <map> #include <map>
#include <iostream> #include <iostream>
#include <cstdint>
namespace Tesses::Framework::Serialization::Json namespace Tesses::Framework::Serialization::Json
{ {
class JArray; class JArray;

View File

@ -371,6 +371,7 @@ namespace Tesses::Framework::Crypto
} }
bool RandomBytes(std::vector<uint8_t>& output, std::string personal_str) bool RandomBytes(std::vector<uint8_t>& output, std::string personal_str)
{ {
#if defined(TESSESFRAMEWORK_ENABLE_MBED)
mbedtls_entropy_context entropy; mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg; mbedtls_ctr_drbg_context ctr_drbg;
@ -394,5 +395,7 @@ namespace Tesses::Framework::Crypto
mbedtls_ctr_drbg_free(&ctr_drbg); mbedtls_ctr_drbg_free(&ctr_drbg);
mbedtls_entropy_free(&entropy); mbedtls_entropy_free(&entropy);
return true; return true;
#endif
return false;
} }
} }

View File

@ -32,7 +32,8 @@ namespace Tesses::Framework::Filesystem
void LocalFilesystem::SetDate(VFSPath path, time_t lastWrite, time_t lastAccess) void LocalFilesystem::SetDate(VFSPath path, time_t lastWrite, time_t lastAccess)
{ {
std::string s = VFSPathToSystem(path); std::string s = VFSPathToSystem(path);
#if defined(_WIN32) #if defined(TESSESFRAMEWORK_ENABLE_SETDATE)
#if defined(_WIN32)
FILETIME lastWriteF; FILETIME lastWriteF;
FILETIME lastAccessF; FILETIME lastAccessF;
TimetToFileTime(lastWrite,&lastWriteF); TimetToFileTime(lastWrite,&lastWriteF);
@ -62,6 +63,7 @@ namespace Tesses::Framework::Filesystem
utim.modtime = lastWrite; utim.modtime = lastWrite;
utime(s.c_str(),&utim); utime(s.c_str(),&utim);
#endif #endif
#endif
} }
VFSPath LocalFilesystem::ReadLink(VFSPath path) VFSPath LocalFilesystem::ReadLink(VFSPath path)
{ {