From eda691be02b94473d19b25ef3d95e0d37063ff39 Mon Sep 17 00:00:00 2001 From: Graham Gibson Date: Thu, 10 Aug 2023 15:43:21 -0400 Subject: [PATCH] Add TBB dependency and linkage --- .devcontainer/Dockerfile | 2 +- Dependencies.cmake | 10 ++++++++++ ProjectOptions.cmake | 7 +------ psim/CMakeLists.txt | 3 ++- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index a99e00e..11d59d0 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -63,7 +63,7 @@ RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \ # Install optional dependencies RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \ apt-get install -y --no-install-recommends \ - doxygen graphviz ccache cppcheck + doxygen graphviz ccache cppcheck libtbb-dev # Install include-what-you-use ENV IWYU /home/iwyu diff --git a/Dependencies.cmake b/Dependencies.cmake index 47f7060..bc7e4c7 100644 --- a/Dependencies.cmake +++ b/Dependencies.cmake @@ -31,5 +31,15 @@ function(psim_setup_dependencies) # if(NOT TARGET CLI11::CLI11) # cpmaddpackage("gh:CLIUtils/CLI11@2.3.2") # endif() + + if(NOT TARGET TBB::tbb) + cpmaddpackage( + NAME TBB + VERSION 2021.10.0 + URL https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.10.0.tar.gz + OPTIONS + "TBB_TEST OFF" + ) + endif() endfunction() \ No newline at end of file diff --git a/ProjectOptions.cmake b/ProjectOptions.cmake index 559ca06..eed8401 100644 --- a/ProjectOptions.cmake +++ b/ProjectOptions.cmake @@ -102,12 +102,7 @@ macro(psim_local_options) # Statically link the standard libraries to allow the executable to run # on servers with older software if (psim_STATIC_LINK_LIBC) - set(CMAKE_EXE_LINKER_FLAGS "-static -static-libgcc -static-libstdc++") - - if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=skylake-avx512") - endif() - + set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++") endif() endif() diff --git a/psim/CMakeLists.txt b/psim/CMakeLists.txt index 63f72c7..3639c40 100644 --- a/psim/CMakeLists.txt +++ b/psim/CMakeLists.txt @@ -6,6 +6,7 @@ file(GLOB_RECURSE PSIM_SOURCES set(module_name "psim") add_library(${module_name} STATIC ${PSIM_SOURCES}) + target_link_libraries( ${module_name} PUBLIC psim_options psim_warnings @@ -24,5 +25,5 @@ add_executable(psim.out "./src/main.cpp") target_link_libraries( psim.out PUBLIC psim - PRIVATE psim_options psim_warnings + PRIVATE psim_options psim_warnings TBB::tbb )