Skip to content

Commit

Permalink
Add TBB dependency and linkage
Browse files Browse the repository at this point in the history
  • Loading branch information
GwGibson committed Aug 10, 2023
1 parent d94ee4a commit eda691b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,15 @@ function(psim_setup_dependencies)
# if(NOT TARGET CLI11::CLI11)
# cpmaddpackage("gh:CLIUtils/[email protected]")
# 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()
7 changes: 1 addition & 6 deletions ProjectOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
3 changes: 2 additions & 1 deletion psim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)

0 comments on commit eda691b

Please sign in to comment.