-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from SuperV1234/master
Make library easy to install, put everything into `tp` namespace, add optional `boost::future` support
- Loading branch information
Showing
18 changed files
with
934 additions
and
712 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
boost* | ||
build* | ||
thread_pool-build* | ||
*.pro.user | ||
*.pro.user | ||
*.user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
# thread-poll-cpp build script | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
project(thread-pool-cpp) | ||
list(APPEND CMAKE_MODULE_PATH | ||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") | ||
|
||
cmake_minimum_required(VERSION 2.8) | ||
project(thread-pool-cpp) | ||
add_definitions(-std=c++14 -Wall -Werror -O3) | ||
|
||
ADD_DEFINITIONS( | ||
-std=c++1y -Wall -Werror -O3 | ||
) | ||
|
||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/thread_pool) | ||
# Get all include files | ||
set(THREAD_POOL_CPP_INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/") | ||
include_directories("${THREAD_POOL_CPP_INC_DIR}") | ||
file(GLOB_RECURSE INSTALL_FILES_LIST "${THREAD_POOL_CPP_INC_DIR}/*") | ||
|
||
add_subdirectory(tests) | ||
add_subdirectory(benchmark) | ||
|
||
# Install as header-only library | ||
set_source_files_properties(${INSTALL_FILES_LIST} PROPERTIES HEADER_FILE_ONLY 1) | ||
add_library(HEADER_ONLY_TARGET STATIC ${INSTALL_FILES_LIST}) | ||
set_target_properties(HEADER_ONLY_TARGET PROPERTIES LINKER_LANGUAGE CXX) | ||
install(DIRECTORY ${THREAD_POOL_CPP_INC_DIR} DESTINATION "include") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Copyright (c) 2015-2016 Vittorio Romeo | ||
# License: Academic Free License ("AFL") v. 3.0 | ||
# AFL License page: http://opensource.org/licenses/AFL-3.0 | ||
# http://vittorioromeo.info | [email protected] | ||
|
||
# Adapted from Louise Dionne's FindHana.cmake file | ||
|
||
# Copyright Louis Dionne 2015 | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) | ||
|
||
# TODO: document variables: | ||
# THREAD_POOL_CPP_FOUND | ||
# THREAD_POOL_CPP_INCLUDE_DIR | ||
# THREAD_POOL_CPP_CLONE_DIR | ||
# THREAD_POOL_CPP_ENABLE_TESTS | ||
|
||
find_path( | ||
THREAD_POOL_CPP_INCLUDE_DIR | ||
|
||
NAMES vrm/core.hpp | ||
DOC "Include directory for the thread-pool-cpp library" | ||
|
||
PATH_SUFFIXES include/ | ||
|
||
PATHS | ||
"${PROJECT_SOURCE_DIR}/../thread-pool-cpp/" | ||
"${PROJECT_SOURCE_DIR}/../thread_pool_cpp/" | ||
${THREAD_POOL_CPP_ROOT} | ||
$ENV{THREAD_POOL_CPP_ROOT} | ||
/usr/local/ | ||
/usr/ | ||
/sw/ | ||
/opt/local/ | ||
/opt/csw/ | ||
/opt/ | ||
"${PROJECT_SOURCE_DIR}/extlibs/thread-pool-cpp/" | ||
"${PROJECT_SOURCE_DIR}/extlibs/thread_pool_cpp/" | ||
"${CMAKE_CURRENT_LIST_DIR}/../../" | ||
|
||
NO_DEFAULT_PATH | ||
) | ||
|
||
if (NOT EXISTS "${THREAD_POOL_CPP_INCLUDE_DIR}" AND DEFINED THREAD_POOL_CPP_CLONE_DIR) | ||
set(_build_dir "${CMAKE_CURRENT_BINARY_DIR}/thread-pool-cpp") | ||
|
||
if (DEFINED THREAD_POOL_CPP_ENABLE_TESTS) | ||
set(_test_cmd ${CMAKE_COMMAND} --build ${_build_dir} --target check) | ||
else() | ||
set(_test_cmd "") | ||
endif() | ||
|
||
include(ExternalProject) | ||
ExternalProject_Add(thread_pool_cpp | ||
PREFIX ${_build_dir} | ||
STAMP_DIR ${_build_dir}/_stamps | ||
TMP_DIR ${_build_dir}/_tmp | ||
|
||
# Since we don't have any files to download, we set the DOWNLOAD_DIR | ||
# to TMP_DIR to avoid creating a useless empty directory. | ||
DOWNLOAD_DIR ${_build_dir}/_tmp | ||
|
||
# Download step | ||
GIT_REPOSITORY https://github.com/SuperV1234/thread-pool-cpp | ||
GIT_TAG master | ||
TIMEOUT 20 | ||
|
||
# Configure step | ||
SOURCE_DIR "${THREAD_POOL_CPP_CLONE_DIR}" | ||
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} | ||
|
||
BINARY_DIR "${_build_dir}" | ||
BUILD_COMMAND "" | ||
|
||
# Install step (nothing to be done) | ||
INSTALL_COMMAND "" | ||
|
||
# Test step | ||
TEST_COMMAND ${_test_cmd} | ||
) | ||
|
||
set(THREAD_POOL_CPP_INCLUDE_DIR "${THREAD_POOL_CPP_CLONE_DIR}/include") | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(THREAD_POOL_CPP DEFAULT_MSG THREAD_POOL_CPP_INCLUDE_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#pragma once | ||
|
||
#include "./thread_pool/thread_pool.hpp" |
Oops, something went wrong.