FindTBB.cmake 3.01 KB
Newer Older
schultezub's avatar
schultezub committed
1
2
3
4
5
6
7
8
# Try to find TBB library and include path. Once done this will define:
# TBB_FOUND
# TBB_DEFINITIONS
# TBB_INCLUDE_DIR
# TBB_LIBRARY (containing both debug and release libraries on win32)
# TBB_LICENSE_FILE

IF (WIN32)
schultezub's avatar
schultezub committed
9
    SET(TbbDirectory "${CampvisHome}/ext/tbb" CACHE PATH "If TBB is not found, set this path")
schultezub's avatar
schultezub committed
10
   
schultezub's avatar
schultezub committed
11
    SET(TBB_INCLUDE_DIR "${TbbDirectory}/include")
schultezub's avatar
schultezub committed
12
    
schultezub's avatar
schultezub committed
13
    IF(CAMPVIS_MSVC2008)
schultezub's avatar
schultezub committed
14
        SET(TbbCompilerDirectory "vc9")
schultezub's avatar
schultezub committed
15
    ELSEIF(CAMPVIS_MSVC2010)
schultezub's avatar
schultezub committed
16
        SET(TbbCompilerDirectory "vc10")
schultezub's avatar
schultezub committed
17
18
    ELSE()
        MESSAGE(WARNING "Compiler not supported by makefile, you might be able to fix that...")
schultezub's avatar
schultezub committed
19
    ENDIF(CAMPVIS_MSVC2008)
schultezub's avatar
schultezub committed
20
21

    # set debug and release library
schultezub's avatar
schultezub committed
22
    IF(CAMPVIS_WIN32)
schultezub's avatar
schultezub committed
23
24
25
26
27
28
        SET(TBB_LIBRARY_DEBUG      "${TbbDirectory}/lib/ia32/${TbbCompilerDirectory}/tbb_debug.lib")
        SET(TBB_DLL_DEBUG          "${TbbDirectory}/bin/ia32/${TbbCompilerDirectory}/tbb_debug.dll")
        SET(TBB_PDB_DEBUG          "${TbbDirectory}/bin/ia32/${TbbCompilerDirectory}/tbb_debug.pdb")
        SET(TBB_LIBRARY_RELEASE    "${TbbDirectory}/lib/ia32/${TbbCompilerDirectory}/tbb.lib")
        SET(TBB_DLL_RELEASE        "${TbbDirectory}/bin/ia32/${TbbCompilerDirectory}/tbb.dll")
        SET(TBB_PDB_RELEASE        "${TbbDirectory}/bin/ia32/${TbbCompilerDirectory}/tbb.pdb")
schultezub's avatar
schultezub committed
29
    ELSEIF(CAMPVIS_WIN64)
schultezub's avatar
schultezub committed
30
31
32
33
34
35
        SET(TBB_LIBRARY_DEBUG      "${TbbDirectory}/lib/intel64/${TbbCompilerDirectory}/tbb_debug.lib")
        SET(TBB_DLL_DEBUG          "${TbbDirectory}/bin/intel64/${TbbCompilerDirectory}/tbb_debug.dll")
        SET(TBB_PDB_DEBUG          "${TbbDirectory}/bin/intel64/${TbbCompilerDirectory}/tbb_debug.pdb")
        SET(TBB_LIBRARY_RELEASE    "${TbbDirectory}/lib/intel64/${TbbCompilerDirectory}/tbb.lib")
        SET(TBB_DLL_RELEASE        "${TbbDirectory}/bin/intel64/${TbbCompilerDirectory}/tbb.dll")
        SET(TBB_PDB_RELEASE        "${TbbDirectory}/bin/intel64/${TbbCompilerDirectory}/tbb.pdb")
schultezub's avatar
schultezub committed
36
    ELSE()
schultezub's avatar
schultezub committed
37
38
        MESSAGE(FATAL_ERROR "Neither CAMPVIS_WIN32 nor CAMPVIS_WIN64 defined!")
    ENDIF(CAMPVIS_WIN32)
schultezub's avatar
schultezub committed
39
40
41
42
43

    IF (TBB_LIBRARY_DEBUG AND TBB_LIBRARY_RELEASE)
        SET(TBB_LIBRARY debug ${TBB_LIBRARY_DEBUG} optimized ${TBB_LIBRARY_RELEASE})
    ENDIF(TBB_LIBRARY_DEBUG AND TBB_LIBRARY_RELEASE)
    
schultezub's avatar
schultezub committed
44
    SET(TBB_LICENSE_FILE "${TbbDirectory}/COPYING")
schultezub's avatar
schultezub committed
45
46
47
48
49
    
ELSE (WIN32)
    FIND_PATH( 
        TBB_INCLUDE_DIR 
        NAMES tbb/mutex.h
schultezub's avatar
schultezub committed
50
        PATHS ${TbbDirectory}/include /usr/include /usr/local/include /sw/include /opt/local/include
schultezub's avatar
schultezub committed
51
52
53
54
        DOC "The directory where tbb/*.h resides"
    )
    FIND_LIBRARY(
        TBB_LIBRARY
55
        NAMES TBB libtbb.so
schultezub's avatar
schultezub committed
56
        PATHS ${TbbDirectory}/lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /sw/lib /opt/local/lib
schultezub's avatar
schultezub committed
57
58
59
60
61
62
63
64
65
66
        DOC "The TBB library"
    )
ENDIF (WIN32)

IF(TBB_INCLUDE_DIR AND TBB_LIBRARY)
    SET(TBB_FOUND TRUE)
ELSE(TBB_INCLUDE_DIR AND TBB_LIBRARY)
    SET(TBB_FOUND FALSE)
ENDIF(TBB_INCLUDE_DIR AND TBB_LIBRARY)

schultezub's avatar
schultezub committed
67
68
UNSET(TbbDirectory)
MARK_AS_ADVANCED(TbbDirectory TbbDirectory TBB_INCLUDE_DIR TBB_LIBRARY TBB_LIBRARY_DEBUG TBB_LIBRARY_RELEASE TBB_DLL_DEBUG TBB_DLL_RELEASE)