Skip to content

Commit d16dfa5

Browse files
committed
CMake: now using lib & includes, found by CMake
1 parent 3854ed9 commit d16dfa5

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

cmake/FindTBB.cmake

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ if (WIN32)
4545
set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB")
4646
set(_TBB_LIB_NAME "tbb")
4747
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
48+
set(_TBB_LIB_MALLOC_PROXY_NAME "${_TBB_LIB_NAME}malloc_proxy")
4849
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
4950
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
5051
if (MSVC71)
@@ -78,6 +79,7 @@ if (UNIX)
7879
# libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
7980
set(_TBB_LIB_NAME "tbb")
8081
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
82+
set(_TBB_LIB_MALLOC_PROXY_NAME "${_TBB_LIB_NAME}malloc_proxy")
8183
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
8284
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
8385
# has only one flavor: ia32/cc4.0.1_os10.4.9
@@ -88,6 +90,7 @@ if (UNIX)
8890
set(_TBB_DEFAULT_INSTALL_DIR "/opt/intel/tbb" "/usr/local/include" "/usr/include")
8991
set(_TBB_LIB_NAME "tbb")
9092
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
93+
set(_TBB_LIB_MALLOC_PROXY_NAME "${_TBB_LIB_NAME}malloc_proxy")
9194
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
9295
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
9396
# has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21
@@ -135,10 +138,12 @@ endif (NOT _TBB_INSTALL_DIR)
135138

136139
if (TBB_OBVIOUS_PLACE)
137140
set (TBB_FOUND "YES")
138-
set (TBB_LIBRARIES ${TEST_TBB_LIBRARY} ${TBB_LIBRARIES})
141+
find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME})
142+
find_library(TBB_MALLOC_PROXY_LIBRARY ${_TBB_LIB_MALLOC_PROXY_NAME} ${TBB_LIBRARY_DIR})
143+
set (TBB_LIBRARIES ${TEST_TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_MALLOC_PROXY_LIBRARY} ${TBB_LIBRARIES})
139144
set (TBB_INCLUDE_DIRS ${TEST_TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
140145
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES)
141-
message(STATUS "Found Intel TBB")
146+
message(STATUS "Found Intel TBB, includes ${TBB_INCLUDE_DIRS}, ${TBB_LIBRARIES}")
142147
elseif (NOT _TBB_INSTALL_DIR)
143148
message (FATAL_ERROR "ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
144149
else (TBB_OBVIOUS_PLACE)
@@ -163,34 +168,37 @@ else (TBB_OBVIOUS_PLACE)
163168
if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
164169
set (TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib")
165170
else (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
166-
# Undeprecated to allow for Windows use.
171+
# Undeprecated to allow for Windows use.
167172
set (TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/lib/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}")
168173
endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
169174

170175
find_library(TBB_LIBRARY ${_TBB_LIB_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH)
171176
find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH)
172-
mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY)
177+
find_library(TBB_MALLOC_PROXY_LIBRARY ${_TBB_LIB_MALLOC_PROXY_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH)
178+
179+
mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY TBB_MALLOC_PROXY_LIBRARY)
173180

174181
#-- Look for debug libraries
175182
find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH)
176183
find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH)
177184
mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG)
178185

186+
message(STATUS "Found obvious Intel TBB, includes ${TBB_INCLUDE_DIRS}, ${TBB_LIBRARIES}")
179187

180188
if (TBB_INCLUDE_DIR)
181189
if (TBB_LIBRARY)
182190
set (TBB_FOUND "YES")
183191
if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
184-
set(TBB_LIBRARIES optimized ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES} debug ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
192+
set(TBB_LIBRARIES optimized ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_MALLOC_PROXY_LIBRARY} ${TBB_LIBRARIES} debug ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
185193
else()
186-
set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES})
194+
set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_MALLOC_PROXY_LIBRARY} ${TBB_LIBRARIES})
187195
set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
188196
mark_as_advanced(TBB_DEBUG_LIBRARIES)
189197
endif()
190198
set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
191199
set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE)
192200
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_LIBRARIES)
193-
message(STATUS "Found Intel TBB")
201+
message(STATUS "Found Intel TBB, includes ${TBB_INCLUDE_DIRS}, ${TBB_LIBRARIES}")
194202
endif (TBB_LIBRARY)
195203
endif (TBB_INCLUDE_DIR)
196204

src/xrCore/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ include_directories(
2121
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/pugixml/src
2222
#${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
2323
${SDL_INCLUDE_DIR}
24+
${TBB_INCLUDE_DIRS}
2425
)
2526

2627
add_definitions(-DXRCORE_EXPORTS)
2728
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}__SOURCES} ${${PROJECT_NAME}__INCLUDES})
2829

2930
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
30-
#this is a temporary solution until find_package will not be fixed
31-
set(TBB_LIBRARIES tbb tbbmalloc_proxy tbbmalloc)
3231

3332
target_link_libraries(${PROJECT_NAME} xrMiscMath ${SDL_LIBRARIES} ${LZO_LIBRARIES} ${CRYPTO++_LIBRARIES} ${PUGIXML_LIBRARY} ${TBB_LIBRARIES})

src/xrEngine/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ include_directories(
1212
${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
1313
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/luabind
1414
${SDL_INCLUDE_DIR}
15+
${FREEIMAGE_INCLUDE_PATH}
16+
${LOCKFILE_INCLUDE_DIR}
1517
)
1618

1719
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./tntQAVI.cpp")
@@ -29,4 +31,4 @@ add_definitions(-DENGINE_BUILD)
2931
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}__SOURCES} ${${PROJECT_NAME}__INCLUDES})
3032

3133
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
32-
target_link_libraries(${PROJECT_NAME} xrCore xrMiscMath luabind xrAPI xrSound xrScriptEngine ${LUA_LIBRARIES} theora ${OGG_LIBRARIES} xrCDB xrPhysics freeimage openal lockfile ${SDL_LIBRARIES})
34+
target_link_libraries(${PROJECT_NAME} xrCore xrMiscMath luabind xrAPI xrSound xrScriptEngine ${LUA_LIBRARIES} theora ${OGG_LIBRARIES} xrCDB xrPhysics ${FREEIMAGE_LIBRARY} openal ${LOCKFILE_LIBRARIES} ${SDL_LIBRARIES})

0 commit comments

Comments
 (0)