diff --git a/.travis.yml b/.travis.yml index b7f5021..737f895 100644 --- a/.travis.yml +++ b/.travis.yml @@ -225,6 +225,22 @@ matrix: env: TOOLSET=clang COMPILER=clang++ CXXSTD64=03,11,14,1z osx_image: xcode9.4 +# cmake self-test + - os: linux + env: TEST_CMAKE=1 + addons: + apt: + packages: + - cmake + script: + - mkdir __build_static__ && cd __build_static__ + - cmake ../libs/atomic/test/test_cmake + - cmake --build . + - cd .. + - mkdir __build_shared__ && cd __build_shared__ + - cmake -DBUILD_SHARED_LIBS=On ../libs/atomic/test/test_cmake + - cmake --build . + install: - cd .. @@ -238,8 +254,7 @@ install: - git submodule update --jobs 4 - cp -r $TRAVIS_BUILD_DIR/* libs/atomic - python tools/boostdep/depinst/depinst.py atomic - - ./bootstrap.sh - - ./b2 headers + - if [ -n "$TEST_CMAKE" ]; then ./bootstrap.sh; ./b2 headers; fi script: - |- diff --git a/test/test_cmake/CMakeLists.txt b/test/test_cmake/CMakeLists.txt new file mode 100644 index 0000000..323ab4c --- /dev/null +++ b/test/test_cmake/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright 2018 Mike Dev +# 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 +# +# NOTE: This does NOT run the unit tests for Boost.Atomic. +# It only tests, if the CMakeLists.txt file in it's root works as expected + +cmake_minimum_required( VERSION 3.5 ) + +project( BoostAtomicCMakeSelfTest ) + +add_definitions( -DBOOST_ALL_NO_LIB ) + +add_subdirectory( ../../../assert ${CMAKE_CURRENT_BINARY_DIR}/libs/assert ) +add_subdirectory( ../../../config ${CMAKE_CURRENT_BINARY_DIR}/libs/config ) +add_subdirectory( ../../../static_assert ${CMAKE_CURRENT_BINARY_DIR}/libs/static_assert ) +add_subdirectory( ../../../type_traits ${CMAKE_CURRENT_BINARY_DIR}/libs/type_traits ) + +add_subdirectory( ../.. ${CMAKE_CURRENT_BINARY_DIR}/libs/boost_atomic ) + +add_executable( boost_atomic_cmake_self_test main.cpp ) +target_link_libraries( boost_atomic_cmake_self_test Boost::atomic ) diff --git a/test/test_cmake/main.cpp b/test/test_cmake/main.cpp new file mode 100644 index 0000000..638b072 --- /dev/null +++ b/test/test_cmake/main.cpp @@ -0,0 +1,22 @@ +// Copyright (c) 2018 Mike Dev +// +// 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 + +struct Dummy +{ + int x[128]; +}; + +int main() +{ + Dummy d = {}; + boost::atomic ad; + + // this operation requires functions from + // the compiled part of Boost.Atomic + ad = d; +}