enable/disable threadpool from cmake
This commit is contained in:
@ -9,6 +9,7 @@ if(POLICY CMP0167)
|
||||
cmake_policy(SET CMP0167 NEW)
|
||||
endif()
|
||||
|
||||
option(DISABLE_THREADPOOL "Disable additional physics threads" OFF)
|
||||
option(DISABLE_BACKWARD "Disable backward stacktrace printer" OFF)
|
||||
option(DISABLE_TRACY "Disable the Tracy profiler client" OFF)
|
||||
option(DISABLE_TESTS "Disable building tests" OFF)
|
||||
@ -41,6 +42,10 @@ if(WIN32)
|
||||
list(APPEND LIBS opengl32 gdi32 winmm)
|
||||
endif()
|
||||
|
||||
if(NOT DISABLE_THREADPOOL)
|
||||
list(APPEND FLAGS THREADPOOL)
|
||||
endif()
|
||||
|
||||
if(NOT DISABLE_BACKWARD)
|
||||
find_package(Backward REQUIRED)
|
||||
|
||||
@ -127,4 +132,4 @@ if(supported)
|
||||
set_property(TARGET masssprings PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
else()
|
||||
message(STATUS "IPO / LTO not supported")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -254,6 +254,7 @@ rec {
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DDISABLE_THREADPOOL=Off"
|
||||
"-DDISABLE_TRACY=On"
|
||||
"-DDISABLE_BACKWARD=On"
|
||||
"-DDISABLE_TESTS=On"
|
||||
@ -307,6 +308,7 @@ rec {
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_SYSTEM_NAME=Windows"
|
||||
"-DDISABLE_THREADPOOL=Off"
|
||||
"-DDISABLE_TRACY=On"
|
||||
"-DDISABLE_BACKWARD=On"
|
||||
"-DDISABLE_TESTS=On"
|
||||
|
||||
@ -3,12 +3,12 @@
|
||||
|
||||
#include <raylib.h>
|
||||
|
||||
#define THREADPOOL // Enable physics threadpool
|
||||
|
||||
// TODO: Using the octree from the last frame completely breaks the physics :/
|
||||
// #define ASYNC_OCTREE
|
||||
|
||||
// Gets set by CMake
|
||||
// #define THREADPOOL // Enable physics threadpool
|
||||
// #define BACKWARD // Enable pretty stack traces
|
||||
// #define TRACY // Enable tracy profiling support
|
||||
|
||||
@ -93,4 +93,4 @@ constexpr Color BLOCK_COLOR = DARKBLUE;
|
||||
constexpr Color TARGET_BLOCK_COLOR = RED;
|
||||
constexpr Color WALL_COLOR = BLACK;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -38,7 +38,7 @@ auto set_pool_thread_name(size_t idx) -> void
|
||||
BS::this_thread::set_os_thread_name(std::format("worker-{}", idx));
|
||||
}
|
||||
|
||||
BS::thread_pool<> threads(std::thread::hardware_concurrency() - 2, set_pool_thread_name);
|
||||
BS::thread_pool<> threads(std::thread::hardware_concurrency(), set_pool_thread_name);
|
||||
constexpr std::optional<BS::thread_pool<>* const> thread_pool = &threads;
|
||||
#else
|
||||
constexpr std::optional<BS::thread_pool<>* const> thread_pool = std::nullopt;
|
||||
@ -341,4 +341,4 @@ auto main(const int argc, char* argv[]) -> int
|
||||
};
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user