From eb97c92239e0f2fb45d3fb40942a5ddf60e719b9 Mon Sep 17 00:00:00 2001 From: Manuel Pitz Date: Wed, 23 Jun 2021 20:05:56 +0200 Subject: [PATCH] cmake: add support for building with OpenMP --- CMakeLists.txt | 3 +++ lib/hooks/CMakeLists.txt | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 164dabfe0..adad61ddc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,6 +82,7 @@ endif() # Check packages find_package(PkgConfig REQUIRED) find_package(Threads REQUIRED) +find_package(OpenMP) find_package(Opal) find_package(IBVerbs) find_package(RDMACM) @@ -141,6 +142,7 @@ cmake_dependent_option(WITH_HOOKS "Build with support for processing h cmake_dependent_option(WITH_WEB "Build with internal webserver" ON "LIBWEBSOCKETS_FOUND" OFF) cmake_dependent_option(WITH_API "Build with remote control API" ON "" OFF) cmake_dependent_option(WITH_CONFIG "Build with support for libconfig configuration syntax" ON "LIBCONFIG_FOUND" OFF) +cmake_dependent_option(WITH_OPENMP "Build with support for OpenMP for parallel hooks" ON "OPENMP_FOUND" OFF) cmake_dependent_option(WITH_SRC "Build executables" ON "TOPLEVEL_PROJECT" OFF) cmake_dependent_option(WITH_FPGA "Build with support for VILLASfpga" ON "XIL_FOUND" OFF) cmake_dependent_option(WITH_TOOLS "Build auxilary tools" ON "TOPLEVEL_PROJECT" OFF) @@ -240,6 +242,7 @@ add_feature_info(PLUGINS WITH_PLUGINS "Build plugi add_feature_info(CLIENTS WITH_CLIENTS "Build client applications") add_feature_info(GRAPHVIZ WITH_GRAPHVIZ "Build with Graphviz support") add_feature_info(LUA WITH_LUA "Build with Lua support") +add_feature_info(OPENMP WITH_OPENMP "Build with OpenMP support") add_feature_info(DOC WITH_DOC "Build documentation") add_feature_info(NODE_AMQP WITH_NODE_AMQP "Build with amqp node-type") diff --git a/lib/hooks/CMakeLists.txt b/lib/hooks/CMakeLists.txt index d9d5b1f60..95ee8ac36 100644 --- a/lib/hooks/CMakeLists.txt +++ b/lib/hooks/CMakeLists.txt @@ -50,6 +50,10 @@ if(WITH_LUA) list(APPEND HOOK_SRC lua.cpp) endif() +if(WITH_OPENMP) + list(APPEND LIBRARIES OpenMP::OpenMP_CXX) +endif() + add_library(hooks STATIC ${HOOK_SRC}) target_include_directories(hooks PUBLIC ${INCLUDE_DIRS}) target_link_libraries(hooks PUBLIC ${LIBRARIES})