Skip to content

Commit

Permalink
CMake: now using lib & includes, found by CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleivg committed Aug 7, 2018
1 parent 3854ed9 commit d16dfa5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
22 changes: 15 additions & 7 deletions cmake/FindTBB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ if (WIN32)
set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB")
set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_MALLOC_PROXY_NAME "${_TBB_LIB_NAME}malloc_proxy")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
if (MSVC71)
Expand Down Expand Up @@ -78,6 +79,7 @@ if (UNIX)
# libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_MALLOC_PROXY_NAME "${_TBB_LIB_NAME}malloc_proxy")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
# has only one flavor: ia32/cc4.0.1_os10.4.9
Expand All @@ -88,6 +90,7 @@ if (UNIX)
set(_TBB_DEFAULT_INSTALL_DIR "/opt/intel/tbb" "/usr/local/include" "/usr/include")
set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_MALLOC_PROXY_NAME "${_TBB_LIB_NAME}malloc_proxy")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
# 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
Expand Down Expand Up @@ -135,10 +138,12 @@ endif (NOT _TBB_INSTALL_DIR)

if (TBB_OBVIOUS_PLACE)
set (TBB_FOUND "YES")
set (TBB_LIBRARIES ${TEST_TBB_LIBRARY} ${TBB_LIBRARIES})
find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME})
find_library(TBB_MALLOC_PROXY_LIBRARY ${_TBB_LIB_MALLOC_PROXY_NAME} ${TBB_LIBRARY_DIR})
set (TBB_LIBRARIES ${TEST_TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_MALLOC_PROXY_LIBRARY} ${TBB_LIBRARIES})
set (TBB_INCLUDE_DIRS ${TEST_TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES)
message(STATUS "Found Intel TBB")
message(STATUS "Found Intel TBB, includes ${TBB_INCLUDE_DIRS}, ${TBB_LIBRARIES}")
elseif (NOT _TBB_INSTALL_DIR)
message (FATAL_ERROR "ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
else (TBB_OBVIOUS_PLACE)
Expand All @@ -163,34 +168,37 @@ else (TBB_OBVIOUS_PLACE)
if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
set (TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib")
else (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
# Undeprecated to allow for Windows use.
# Undeprecated to allow for Windows use.
set (TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/lib/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}")
endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")

find_library(TBB_LIBRARY ${_TBB_LIB_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH)
find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH)
mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY)
find_library(TBB_MALLOC_PROXY_LIBRARY ${_TBB_LIB_MALLOC_PROXY_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH)

mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY TBB_MALLOC_PROXY_LIBRARY)

#-- Look for debug libraries
find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH)
find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH)
mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG)

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

if (TBB_INCLUDE_DIR)
if (TBB_LIBRARY)
set (TBB_FOUND "YES")
if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
set(TBB_LIBRARIES optimized ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES} debug ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
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})
else()
set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES})
set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_MALLOC_PROXY_LIBRARY} ${TBB_LIBRARIES})
set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
mark_as_advanced(TBB_DEBUG_LIBRARIES)
endif()
set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE)
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_LIBRARIES)
message(STATUS "Found Intel TBB")
message(STATUS "Found Intel TBB, includes ${TBB_INCLUDE_DIRS}, ${TBB_LIBRARIES}")
endif (TBB_LIBRARY)
endif (TBB_INCLUDE_DIR)

Expand Down
3 changes: 1 addition & 2 deletions src/xrCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/pugixml/src
#${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
${SDL_INCLUDE_DIR}
${TBB_INCLUDE_DIRS}
)

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

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

target_link_libraries(${PROJECT_NAME} xrMiscMath ${SDL_LIBRARIES} ${LZO_LIBRARIES} ${CRYPTO++_LIBRARIES} ${PUGIXML_LIBRARY} ${TBB_LIBRARIES})
4 changes: 3 additions & 1 deletion src/xrEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/luabind
${SDL_INCLUDE_DIR}
${FREEIMAGE_INCLUDE_PATH}
${LOCKFILE_INCLUDE_DIR}
)

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

set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
target_link_libraries(${PROJECT_NAME} xrCore xrMiscMath luabind xrAPI xrSound xrScriptEngine ${LUA_LIBRARIES} theora ${OGG_LIBRARIES} xrCDB xrPhysics freeimage openal lockfile ${SDL_LIBRARIES})
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 comments on commit d16dfa5

Please sign in to comment.