diff --git a/CMakeLists.txt b/CMakeLists.txt index f3eef21e..6f496471 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ set(OATPP_THREAD_HARDWARE_CONCURRENCY "AUTO" CACHE STRING "Predefined value for set(OATPP_THREAD_DISTRIBUTED_MEM_POOL_SHARDS_COUNT "10" CACHE STRING "Number of shards of ThreadDistributedMemoryPool") option(OATPP_COMPAT_BUILD_NO_THREAD_LOCAL "Disable 'thread_local' feature" OFF) +option(OATPP_COMPAT_BUILD_NO_SET_AFFINITY "No 'pthread_setaffinity_np' method" OFF) option(OATPP_DISABLE_LOGV "DISABLE logs priority V" OFF) option(OATPP_DISABLE_LOGD "DISABLE logs priority D" OFF) @@ -68,13 +69,17 @@ if(NOT OATPP_THREAD_HARDWARE_CONCURRENCY STREQUAL AUTO_VALUE) endif() add_definitions ( - -DOATPP_THREAD_DISTRIBUTED_MEM_POOL_SHARDS_COUNT=${OATPP_THREAD_DISTRIBUTED_MEM_POOL_SHARDS_COUNT} + -DOATPP_THREAD_DISTRIBUTED_MEM_POOL_SHARDS_COUNT=${OATPP_THREAD_DISTRIBUTED_MEM_POOL_SHARDS_COUNT} ) if(OATPP_COMPAT_BUILD_NO_THREAD_LOCAL) add_definitions(-DOATPP_COMPAT_BUILD_NO_THREAD_LOCAL) endif() +if(OATPP_COMPAT_BUILD_NO_SET_AFFINITY) + add_definitions(-DOATPP_COMPAT_BUILD_NO_SET_AFFINITY) +endif() + if(OATPP_DISABLE_LOGV) add_definitions(-DOATPP_DISABLE_LOGV) endif() diff --git a/src/oatpp/core/concurrency/Thread.cpp b/src/oatpp/core/concurrency/Thread.cpp index 0a19e135..d2e575ec 100644 --- a/src/oatpp/core/concurrency/Thread.cpp +++ b/src/oatpp/core/concurrency/Thread.cpp @@ -45,7 +45,7 @@ v_int32 setThreadAffinityToCpuRange(std::thread::native_handle_type nativeHandle // The below line compiles on Android but has not been tested. //result = sched_setaffinity(nativeHandle, sizeof(cpu_set_t), &cpuset); - #if !defined(__ANDROID__) && !defined(OATPP_HAS_NO_SETAFFINITY_NP) + #if !defined(__ANDROID__) && !defined(OATPP_COMPAT_BUILD_NO_SET_AFFINITY) cpu_set_t cpuset; CPU_ZERO(&cpuset); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1be5637a..1fb24647 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -109,7 +109,4 @@ set_target_properties(oatppAllTests PROPERTIES target_include_directories(oatppAllTests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -target_compile_definitions(oatppAllTests - PRIVATE OATPP_ENABLE_ALL_TESTS_MAIN -) add_test(oatppAllTests oatppAllTests) diff --git a/test/oatpp/AllTestsMain.cpp b/test/oatpp/AllTestsMain.cpp index 16055074..cfb494e5 100644 --- a/test/oatpp/AllTestsMain.cpp +++ b/test/oatpp/AllTestsMain.cpp @@ -67,7 +67,6 @@ #include #include -#ifdef OATPP_ENABLE_ALL_TESTS_MAIN namespace { void runTests() { @@ -219,4 +218,4 @@ int main() { return 0; } -#endif +