ThreadPinning reads the sibling groups from the kernel topology and pins the calling thread to a cpu set. It is stateless and per-thread: a caller reads the groups, picks the cpus for a thread and pins it, so any mapping of threads to cpus is expressible.
15 lines
675 B
CMake
15 lines
675 B
CMake
project(Threading)
|
|
|
|
### ---------------------- Static Library --------------------- ###
|
|
file(GLOB SOURCES "./private/*.cpp")
|
|
file(GLOB HEADERS "./public/*.hpp")
|
|
add_library(${PROJECT_NAME} STATIC ${SOURCES} ${HEADERS})
|
|
target_include_directories(${PROJECT_NAME} PUBLIC ./public/)
|
|
find_package(Threads REQUIRED)
|
|
target_link_libraries(${PROJECT_NAME} PUBLIC Threads::Threads)
|
|
|
|
### -------------------------- Tests -------------------------- ###
|
|
file(GLOB TEST_SOURCES "./tests/*.cpp")
|
|
add_executable(Tests${PROJECT_NAME} ${TEST_SOURCES})
|
|
target_link_libraries(Tests${PROJECT_NAME} ${PROJECT_NAME} UnitTest++)
|
|
add_test(NAME Tests${PROJECT_NAME} COMMAND Tests${PROJECT_NAME})
|