[med-svn] [Git][med-team/libthread-pool][upstream] New upstream version 3.0.3

Nilesh Patra gitlab at salsa.debian.org
Thu Apr 22 16:49:48 BST 2021



Nilesh Patra pushed to branch upstream at Debian Med / libthread-pool


Commits:
f6145268 by Nilesh Patra at 2021-04-22T21:14:28+05:30
New upstream version 3.0.3
- - - - -


4 changed files:

- .travis.yml
- CMakeLists.txt
- + Config.cmake.in
- README.md


Changes:

=====================================
.travis.yml
=====================================
@@ -1,46 +1,39 @@
-dist: trusty
-
 language: cpp
 
 matrix:
   include:
-    - name: "GCC 4.8 (Linux)"  # GCC 4.8.5 & CMake 3.9.2
+    - name: "GCC 4.8 (Linux)"  # GCC 4.8.5 & CMake 3.12.4
       os: linux
+      dist: xenial
       addons:
         apt:
           sources:
             - ubuntu-toolchain-r-test
           packages:
             - g++-4.8
-            - cmake
       env:
         - SET_COMPILER="export CC=gcc-4.8 && export CXX=g++-4.8"
 
-    - name: "Clang 3.5 (Linux)"  # Clang 3.5.0 & CMake 3.9.2
+    - name: "Clang 3.5 (Linux)"  # Clang 3.5.2 & CMake 3.12.4
       os: linux
+      dist: xenial
       addons:
         apt:
-          sources:
-            - llvm-toolchain-trusty-3.5
           packages:
             - clang-3.5
-            - cmake
       env:
         - SET_COMPILER="export CC=clang-3.5 && export CXX=clang++-3.5"
 
-    - name: "Clang Xcode 9.0 (OSX)"  # Clang 9.0.0 & CMake 3.9.2
+    - name: "Clang Xcode 9.4 (OSX)"  # Clang 9.4.1 & CMake 3.15.5
       os: osx
-      osx_image: xcode9
+      osx_image: xcode9.4
 
 before_install:
   - eval "${SET_COMPILER}"
-  - git clone https://github.com/google/googletest && cd googletest && mkdir build && cd build && git checkout 703bd9c
-  - cmake -DCMAKE_CXX_FLAGS="-std=c++11" .. && make && sudo make install
-  - cd ../../
 
 install:
   - mkdir build && cd build
-  - cmake -Dthread_pool_build_tests=ON -DCMAKE_BUILD_TYPE=Release .. && make
+  - cmake -DCMAKE_BUILD_TYPE=Release .. && make
 
 script:
   - ./bin/thread_pool_test


=====================================
CMakeLists.txt
=====================================
@@ -1,6 +1,6 @@
-cmake_minimum_required(VERSION 3.9)
+cmake_minimum_required(VERSION 3.11)
 
-project(thread_pool VERSION 3.0.2
+project(thread_pool VERSION 3.0.3
                     LANGUAGES CXX
                     DESCRIPTION "ThreadPool is a c++ header only library modifying and extending https://github.com/progschj/ThreadPool.")
 
@@ -14,21 +14,80 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
 
+if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
+  set(thread_pool_main_project ON)
+endif ()
+option(thread_pool_install "Generate install target" ${thread_pool_main_project})
+option(thread_pool_build_tests "Build unit tests" ${thread_pool_main_project})
+
 find_package(Threads REQUIRED)
-add_library(${PROJECT_NAME} INTERFACE)
-target_link_libraries(${PROJECT_NAME} INTERFACE
+
+if (thread_pool_build_tests)
+  find_package(GTest 1.10.0 QUIET)
+  if (NOT GTest_FOUND)
+    include(FetchContent)
+
+    FetchContent_Declare(
+      googletest
+      GIT_REPOSITORY https://github.com/google/googletest
+      GIT_TAG release-1.10.0)
+
+    FetchContent_GetProperties(googletest)
+    if (NOT googletest_POPULATED)
+      FetchContent_Populate(googletest)
+      add_subdirectory(
+        ${googletest_SOURCE_DIR}
+        ${googletest_BINARY_DIR}
+        EXCLUDE_FROM_ALL)
+      add_library(GTest::Main ALIAS gtest_main)
+    endif ()
+  endif ()
+endif ()
+
+add_library(thread_pool INTERFACE)
+add_library(${PROJECT_NAME}::thread_pool ALIAS thread_pool)
+
+target_include_directories(thread_pool INTERFACE
+  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+  $<INSTALL_INTERFACE:include>)
+
+target_link_libraries(thread_pool INTERFACE
   Threads::Threads)
 
-target_include_directories(${PROJECT_NAME} INTERFACE
-  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+if (thread_pool_install)
+  include(GNUInstallDirs)
+  include(CMakePackageConfigHelpers)
+
+  configure_package_config_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
+    ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
+    INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
+  write_basic_package_version_file(
+    ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
+    COMPATIBILITY SameMajorVersion)
+
+  install(
+    TARGETS thread_pool
+    EXPORT ${PROJECT_NAME}Targets)
+  install(
+    DIRECTORY include/thread_pool
+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+  install(
+    EXPORT ${PROJECT_NAME}Targets
+    NAMESPACE ${PROJECT_NAME}::
+    DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
+  install(
+    FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
+          ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
+    DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
+endif ()
 
-option(thread_pool_build_tests "Build thread_pool unit tests" OFF)
 if (thread_pool_build_tests)
-  find_package(GTest REQUIRED)
-  add_executable(${PROJECT_NAME}_test
+  add_executable(thread_pool_test
     test/semaphore_test.cpp
     test/thread_pool_test.cpp)
-  target_link_libraries(${PROJECT_NAME}_test
-    ${PROJECT_NAME}
+
+  target_link_libraries(thread_pool_test
+    thread_pool
     GTest::Main)
 endif ()


=====================================
Config.cmake.in
=====================================
@@ -0,0 +1,7 @@
+ at PACKAGE_INIT@
+
+include(CMakeFindDependencyMacro)
+find_dependency(Threads)
+
+include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME at Targets.cmake")
+check_required_components("@PROJECT_NAME@")


=====================================
README.md
=====================================
@@ -7,20 +7,40 @@ ThreadPool is a c++ header only library modifying and extending https://github.c
 
 ## Usage
 
-If you would like to add thread_pool to your project via CMake, add the following:
+To build thread_pool run the following commands:
+```bash
+git clone https://github.com/rvaser/thread_pool && cd thread_pool && mkdir build && cd build
+cmake -DCMAKE_BUILD_TYPE=Release .. && make
+```
+which will create install targets and unit tests. Running `make install` will create a package on your system that can be searched and linked with:
+```cmake
+find_package(thread_pool)
+target_link_libraries(<target> thread_pool:thread_pool)
+```
+On the other hand, you can include thread_pool as a submodule and add it to your project with the following:
 ```cmake
 if (NOT TARGET thread_pool)
   add_subdirectory(<path_to_submodules>/thread_pool EXCLUDE_FROM_ALL)
 endif ()
-target_link_libraries(<your_exe> thread_pool)
+target_link_libraries(<target> thread_pool::thread_pool)
 ```
 
 If you are not using CMake, include the appropriate header file directly to your project and link with pthread.
 
+#### Build options
+
+- `thread_pool_install`: generate install target
+- `thread_pool_build_tests`: build unit tests
+
 #### Dependencies
 
-- gcc 4.8+ or clang 3.5+
-- (optional) cmake 3.9+
+- gcc 4.8+ | clang 3.5+
+- pthread
+- (optional) cmake 3.11+
+
+###### Hidden
+
+- (thread_pool_test) googletest 1.10.0
 
 ## Examples
 
@@ -38,7 +58,7 @@ auto lambda1 = [...] (...) -> void {
   ...
 };
 
-ThreadPool thread_pool{};
+thread_pool::ThreadPool thread_pool{};
 
 std::vector<std::future<int>> futures;
 for (...) {
@@ -59,20 +79,6 @@ for (const auto& it : void_futures) {
 }
 ```
 
-## Unit tests
-
-To build and run thread_pool unit tests run the following commands:
-
-```bash
-git clone https://github.com/rvaser/thread_pool.git thread_pool
-cd thread_pool && mkdir build && cd build
-cmake -Dthread_pool_build_tests=ON -DCMAKE_BUILD_TYPE=Release .. && make
-./bin/thread_pool_test
-```
-
-#### Dependencies
-- gtest
-
 ## Acknowledgement
 
 This work has been supported in part by the Croatian Science Foundation under the project Single genome and metagenome assembly (IP-2018-01-5886).



View it on GitLab: https://salsa.debian.org/med-team/libthread-pool/-/commit/f6145268edf4356489a4a592e1749bd2a2ab79c9

-- 
View it on GitLab: https://salsa.debian.org/med-team/libthread-pool/-/commit/f6145268edf4356489a4a592e1749bd2a2ab79c9
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210422/a44f8ad1/attachment-0001.htm>


More information about the debian-med-commit mailing list