Add CMake install support, tests

This commit is contained in:
Peter Dimov
2020-01-08 05:08:37 +02:00
parent 169c0cd52a
commit bfbdf4f45f
6 changed files with 113 additions and 38 deletions

View File

@ -322,6 +322,13 @@ matrix:
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
- os: linux
env: CMAKE_TEST=1
script:
- mkdir __build__ && cd __build__
- cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=smart_ptr ..
- ctest --output-on-failure -R boost_smart_ptr
- os: linux
compiler: g++
env: CMAKE_SUBDIR_TEST=1
@ -331,6 +338,17 @@ matrix:
- cmake --build .
- cmake --build . --target check
- os: linux
env: CMAKE_INSTALL_TEST=1
script:
- mkdir __build__ && cd __build__
- cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES="smart_ptr;assert;config;core;move;static_assert;throw_exception;type_traits" -DCMAKE_INSTALL_PREFIX=~/.local ..
- cmake --build . --target install
- cd ../libs/smart_ptr/test/cmake_install_test && mkdir __build__ && cd __build__
- cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
- cmake --build .
- cmake --build . --target check
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- cd ..

View File

@ -1,12 +1,10 @@
# Copyright 2018 Mike Dev
# Copyright 2018-2020 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
# Partial (add_subdirectory only) and experimental CMake support
# Subject to change; please do not rely on the contents of this file yet
cmake_minimum_required(VERSION 3.5...3.16)
cmake_minimum_required(VERSION 3.5)
project(BoostSmartPtr LANGUAGES CXX)
project(boost_smart_ptr VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_smart_ptr INTERFACE)
add_library(Boost::smart_ptr ALIAS boost_smart_ptr)
@ -14,13 +12,25 @@ add_library(Boost::smart_ptr ALIAS boost_smart_ptr)
target_include_directories(boost_smart_ptr INTERFACE include)
target_link_libraries(boost_smart_ptr
INTERFACE
Boost::assert
Boost::config
Boost::core
Boost::move
Boost::predef
Boost::static_assert
Boost::throw_exception
Boost::type_traits
INTERFACE
Boost::assert
Boost::config
Boost::core
Boost::move
Boost::static_assert
Boost::throw_exception
Boost::type_traits
)
if(BOOST_SUPERPROJECT_VERSION)
include(BoostInstall)
boost_install(TARGETS boost_smart_ptr HEADER_DIRECTORY include/)
endif()
if(BUILD_TESTING)
add_subdirectory(test)
endif()

11
test/CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
# Copyright 2018, 2019 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
if(HAVE_BOOST_TEST)
boost_test_jamfile(FILE Jamfile LINK_LIBRARIES Boost::smart_ptr Boost::core Boost::align Boost::atomic Boost::container_hash)
endif()

View File

@ -57,10 +57,11 @@ run yield_k_test.cpp : : : <threading>multi : yield_k_test.mt ;
run spinlock_test.cpp ;
run spinlock_try_test.cpp ;
run spinlock_try_test.cpp : : : <threading>multi : spinlock_try_test.mt ;
run spinlock_pool_test.cpp : : :
# msvc-8.0, 9.0 optimizer codegen bug for `x % 41`
<toolset>msvc-8.0,<variant>release:<build>no
<toolset>msvc-9.0,<variant>release:<build>no ;
run spinlock_pool_test.cpp
: : :
# msvc-8.0, 9.0 optimizer codegen bug for `x % 41`
<toolset>msvc-8.0,<variant>release:<build>no
<toolset>msvc-9.0,<variant>release:<build>no ;
run make_shared_test.cpp ;
run make_shared_move_emulation_test.cpp ;
@ -78,7 +79,10 @@ run sp_recursive_assign_test.cpp ;
run sp_recursive_assign2_test.cpp ;
run sp_recursive_assign_rv_test.cpp ;
run sp_recursive_assign2_rv_test.cpp ;
compile-fail auto_ptr_lv_fail.cpp : <toolset>gcc-4.4.7:<build>no ;
compile-fail auto_ptr_lv_fail.cpp
: <toolset>gcc-4.4.7:<build>no ;
run atomic_count_test2.cpp ;
run sp_typeinfo_test.cpp ;
compile make_shared_fp_test.cpp ;
@ -158,23 +162,33 @@ compile-fail array_fail_dereference.cpp ;
compile-fail array_fail_member_access.cpp ;
compile-fail array_fail_array_access.cpp ;
run make_shared_array_test.cpp : : : <toolset>msvc-8.0:<build>no ;
run make_shared_arrays_test.cpp ; # <cxxflags>-fno-deduce-init-list no longer needed for gcc-4.6
run make_shared_array_throws_test.cpp : : : <toolset>msvc-8.0:<build>no ;
run make_shared_array_esft_test.cpp : : : <toolset>msvc-8.0:<build>no ;
run make_shared_array_noinit_test.cpp : : : <toolset>msvc-8.0:<build>no ;
run make_shared_array_value_test.cpp : : : <toolset>msvc-8.0:<build>no ;
run make_shared_array_test.cpp
: : : <toolset>msvc-8.0:<build>no ;
run make_shared_arrays_test.cpp ;
run make_shared_array_throws_test.cpp
: : : <toolset>msvc-8.0:<build>no ;
run make_shared_array_esft_test.cpp
: : : <toolset>msvc-8.0:<build>no ;
run make_shared_array_noinit_test.cpp
: : : <toolset>msvc-8.0:<build>no ;
run make_shared_array_value_test.cpp
: : : <toolset>msvc-8.0:<build>no ;
run allocate_shared_array_test.cpp ;
run allocate_shared_arrays_test.cpp ; # <cxxflags>-fno-deduce-init-list no longer needed for gcc-4.6
run allocate_shared_array_throws_test.cpp : : : <toolset>msvc-8.0:<build>no ;
run allocate_shared_array_esft_test.cpp : : : <toolset>msvc-8.0:<build>no ;
run allocate_shared_array_noinit_test.cpp : : : <toolset>msvc-8.0:<build>no ;
run allocate_shared_array_value_test.cpp : : : <toolset>msvc-8.0:<build>no ;
run allocate_shared_arrays_test.cpp ;
run allocate_shared_array_throws_test.cpp
: : : <toolset>msvc-8.0:<build>no ;
run allocate_shared_array_esft_test.cpp
: : : <toolset>msvc-8.0:<build>no ;
run allocate_shared_array_noinit_test.cpp
: : : <toolset>msvc-8.0:<build>no ;
run allocate_shared_array_value_test.cpp
: : : <toolset>msvc-8.0:<build>no ;
run allocate_shared_array_construct_test.cpp ;
run make_unique_test.cpp ;
run make_unique_args_test.cpp ;
run make_unique_value_test.cpp : : : <toolset>gcc-4.6:<cxxflags>-fno-deduce-init-list ;
run make_unique_value_test.cpp
: : : <toolset>gcc-4.6:<cxxflags>-fno-deduce-init-list ;
run make_unique_noinit_test.cpp ;
run make_unique_throws_test.cpp ;
run make_unique_array_test.cpp ;
@ -236,7 +250,8 @@ run shared_ptr_fn_test.cpp ;
run get_deleter_test2.cpp ;
run get_deleter_test3.cpp ;
run get_deleter_array_test2.cpp ;
run get_deleter_array_test3.cpp : : : <toolset>msvc-8.0:<build>no ;
run get_deleter_array_test3.cpp
: : : <toolset>msvc-8.0:<build>no ;
run sp_convertible_test2.cpp ;
@ -258,13 +273,15 @@ run allocate_local_shared_test.cpp ;
run allocate_local_shared_esft_test.cpp ;
run make_local_shared_array_test.cpp ;
run make_local_shared_arrays_test.cpp : : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ;
run make_local_shared_arrays_test.cpp
: : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ;
run make_local_shared_array_throws_test.cpp ;
run make_local_shared_array_esft_test.cpp ;
run make_local_shared_array_noinit_test.cpp ;
run make_local_shared_array_value_test.cpp ;
run allocate_local_shared_array_test.cpp ;
run allocate_local_shared_arrays_test.cpp : : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ;
run allocate_local_shared_arrays_test.cpp
: : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ;
run allocate_local_shared_array_throws_test.cpp ;
run allocate_local_shared_array_esft_test.cpp ;
run allocate_local_shared_array_noinit_test.cpp ;
@ -275,9 +292,11 @@ run local_sp_fn_test.cpp ;
run lsp_convertible_test.cpp ;
run lsp_convertible_test2.cpp ;
run make_shared_array_tmp_test.cpp : : : <toolset>msvc-8.0:<build>no ;
run make_shared_array_tmp_test.cpp
: : : <toolset>msvc-8.0:<build>no ;
run lw_thread_test.cpp : : : <threading>multi ;
run lw_thread_test.cpp
: : : <threading>multi ;
compile sp_windows_h_test.cpp ;
compile spinlock_windows_h_test.cpp ;

View File

@ -0,0 +1,18 @@
# Copyright 2018, 2019 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.16)
project(cmake_subdir_test LANGUAGES CXX)
find_package(boost_smart_ptr REQUIRED)
find_package(boost_core REQUIRED)
add_executable(quick ../quick.cpp)
target_link_libraries(quick Boost::smart_ptr Boost::core)
enable_testing()
add_test(quick quick)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

View File

@ -2,7 +2,7 @@
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.5...3.16)
project(cmake_subdir_test LANGUAGES CXX)
@ -11,7 +11,6 @@ add_subdirectory(../../../assert boostorg/assert)
add_subdirectory(../../../config boostorg/config)
add_subdirectory(../../../core boostorg/core)
add_subdirectory(../../../move boostorg/move)
add_subdirectory(../../../predef boostorg/predef)
add_subdirectory(../../../static_assert boostorg/static_assert)
add_subdirectory(../../../throw_exception boostorg/throw_exception)
add_subdirectory(../../../type_traits boostorg/type_traits)