Skip to content

Commit

Permalink
fix cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
HDembinski committed Dec 23, 2022
1 parent 6290324 commit c16db24
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ jobs:
- { compiler: gcc-12, cxxstd: '14,17,20', os: ubuntu-22.04 }
- { name: GCC w/ sanitizers, sanitize: yes,
compiler: gcc-12, cxxstd: '14,17,20', os: ubuntu-22.04 }
- { name: Collect coverage, coverage: yes,
compiler: gcc-8, cxxstd: '03,11', os: ubuntu-20.04, install: 'g++-8-multilib', address-model: '32,64' }

# Linux, clang
- { compiler: clang-3.6, cxxstd: '14', os: ubuntu-20.04, container: 'ubuntu:16.04' }
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ add_library(boost_histogram INTERFACE)
add_library(Boost::histogram ALIAS boost_histogram)

target_include_directories(boost_histogram INTERFACE include)
target_compile_features(boost_histogram INTERFACE cxx_std_14)

target_link_libraries(boost_histogram
INTERFACE
Boost::config
Expand All @@ -22,6 +22,8 @@ target_link_libraries(boost_histogram
Boost::math
)

target_compile_features(boost_histogram INTERFACE cxx_std_14)

if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
# Standalone build, fetch dependencies

Expand Down
2 changes: 2 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ boost_test(TYPE compile-fail SOURCES histogram_fail4.cpp)

set(BOOST_TEST_LINK_LIBRARIES Boost::histogram Boost::core)

boost_test(TYPE run SOURCES quick.cpp)

boost_test(TYPE run SOURCES accumulators_count_test.cpp)
boost_test(TYPE run SOURCES accumulators_mean_test.cpp)
boost_test(TYPE run SOURCES accumulators_sum_test.cpp)
Expand Down
1 change: 1 addition & 0 deletions test/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ alias odr :
;

alias cxx14 :
[ run quick.cpp ]
[ run accumulators_count_test.cpp ]
[ run accumulators_fraction_test.cpp ]
[ run accumulators_mean_test.cpp ]
Expand Down
17 changes: 17 additions & 0 deletions test/cmake_install_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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_install_test LANGUAGES CXX)

find_package(boost_histogram REQUIRED)

add_executable(quick ../quick.cpp)
target_link_libraries(quick Boost::histogram)

enable_testing()
add_test(quick quick)

add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
24 changes: 24 additions & 0 deletions test/cmake_subdir_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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)

add_subdirectory(../.. boostorg/histogram)

add_subdirectory(../../../config boostorg/config)
add_subdirectory(../../../core boostorg/core)
add_subdirectory(../../../mp11 boostorg/mp11)
add_subdirectory(../../../throw_exception boostorg/throw_exception)
add_subdirectory(../../../variant2 boostorg/variant2)
add_subdirectory(../../../math boostorg/math)

add_executable(quick ../quick.cpp)
target_link_libraries(quick Boost::histogram)

enable_testing()
add_test(quick quick)

add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
18 changes: 18 additions & 0 deletions test/quick.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2022 Hans Dembinski
//
// 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 <boost/histogram.hpp>

int main() {
using namespace boost::histogram;

auto h = make_histogram(axis::integer<>(0, 5));

h(0);

auto values = {1, 2};
h.fill(values);
}

0 comments on commit c16db24

Please sign in to comment.