Make use of platform-specific APIs for optimizing CopyHelper configurable

There might be unexpected limitations like
https://github.com/Martchus/cpp-utilities/issues/24. To be able to at least
workaround those limitations it makes sense to allow disabling the
optimization completely.
This commit is contained in:
Martchus 2023-04-23 19:23:47 +02:00
parent 10a7e4d814
commit 2467c4f815
2 changed files with 7 additions and 1 deletions

View File

@ -195,6 +195,12 @@ if (NOT ENABLE_THREAD_LOCAL)
PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME}_NO_THREAD_LOCAL)
endif ()
# configure use of platform-specific APIs for optimizing CopyHelper
option(USE_PLATFORM_SPECIFIC_API_FOR_OPTIMIZING_COPY_HELPER "enables use of platform-specific APIs for optimizing CopyHelper" ON)
if (USE_PLATFORM_SPECIFIC_API_FOR_OPTIMIZING_COPY_HELPER)
list(APPEND META_PUBLIC_COMPILE_DEFINITIONS ${META_PROJECT_VARNAME}_USE_PLATFORM_SPECIFIC_API_FOR_OPTIMIZING_COPY_HELPER)
endif ()
# include modules to apply configuration
include(BasicConfig)
include(WindowsResources)

View File

@ -2,7 +2,7 @@
#define IOUTILITIES_COPY_H
#include "./nativefilestream.h"
#if defined(CPP_UTILITIES_USE_NATIVE_FILE_BUFFER) && defined(PLATFORM_LINUX)
#if defined(CPP_UTILITIES_USE_PLATFORM_SPECIFIC_API_FOR_OPTIMIZING_COPY_HELPER) && defined(CPP_UTILITIES_USE_NATIVE_FILE_BUFFER) && defined(PLATFORM_LINUX)
#define CPP_UTILITIES_USE_SEND_FILE
#include "../conversion/stringbuilder.h"
#endif