Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Find TBB #20

Merged
merged 1 commit into from
Jun 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ if(BOOTSTRAP_DEPS)
else(BOOTSTRAP_DEPS)
set(PMDK_PREFIX ${CONF_COMANCHE_HOME}/src/lib/pmdk)
#find_package(PMDK REQUIRED)
find_package(TBB REQUIRED)
set(PMDK_INCLUDE_DIRS ${PMDK_PREFIX}/src/include)

add_subdirectory(src)
Expand Down
36 changes: 36 additions & 0 deletions mk/FindTBB.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#.rst:
# FindTBB
# -------
#
# Finds the TBB library
# https://cmake.org/cmake/help/v3.11/manual/cmake-developer.7.html#find-modules

# This will define the following variables::
#
# TBB_FOUND - True if the system has the TBB library
# TBB_INCLUDE_DIRS
# TBB_LIBRARIES

find_path(TBB_INCLUDE_DIR
PATHS ${CMAKE_INSTALL_PREFIX}/tbb/include
NAMES tbb/tbb.h
)

# installed libraries
find_library(LIB_TBB
PATHS ${CMAKE_INSTALL_PREFIX}/tbb/lib/
NAMES tbb)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(TBB
FOUND_VAR TBB_FOUND
REQUIRED_VARS
TBB_INCLUDE_DIR
LIB_TBB
VERSION_VAR TBB_VERSION
)

if(TBB_FOUND)
set(TBB_LIBRARIES ${LIB_TBB})
set(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
endif()
4 changes: 2 additions & 2 deletions src/components/metadata/fixobd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ project(comanche-mdfixobd CXX)

add_definitions(${GCC_COVERAGE_COMPILE_FLAGS} -DCONFIG_DEBUG)

include_directories(../../../../src/lib/tbb/include/)
include_directories(${TBB_INCLUDE_DIRS})

file(GLOB SOURCES src/*.cpp)

add_library(${PROJECT_NAME} SHARED ${SOURCES})

set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
target_link_libraries(${PROJECT_NAME} common comanche-core pthread numa dl rt tbb)
target_link_libraries(${PROJECT_NAME} common comanche-core pthread numa dl rt ${TBB_LIBRARIES})

# set the linkage in the install/lib
set_target_properties(${PROJECT_NAME} PROPERTIES
Expand Down
4 changes: 2 additions & 2 deletions src/components/store/blob/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ project(comanche-blob CXX)

add_definitions(${GCC_COVERAGE_COMPILE_FLAGS} -DCONFIG_DEBUG)

include_directories(../../../../src/lib/tbb/include/)
include_directories(${TBB_INCLUDE_DIRS})

file(GLOB SOURCES src/*.cpp)

add_library(${PROJECT_NAME} SHARED ${SOURCES})
target_link_libraries(${PROJECT_NAME} common comanche-core numa pthread dl rt tbb)
target_link_libraries(${PROJECT_NAME} common comanche-core numa pthread dl rt ${TBB_LIBRARIES})

# set the linkage in the install/lib
set_target_properties(${PROJECT_NAME} PROPERTIES
Expand Down
4 changes: 2 additions & 2 deletions src/components/store/filestore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ project(comanche-storefile CXX)

add_definitions(${GCC_COVERAGE_COMPILE_FLAGS} -DCONFIG_DEBUG)

include_directories(../../../../src/lib/tbb/include/)
include_directories(${TBB_INCLUDE_DIRS})

enable_language(CXX C ASM)
file(GLOB SOURCES src/*.c*)

add_library(${PROJECT_NAME} SHARED ${SOURCES})

set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
target_link_libraries(${PROJECT_NAME} common comanche-core tbb numa dl rt boost_system boost_filesystem pthread)
target_link_libraries(${PROJECT_NAME} common comanche-core ${TBB_LIBRARIES} numa dl rt boost_system boost_filesystem pthread)

# set the linkage in the install/lib
set_target_properties(${PROJECT_NAME} PROPERTIES
Expand Down
4 changes: 2 additions & 2 deletions src/components/store/nvmestore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include_directories(./src)


include_directories(${PMDK_INCLUDE_DIRS})
include_directories(../../../../src/lib/tbb/include)
include_directories(${TBB_INCLUDE_DIRS})
include_directories(${PMDK_PREFIX}/src/examples/libpmemobj/hashmap/)
include_directories(${DPDK_DIR}/include/dpdk)

Expand All @@ -29,7 +29,7 @@ file(GLOB SOURCES ./src/*.c*)

add_library(${PROJECT_NAME} SHARED ${SOURCES})

target_link_libraries(${PROJECT_NAME} common comanche-core pthread numa dl rt boost_system boost_filesystem tbb ${LIB_PMEM} ${LIB_PMEM_POOL} ${LIB_PMEM_OBJ} )
target_link_libraries(${PROJECT_NAME} common comanche-core pthread numa dl rt boost_system boost_filesystem ${TBB_LIBRARIES} ${LIB_PMEM} ${LIB_PMEM_POOL} ${LIB_PMEM_OBJ} )

set_target_properties(${PROJECT_NAME} PROPERTIES
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${PMDK_PREFIX}/src/nondebug")
Expand Down
13 changes: 8 additions & 5 deletions src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
cmake_minimum_required (VERSION 3.5.1 FATAL_ERROR)

# option to build libraies, on by default
option(BUILD_TBB "build tbb library" ON)

include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)

add_subdirectory(common)
add_subdirectory(core)

if (BUILD_TBB AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_subdirectory(tbb)
endif()
# tbb will be installed into the build-of-root-proj/install/lib/tbb
ExternalProject_Add(tbb
BUILD_IN_SOURCE 1
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tbb
CONFIGURE_COMMAND cmake . -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}/tbb
BUILD_COMMAND make -j
INSTALL_COMMAND make install
)

# libkmod is required but missing in fedora
pkg_check_modules(KMOD libkmod)
Expand Down
2 changes: 1 addition & 1 deletion testing/kvstore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ project (kvstore-perf)
add_definitions(${GCC_COVERAGE_COMPILE_FLAGS} -DCONFIG_DEBUG)

add_executable(kvstore-perf kvstore_perf.cpp)
target_link_libraries(kvstore-perf comanche-core common numa gtest pthread dl boost_program_options tbb profiler)
target_link_libraries(kvstore-perf comanche-core common numa gtest pthread dl boost_program_options ${TBB_LIBRARIES} profiler)