Move CMakeLists.txt to top-level directory of the library

Add missing copyright header to CMakeLists.txt.
Rename build directory to tools.
Update Travis CI and AppVeyor scripts.
Ignore variants of build directory.
Ignore CMakeSettings.json used with CMake integration for VS2017.
Ignore Visual Studio and Visual Studio Code local settings folder.
This commit is contained in:
Mateusz Łoskot 2018-09-17 18:51:13 +02:00 committed by Hans Dembinski
parent a1569b59af
commit 23a1f6c5c4
6 changed files with 60 additions and 50 deletions

View File

@ -19,8 +19,9 @@ environment:
test_script: test_script:
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) # - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- mkdir build
- cd build - cd build
- cmake . - cmake ..
-DBOOST_ROOT="%BOOST_ROOT%" -DBoost_USE_STATIC_LIBS="ON" -DBOOST_ROOT="%BOOST_ROOT%" -DBoost_USE_STATIC_LIBS="ON"
- cmake --build . - cmake --build .
- ctest -V - ctest -V

3
.gitignore vendored
View File

@ -1,5 +1,8 @@
*build*
CMakeSettings.json
doc/html/.buildinfo doc/html/.buildinfo
doc/html/.doctrees doc/html/.doctrees
doc/html/.nojekyll doc/html/.nojekyll
doc/html/objects.inv doc/html/objects.inv
.DS_Store .DS_Store
.vs*

View File

@ -37,25 +37,26 @@ git:
# Install packages (pre-installed: pytest) # Install packages (pre-installed: pytest)
install: install:
- source build/travis_install_boost.sh - source tools/travis_install_boost.sh
- if [ -n "$GCOV" ]; then - if [ -n "$GCOV" ]; then
pip install --user cpp-coveralls urllib3[secure]; pip install --user cpp-coveralls urllib3[secure];
fi fi
script: script:
- mkdir build
- cd build - cd build
- if [ -n "$GCOV" ]; then - if [ -n "$GCOV" ]; then
cmake . -DBOOST_ROOT=${BOOST_DIR} cmake .. -DBOOST_ROOT=${BOOST_DIR}
-DTEST_SERIALIZATION=ON -DTEST_SERIALIZATION=ON
-DCMAKE_BUILD_TYPE=coverage && -DCMAKE_BUILD_TYPE=coverage &&
make -j2 && make -j2 &&
ctest; ctest;
else else
cmake . -DBOOST_ROOT=${BOOST_DIR} cmake .. -DBOOST_ROOT=${BOOST_DIR}
-DBUILD_BENCHMARKS=ON -DBUILD_BENCHMARKS=ON
-DTEST_SERIALIZATION=${SERIAL} -DTEST_SERIALIZATION=${SERIAL}
-DCMAKE_BUILD_TYPE=Debug && -DCMAKE_BUILD_TYPE=Debug &&
make -j2 && make -j2 &&
LSAN_OPTIONS=verbosity=1:log_threads=1 ASAN_OPTIONS=detect_leaks=0 ctest -V; LSAN_OPTIONS=verbosity=1:log_threads=1 ASAN_OPTIONS=detect_leaks=0 ctest -V;
fi fi

View File

@ -1,7 +1,12 @@
# Copyright (c) 2017 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)
#
cmake_minimum_required (VERSION 3.5) cmake_minimum_required (VERSION 3.5)
project(histogram CXX) project(histogram CXX)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -15,8 +20,8 @@ mark_as_advanced(BUILD_BENCHMARKS)
mark_as_advanced(TEST_SERIALIZATION) mark_as_advanced(TEST_SERIALIZATION)
# set build type if none is specified # set build type if none is specified
set(default_build_type "RELEASE") set(default_build_type "Release")
if (EXISTS "${PROJECT_SOURCE_DIR}/../.git") if (EXISTS "${PROJECT_SOURCE_DIR}/.git")
set(default_build_type "Debug") set(default_build_type "Debug")
endif() endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
@ -49,7 +54,7 @@ enable_testing()
function(compiled_test SRC) function(compiled_test SRC)
get_filename_component(BASENAME ${SRC} NAME_WE) get_filename_component(BASENAME ${SRC} NAME_WE)
add_executable(${BASENAME} ${SRC}) add_executable(${BASENAME} ${SRC})
target_include_directories(${BASENAME} PUBLIC ../include ${Boost_INCLUDE_DIR}) target_include_directories(${BASENAME} PUBLIC include ${Boost_INCLUDE_DIR})
if(CMAKE_BUILD_TYPE MATCHES coverage) if(CMAKE_BUILD_TYPE MATCHES coverage)
target_compile_options(${BASENAME} PRIVATE -O0 -g --coverage) target_compile_options(${BASENAME} PRIVATE -O0 -g --coverage)
@ -80,53 +85,53 @@ function(compiled_test SRC)
# endif() # endif()
if (${BASENAME} MATCHES "_fail") if (${BASENAME} MATCHES "_fail")
add_test(${BASENAME} python ${PROJECT_SOURCE_DIR}/pass_on_fail.py ${BASENAME}) add_test(${BASENAME} python ${PROJECT_SOURCE_DIR}/tools/pass_on_fail.py ${BASENAME})
else() else()
add_test(${BASENAME} ${BASENAME}) add_test(${BASENAME} ${BASENAME})
endif() endif()
endfunction() endfunction()
compiled_test(../test/adaptive_storage_test.cpp) compiled_test(test/adaptive_storage_test.cpp)
compiled_test(../test/array_storage_test.cpp) compiled_test(test/array_storage_test.cpp)
compiled_test(../test/axis_test.cpp) compiled_test(test/axis_test.cpp)
compiled_test(../test/detail_test.cpp) compiled_test(test/detail_test.cpp)
compiled_test(../test/histogram_dynamic_add_fail.cpp) compiled_test(test/histogram_dynamic_add_fail.cpp)
compiled_test(../test/histogram_dynamic_at_tuple_wrong_dimension_fail.cpp) compiled_test(test/histogram_dynamic_at_tuple_wrong_dimension_fail.cpp)
compiled_test(../test/histogram_dynamic_at_vector_wrong_dimension_fail.cpp) compiled_test(test/histogram_dynamic_at_vector_wrong_dimension_fail.cpp)
compiled_test(../test/histogram_dynamic_at_wrong_dimension_fail.cpp) compiled_test(test/histogram_dynamic_at_wrong_dimension_fail.cpp)
compiled_test(../test/histogram_dynamic_reduce_wrong_order_fail.cpp) compiled_test(test/histogram_dynamic_reduce_wrong_order_fail.cpp)
compiled_test(../test/histogram_static_add_fail.cpp) compiled_test(test/histogram_static_add_fail.cpp)
compiled_test(../test/histogram_static_at_vector_wrong_dimension_fail.cpp) compiled_test(test/histogram_static_at_vector_wrong_dimension_fail.cpp)
compiled_test(../test/histogram_dynamic_test.cpp) compiled_test(test/histogram_dynamic_test.cpp)
compiled_test(../test/histogram_mixed_test.cpp) compiled_test(test/histogram_mixed_test.cpp)
compiled_test(../test/histogram_test.cpp) compiled_test(test/histogram_test.cpp)
compiled_test(../test/index_mapper_test.cpp) compiled_test(test/index_mapper_test.cpp)
compiled_test(../test/meta_test.cpp) compiled_test(test/meta_test.cpp)
compiled_test(../test/utility_test.cpp) compiled_test(test/utility_test.cpp)
compiled_test(../test/weight_counter_test.cpp) compiled_test(test/weight_counter_test.cpp)
compiled_test(../examples/getting_started_listing_01.cpp) compiled_test(examples/getting_started_listing_01.cpp)
compiled_test(../examples/getting_started_listing_02.cpp) compiled_test(examples/getting_started_listing_02.cpp)
compiled_test(../examples/guide_access_bin_counts.cpp) compiled_test(examples/guide_access_bin_counts.cpp)
compiled_test(../examples/guide_axis_with_labels.cpp) compiled_test(examples/guide_axis_with_labels.cpp)
compiled_test(../examples/guide_axis_with_uoflow_off.cpp) compiled_test(examples/guide_axis_with_uoflow_off.cpp)
compiled_test(../examples/guide_custom_axis.cpp) compiled_test(examples/guide_custom_axis.cpp)
compiled_test(../examples/guide_custom_storage.cpp) compiled_test(examples/guide_custom_storage.cpp)
compiled_test(../examples/guide_fill_histogram.cpp) compiled_test(examples/guide_fill_histogram.cpp)
compiled_test(../examples/guide_histogram_operators.cpp) compiled_test(examples/guide_histogram_operators.cpp)
compiled_test(../examples/guide_histogram_reduction.cpp) compiled_test(examples/guide_histogram_reduction.cpp)
compiled_test(../examples/guide_histogram_streaming.cpp) compiled_test(examples/guide_histogram_streaming.cpp)
compiled_test(../examples/guide_make_dynamic_histogram.cpp) compiled_test(examples/guide_make_dynamic_histogram.cpp)
compiled_test(../examples/guide_make_static_histogram.cpp) compiled_test(examples/guide_make_static_histogram.cpp)
if (TEST_SERIALIZATION) if (TEST_SERIALIZATION)
compiled_test(../examples/guide_histogram_serialization.cpp Boost::serialization) compiled_test(examples/guide_histogram_serialization.cpp Boost::serialization)
target_link_libraries(guide_histogram_serialization PUBLIC Boost::serialization) target_link_libraries(guide_histogram_serialization PUBLIC Boost::serialization)
compiled_test(../test/adaptive_storage_serialization_test.cpp Boost::serialization) compiled_test(test/adaptive_storage_serialization_test.cpp Boost::serialization)
target_link_libraries(adaptive_storage_serialization_test PUBLIC Boost::serialization) target_link_libraries(adaptive_storage_serialization_test PUBLIC Boost::serialization)
compiled_test(../test/histogram_serialization_test.cpp Boost::serialization) compiled_test(test/histogram_serialization_test.cpp Boost::serialization)
target_link_libraries(histogram_serialization_test PUBLIC Boost::serialization) target_link_libraries(histogram_serialization_test PUBLIC Boost::serialization)
endif() endif()
@ -134,8 +139,8 @@ if (BUILD_BENCHMARKS)
if (NOT ${CMAKE_BUILD_TYPE} EQUAL Release) if (NOT ${CMAKE_BUILD_TYPE} EQUAL Release)
message(WARNING "Benchmarks should be build in Release mode") message(WARNING "Benchmarks should be build in Release mode")
endif() endif()
add_executable(speed_cpp ../test/speed_cpp.cpp) add_executable(speed_cpp test/speed_cpp.cpp)
target_include_directories(speed_cpp PRIVATE ../include ${Boost_INCLUDE_DIR}) target_include_directories(speed_cpp PRIVATE include ${Boost_INCLUDE_DIR})
target_compile_definitions(speed_cpp PRIVATE -DBOOST_DISABLE_ASSERTS) target_compile_definitions(speed_cpp PRIVATE -DBOOST_DISABLE_ASSERTS)
target_compile_options(speed_cpp PRIVATE -O3) target_compile_options(speed_cpp PRIVATE -O3)
endif() endif()