Intel® Embree Ray Tracing Kernels
Discussion forum on the open source ray tracing kernels for fast photo-realistic rendering on Intel® CPU(s)

Custom version of TBB with CMAKE

Tony_M_2
Beginner
2,418 Views

I have a custom version of TBB where I changed a few bugs that are waiting to be approved, but make the data structures more thread safe.

My issue is in my cmake file 

# Build Thread Building Blocks (main shared libraries only)

set(TBB_ROOT "tbb" CACHE FILEPATH "description")
set(TBB_BUILD_SHARED          OFF  CACHE BOOL " " FORCE)
set(TBB_BUILD_STATIC          ON  CACHE BOOL " " FORCE)
set(TBB_BUILD_TBBMALLOC       OFF CACHE BOOL " " FORCE)
set(TBB_BUILD_TBBMALLOC_PROXY OFF CACHE BOOL " " FORCE)
add_subdirectory(tbb)
set_property(TARGET tbb_static tbb_def_files PROPERTY FOLDER "dependencies")


# EMBREE setup
SET(ENABLE_TUTORIALS OFF CACHE BOOL "Tutorials")
SET(ENABLE_INSTALLER OFF CACHE BOOL "Installer")
SET(ENABLE_ISPC_SUPPORT OFF CACHE BOOL "ENABLE_ISPC_SUPPORT")
#SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
add_subdirectory (embree)

 

CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find TBB (missing: TBB_LIBRARY TBB_LIBRARY_MALLOC)
Call Stack (most recent call first):
C:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
external_dependencies/embree/common/cmake/FindTBB.cmake:86 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
external_dependencies/embree/CMakeLists.txt:131 (FIND_PACKAGE)

 

So is there a way I can include a custom version of TBB with my project without Embree's  CMAKE   foricing  a  notfound  error

0 Kudos
6 Replies
SvenW_Intel
Moderator
2,418 Views

If your TBB library and headers are in non-default locations, just set TBB_ROOT to "". Then you can set the other TBB variables by hand:

SET(EMBREE_TBB_ROOT "")

SET(TBB_INCLUDE_DIR "tbb/include")

SET(TBB_LIBRARY "tbb/libtbb.so")

SET(TBB_LIBRARY_MALLOC "tbb/libtbb_malloc.so")

 

0 Kudos
Tony_M_2
Beginner
2,418 Views

My issue is when I include it in a project, I am not going to ship it with the .so (or lib) files pre-built.

I want to build them first in the make / visual studio project file.

So specifically lines :  48,49    70 71   of the FindTBB.cmake file are the ones screwing me up

    SET(TBB_LIBRARY TBB_LIBRARY-NOTFOUND)
    SET(TBB_LIBRARY_MALLOC TBB_LIBRARY_MALLOC-NOTFOUND)

I saw this in another post: 

https://github.com/embree/embree/issues/48

Where they sugguested deleting it made things work.

Doing that allowed me to build the entire project, TBB, embree, etc from scratch and my project fine those custom dependencies. 

I understand that might cause issues, but perhaps providing a flag that lets a user do that where those lines are deleted in the FindTBB will help satisfy some users...so we can purposely turn on that flag, and those 4 lines don't yell

Then something like this will work

# Build Thread Building Blocks (main shared libraries only)
set(TBB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/tbb" CACHE FILEPATH "tbb root")
set(TBB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tbb/include" CACHE FILEPATH "tbb include")
set(TBB_BUILD_SHARED          OFF  CACHE BOOL " " FORCE)
set(TBB_BUILD_STATIC          ON  CACHE BOOL " " FORCE)
set(TBB_BUILD_TBBMALLOC       OFF CACHE BOOL " " FORCE)
set(TBB_BUILD_TBBMALLOC_PROXY OFF CACHE BOOL " " FORCE)
add_subdirectory(tbb)

So that everything builds on the fly.

I would love if you could just delete those 4 lines, but understand you cann't

perhaps providing a flag here will help bring a compromise

 

 

0 Kudos
BenthinC_Intel
Employee
2,418 Views

Hi Tony,

we will look into this for the next release.

0 Kudos
Wu__YunHsiao
Beginner
2,418 Views

Hi there, 

just wondering if there's any update on this, same situation here after all this time.

0 Kudos
Haas__Nicholas
2,418 Views

@wu I was encountering issues with simply setting 'EMBREE_TBB_ROOT` as well with Embree v2.17.7 and (compiled from source) TBB 2017.  Here is how I cleared it.  It would appear that the CMake find is expecting a certain directory structure.

Sampling of directory structure of my custom tbb 2017 install:

file /tmp/tbb_release/lib/libtbb.so /tmp/tbb_release/lib/libtbbmalloc.so /tmp/tbb_release/include/tbb/tbb.h 

This then works:

cmake -DEMBREE_ISPC_SUPPORT=OFF -DEMBREE_TBB_ROOT=/tmp/tbb_release ..
0 Kudos
Parmesano
Beginner
2,418 Views

Nice !! Thanks 

0 Kudos
Reply