Custom version of TBB with CMAKE

Custom version of TBB with CMAKE

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

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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")

 

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

 

 

Hi Tony,

we will look into this for the next release.

Leave a Comment

Please sign in to add a comment. Not a member? Join today