Skip to content

Commit

Permalink
Merging develop into master for Hana version 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ldionne committed Feb 25, 2017
2 parents 7a3e048 + 7f2a329 commit cae3fb3
Show file tree
Hide file tree
Showing 1,652 changed files with 3,846 additions and 2,280 deletions.
7 changes: 4 additions & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright Louis Dionne 2013-2016
# Copyright Louis Dionne 2013-2017
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)

Expand Down Expand Up @@ -42,9 +42,10 @@ install:
############################################################################
# Install a recent CMake
############################################################################
- set CMAKE_URL="https://cmake.org/files/v3.4/cmake-3.4.0-win32-x86.zip"
- set CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-win64-x64.zip"
- appveyor DownloadFile %CMAKE_URL% -FileName cmake.zip
- 7z x cmake.zip -oC:\projects\deps\cmake > nul
- 7z x cmake.zip -oC:\projects\deps > nul
- move C:\projects\deps\cmake-* C:\projects\deps\cmake # Move to a version-agnostic directory
- set PATH=C:\projects\deps\cmake\bin;%PATH%
- cmake --version

Expand Down
49 changes: 32 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright Louis Dionne 2013-2016
# Copyright Louis Dionne 2013-2017
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)

Expand Down Expand Up @@ -42,6 +42,7 @@ cache:
- ${TRAVIS_BUILD_DIR}/deps/boost-1.60.0
- ${TRAVIS_BUILD_DIR}/deps/boost-1.61.0
- ${TRAVIS_BUILD_DIR}/deps/boost-1.62.0
- ${TRAVIS_BUILD_DIR}/deps/boost-1.63.0


matrix:
Expand All @@ -64,31 +65,31 @@ matrix:
##########################################################################
# Clang 3.5
# TODO: Find out why this fails to compile the test suite.
# - env: UNIT_TESTS=true LLVM_VERSION=3.5.2 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
# - env: UNIT_TESTS=true LLVM_VERSION=3.5.2 BOOST_VERSION=default ENABLE_MEMCHECK=true

# Clang 3.6
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=3.6.2 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
env: UNIT_TESTS=true LLVM_VERSION=3.6.2 BOOST_VERSION=default ENABLE_MEMCHECK=true
compiler: clang

# Clang 3.7
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=3.7.1 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
env: UNIT_TESTS=true LLVM_VERSION=3.7.1 BOOST_VERSION=default ENABLE_MEMCHECK=true
compiler: clang

# Clang 3.8
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=3.8.0 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
env: UNIT_TESTS=true LLVM_VERSION=3.8.0 BOOST_VERSION=default ENABLE_MEMCHECK=true
compiler: clang

# Clang 3.9
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=3.9.0 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
env: UNIT_TESTS=true LLVM_VERSION=3.9.0 BOOST_VERSION=default ENABLE_MEMCHECK=true
compiler: clang

# GCC 6
- os: linux
env: UNIT_TESTS=true COMPILER=g++-6 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
env: UNIT_TESTS=true COMPILER=g++-6 BOOST_VERSION=default ENABLE_MEMCHECK=true
compiler: gcc

# Xcode 6.4
Expand Down Expand Up @@ -144,6 +145,11 @@ matrix:
env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=1.61.0
compiler: clang

# With Boost 1.62
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=1.62.0
compiler: clang

# Without Boost (make sure we don't depend on it)
- os: linux
env: UNIT_TESTS=true LLVM_VERSION=default
Expand Down Expand Up @@ -210,7 +216,7 @@ install:
# Setup default versions and override compiler if needed
############################################################################
- if [[ "${LLVM_VERSION}" == "default" ]]; then LLVM_VERSION=3.9.0; fi
- if [[ "${BOOST_VERSION}" == "default" ]]; then BOOST_VERSION=1.62.0; fi
- if [[ "${BOOST_VERSION}" == "default" ]]; then BOOST_VERSION=1.63.0; fi

- if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi

Expand All @@ -237,16 +243,18 @@ install:
fi
############################################################################
# Install a recent CMake (unless already installed on OS X)
# Install a recent CMake
############################################################################
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz"
CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz"
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
else
if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi
brew install cmake
brew upgrade cmake
fi
- cmake --version

############################################################################
# Install Boost.Build
Expand Down Expand Up @@ -284,6 +292,7 @@ install:
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_DIR}/install/lib"
export PATH="${LLVM_DIR}/clang/bin:${PATH}"
fi
- ${CXX} --version

############################################################################
# Install a recent Doxygen
Expand All @@ -293,6 +302,7 @@ install:
DOXYGEN_URL="http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.11.linux.bin.tar.gz"
mkdir doxygen && travis_retry wget --quiet -O - ${DOXYGEN_URL} | tar --strip-components=1 -xz -C doxygen
export PATH=${DEPS_DIR}/doxygen/bin:${PATH}
doxygen --version
fi
############################################################################
Expand All @@ -312,13 +322,13 @@ before_script:
# Set the git identity (for pushing the documentation and the benchmarks)
############################################################################
- git config --global user.name "Travis bot"
- git config --global user.email "[email protected]"
- git config --global user.email "<>"

############################################################################
# Go back to the root of the project and setup the build directory
############################################################################
- cd ${TRAVIS_BUILD_DIR}
- (mkdir build && cd build && cmake .. -DBOOST_HANA_ENABLE_WERROR=ON ${CMAKE_OPTIONS})
- (mkdir build && cd build && cmake .. ${CMAKE_OPTIONS})


script:
Expand All @@ -329,7 +339,7 @@ script:
if [[ "${CHECK_FORMATTING}" == "true" ]]; then
# Find non-ASCII characters in headers
hpps=$(find include doc -name \*\.hpp)
cpps=$(find test example experimental -name \*\.cpp)
cpps=$(find test example -name \*\.cpp)
pcregrep --color='auto' -n "[\x80-\xFF]" ${hpps} ${cpps}
if [[ $? -ne 1 ]]; then exit 1; fi
Expand All @@ -356,7 +366,7 @@ script:
pushd doc/html
git add --all .
git commit --allow-empty -m "Update to ${TRAVIS_COMMIT:0:7}"
git commit --allow-empty -m "Update documentation to ${TRAVIS_COMMIT:0:7}"
# Suppress output to avoid leaking the token
travis_retry git push origin gh-pages &>/dev/null
popd
Expand All @@ -367,6 +377,7 @@ script:
if [[ "${DOCUMENTATION}" == "true" && "${BOOST_BUILD}" == "true" ]]; then
touch Jamroot
(cd doc && b2)
if [[ ! -d doc/html ]]; then exit 1; fi
fi
############################################################################
Expand Down Expand Up @@ -409,8 +420,12 @@ script:
############################################################################
- |
if [[ "${UNIT_TESTS}" == "true" && "${BOOST_BUILD}" != "true" ]]; then
export CTEST_PARALLEL_LEVEL=2 # Run unit tests on two cores
(cd build && make check -j2 -k)
(cd build && make tests examples -j2 -k) &&
if [[ "${ENABLE_MEMCHECK}" == "true" ]]; then
(cd build && ctest --output-on-failure -j2 -D ExperimentalMemCheck)
else
(cd build && ctest --output-on-failure -j2)
fi
fi
- |
Expand Down
123 changes: 60 additions & 63 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Copyright Louis Dionne 2013-2016
# Copyright Louis Dionne 2013-2017
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)

cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.7)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")


Expand Down Expand Up @@ -33,12 +33,23 @@ include(CheckCxxCompilerSupport)
add_library(hana INTERFACE)
target_include_directories(hana INTERFACE include)

include(CheckCXXCompilerFlag)
# On Clang for Windows, -std=c++14 is not known, but -std=c++1y appears to work.
if (MSVC AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
check_cxx_compiler_flag(-std=c++1y BOOST_HANA_HAS_STD_CPP1Y)
if (BOOST_HANA_HAS_STD_CPP1Y)
target_add_compile_options(hana INTERFACE -std=c++1y)
endif()
else()
# TODO: Set these as interface properties when supported
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
endif()


##############################################################################
# Setup CMake options
##############################################################################
option(BOOST_HANA_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
option(BOOST_HANA_ENABLE_MEMCHECK "Run the unit tests and examples under Valgrind if it is found." OFF)
option(BOOST_HANA_ENABLE_CONCEPT_CHECKS "Enable concept checking in the interface methods." ON)
option(BOOST_HANA_ENABLE_DEBUG_MODE "Enable Hana's debug mode." OFF)

Expand All @@ -53,55 +64,49 @@ option(BOOST_HANA_ENABLE_EXCEPTIONS


##############################################################################
# Setup compiler flags (more can be set on a per-target basis or in subdirectories)
# Function to setup common compiler flags on tests and examples
##############################################################################
include(CheckCXXCompilerFlag)
macro(boost_hana_append_flag testname flag)
check_cxx_compiler_flag(${flag} ${testname})
if (${testname})
add_compile_options(${flag})
endif()
endmacro()
function(boost_hana_set_test_properties target)
target_link_libraries(${target} PRIVATE hana)
set_target_properties(${target} PROPERTIES CXX_EXTENSIONS NO)

# Compiler flags controlled by CMake options above
if (BOOST_HANA_ENABLE_WERROR)
boost_hana_append_flag(BOOST_HANA_HAS_WERROR -Werror)
boost_hana_append_flag(BOOST_HANA_HAS_WX -WX)
endif()
macro(setflag testname flag)
check_cxx_compiler_flag(${flag} ${testname})
if (${testname})
target_compile_options(${target} PRIVATE ${flag})
endif()
endmacro()

if (NOT BOOST_HANA_ENABLE_CONCEPT_CHECKS)
add_definitions(-DBOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS)
endif()
setflag(BOOST_HANA_HAS_FDIAGNOSTICS_COLOR -fdiagnostics-color)
setflag(BOOST_HANA_HAS_FTEMPLATE_BACKTRACE_LIMIT -ftemplate-backtrace-limit=0)
setflag(BOOST_HANA_HAS_PEDANTIC -pedantic)
setflag(BOOST_HANA_HAS_WALL -Wall)
setflag(BOOST_HANA_HAS_WERROR -Werror)
setflag(BOOST_HANA_HAS_WEXTRA -Wextra)
setflag(BOOST_HANA_HAS_WNO_UNUSED_LOCAL_TYPEDEFS -Wno-unused-local-typedefs)
setflag(BOOST_HANA_HAS_WWRITE_STRINGS -Wwrite-strings)

if (BOOST_HANA_ENABLE_DEBUG_MODE)
add_definitions(-DBOOST_HANA_CONFIG_ENABLE_DEBUG_MODE)
endif()
if (NOT BOOST_HANA_ENABLE_EXCEPTIONS)
setflag(BOOST_HANA_HAS_FNO_EXCEPTIONS -fno-exceptions)
endif()

if (BOOST_HANA_ENABLE_STRING_UDL)
add_definitions(-DBOOST_HANA_CONFIG_ENABLE_STRING_UDL)
# GCC pretends to have the flag, but produces a "unrecognized command line option"
# warning when we use it.
if (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
boost_hana_append_flag(BOOST_HANA_HAS_WNO_GNU_STRING_UDL
-Wno-gnu-string-literal-operator-template)
if (NOT BOOST_HANA_ENABLE_CONCEPT_CHECKS)
target_compile_definitions(${target} PRIVATE -DBOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS)
endif()
endif()

if (NOT BOOST_HANA_ENABLE_EXCEPTIONS)
boost_hana_append_flag(BOOST_HANA_HAS_FNO_EXCEPTIONS -fno-exceptions)
endif()
if (BOOST_HANA_ENABLE_DEBUG_MODE)
target_compile_definitions(${target} PRIVATE -DBOOST_HANA_CONFIG_ENABLE_DEBUG_MODE)
endif()

# Other compiler flags
boost_hana_append_flag(BOOST_HANA_HAS_FDIAGNOSTICS_COLOR -fdiagnostics-color)
boost_hana_append_flag(BOOST_HANA_HAS_FTEMPLATE_BACKTRACE_LIMIT -ftemplate-backtrace-limit=0)
boost_hana_append_flag(BOOST_HANA_HAS_PEDANTIC -pedantic)
boost_hana_append_flag(BOOST_HANA_HAS_STDCXX1Y -std=c++1y)
boost_hana_append_flag(BOOST_HANA_HAS_QUNUSED_ARGUMENTS -Qunused-arguments)
boost_hana_append_flag(BOOST_HANA_HAS_W -W)
boost_hana_append_flag(BOOST_HANA_HAS_WALL -Wall)
boost_hana_append_flag(BOOST_HANA_HAS_WEXTRA -Wextra)
boost_hana_append_flag(BOOST_HANA_HAS_WNO_UNUSED_LOCAL_TYPEDEFS -Wno-unused-local-typedefs)
boost_hana_append_flag(BOOST_HANA_HAS_WWRITE_STRINGS -Wwrite-strings)
if (BOOST_HANA_ENABLE_STRING_UDL)
target_compile_definitions(${target} PRIVATE -DBOOST_HANA_CONFIG_ENABLE_STRING_UDL)
# GCC pretends to have the flag, but produces a "unrecognized command line option"
# warning when we use it.
if (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
setflag(BOOST_HANA_HAS_WNO_GNU_STRING_UDL -Wno-gnu-string-literal-operator-template)
endif()
endif()
endfunction()


##############################################################################
Expand Down Expand Up @@ -143,22 +148,6 @@ function(boost_hana_target_name_for out file)
set(${out} "${_name}" PARENT_SCOPE)
endfunction()

# boost_hana_add_test(<name> <command> [<arg>...])
#
# Creates a test called `name`, which runs the given `command` with the given
# `arg`uments. However, if `BOOST_HANA_ENABLE_MEMCHECK` is set to `ON`, the
# test will run the provided command under the memory checker.
if (BOOST_HANA_ENABLE_MEMCHECK)
find_package(Valgrind REQUIRED)
function(boost_hana_add_test name)
add_test(${name} ${Valgrind_EXECUTABLE} --leak-check=full --error-exitcode=1 ${ARGN})
endfunction()
else()
function(boost_hana_add_test name)
add_test(${name} ${ARGN})
endfunction()
endif()


##############################################################################
# Setup the `check` target to build and then run all the tests and examples.
Expand All @@ -170,13 +159,21 @@ add_custom_target(check


##############################################################################
# Setup subdirectories
# Setup subdirectories and testing
##############################################################################
enable_testing()
find_program(MEMORYCHECK_COMMAND valgrind)
if (MEMORYCHECK_COMMAND)
message(STATUS "Found Valgrind: ${MEMORYCHECK_COMMAND}")
set(MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full --error-exitcode=1")
else()
message("Valgrind not found")
endif()
include(CTest)

add_subdirectory(benchmark)
add_subdirectory(doc)
add_subdirectory(example)
add_subdirectory(experimental)
add_subdirectory(test)


Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2013-2016 Louis Dionne
Copyright Louis Dionne 2013-2017

Boost Software License - Version 1.0 - August 17th, 2003

Expand Down
Loading

0 comments on commit cae3fb3

Please sign in to comment.