feat: add tbb

This commit is contained in:
parker
2025-07-10 19:57:46 +01:00
parent 72de0c5602
commit f232491313
3 changed files with 19 additions and 2 deletions

View File

@@ -23,6 +23,9 @@ find_package(glm REQUIRED)
# eigen (math) # eigen (math)
find_package (Eigen3 3.3 REQUIRED NO_MODULE) find_package (Eigen3 3.3 REQUIRED NO_MODULE)
# tbb
find_package(TBB REQUIRED COMPONENTS TBB::tbb)
qt_add_executable(${AppExec} qt_add_executable(${AppExec}
@@ -53,7 +56,7 @@ qt_add_executable(${AppExec}
src/Engine/Network/NetworkManager.cpp src/Engine/Network/NetworkManager.cpp
) )
target_link_libraries(${AppExec} PRIVATE Qt6::Core Qt6::Widgets Qt6::SvgWidgets Qt6::OpenGLWidgets glm::glm Eigen3::Eigen) target_link_libraries(${AppExec} PRIVATE Qt6::Core Qt6::Widgets Qt6::SvgWidgets Qt6::OpenGLWidgets glm::glm Eigen3::Eigen TBB::tbb)
target_include_directories(${AppExec} PUBLIC src) target_include_directories(${AppExec} PUBLIC src)
# tests # tests
@@ -79,7 +82,7 @@ add_executable(${TestExec}
src/Engine/Operator/GeometryConnection.cpp src/Engine/Operator/GeometryConnection.cpp
src/Engine/Operator/GeometryOpDef.cpp src/Engine/Operator/GeometryOpDef.cpp
) )
target_link_libraries(${TestExec} PRIVATE Catch2::Catch2WithMain Eigen3::Eigen Qt6::Core ) target_link_libraries(${TestExec} PRIVATE Catch2::Catch2WithMain Eigen3::Eigen Qt6::Core TBB::tbb)
target_compile_definitions(${TestExec} PRIVATE UNIT_TEST) target_compile_definitions(${TestExec} PRIVATE UNIT_TEST)
target_include_directories(${TestExec} PUBLIC src) target_include_directories(${TestExec} PUBLIC src)

View File

@@ -23,6 +23,7 @@
- qt6 (base & svg) - qt6 (base & svg)
- glm - glm
- catch2 - catch2
- oneTBB
> [!IMPORTANT] > [!IMPORTANT]

View File

@@ -1,6 +1,19 @@
#include <catch2/catch_test_macros.hpp> #include <catch2/catch_test_macros.hpp>
#include <oneapi/tbb/parallel_for.h>
#include <iostream>
TEST_CASE("foo") TEST_CASE("foo")
{ {
REQUIRE(1==1); REQUIRE(1==1);
} }
TEST_CASE("tbb")
{
constexpr int N = 100;
oneapi::tbb::parallel_for(0, N, [](int i) {
std::cout << "Iteration " << i
<< " is running on thread "
<< std::this_thread::get_id() << std::endl;
});
}