Skip to content

Commit cae3fb3

Browse files
committed
Merging develop into master for Hana version 1.1.0
2 parents 7a3e048 + 7f2a329 commit cae3fb3

File tree

1,652 files changed

+3846
-2280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,652 files changed

+3846
-2280
lines changed

.appveyor.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright Louis Dionne 2013-2016
1+
# Copyright Louis Dionne 2013-2017
22
# Distributed under the Boost Software License, Version 1.0.
33
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
44

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

.travis.yml

+32-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright Louis Dionne 2013-2016
1+
# Copyright Louis Dionne 2013-2017
22
# Distributed under the Boost Software License, Version 1.0.
33
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
44

@@ -42,6 +42,7 @@ cache:
4242
- ${TRAVIS_BUILD_DIR}/deps/boost-1.60.0
4343
- ${TRAVIS_BUILD_DIR}/deps/boost-1.61.0
4444
- ${TRAVIS_BUILD_DIR}/deps/boost-1.62.0
45+
- ${TRAVIS_BUILD_DIR}/deps/boost-1.63.0
4546

4647

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

6970
# Clang 3.6
7071
- os: linux
71-
env: UNIT_TESTS=true LLVM_VERSION=3.6.2 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
72+
env: UNIT_TESTS=true LLVM_VERSION=3.6.2 BOOST_VERSION=default ENABLE_MEMCHECK=true
7273
compiler: clang
7374

7475
# Clang 3.7
7576
- os: linux
76-
env: UNIT_TESTS=true LLVM_VERSION=3.7.1 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
77+
env: UNIT_TESTS=true LLVM_VERSION=3.7.1 BOOST_VERSION=default ENABLE_MEMCHECK=true
7778
compiler: clang
7879

7980
# Clang 3.8
8081
- os: linux
81-
env: UNIT_TESTS=true LLVM_VERSION=3.8.0 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
82+
env: UNIT_TESTS=true LLVM_VERSION=3.8.0 BOOST_VERSION=default ENABLE_MEMCHECK=true
8283
compiler: clang
8384

8485
# Clang 3.9
8586
- os: linux
86-
env: UNIT_TESTS=true LLVM_VERSION=3.9.0 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
87+
env: UNIT_TESTS=true LLVM_VERSION=3.9.0 BOOST_VERSION=default ENABLE_MEMCHECK=true
8788
compiler: clang
8889

8990
# GCC 6
9091
- os: linux
91-
env: UNIT_TESTS=true COMPILER=g++-6 BOOST_VERSION=default CMAKE_OPTIONS="-DBOOST_HANA_ENABLE_MEMCHECK=ON"
92+
env: UNIT_TESTS=true COMPILER=g++-6 BOOST_VERSION=default ENABLE_MEMCHECK=true
9293
compiler: gcc
9394

9495
# Xcode 6.4
@@ -144,6 +145,11 @@ matrix:
144145
env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=1.61.0
145146
compiler: clang
146147

148+
# With Boost 1.62
149+
- os: linux
150+
env: UNIT_TESTS=true LLVM_VERSION=default BOOST_VERSION=1.62.0
151+
compiler: clang
152+
147153
# Without Boost (make sure we don't depend on it)
148154
- os: linux
149155
env: UNIT_TESTS=true LLVM_VERSION=default
@@ -210,7 +216,7 @@ install:
210216
# Setup default versions and override compiler if needed
211217
############################################################################
212218
- if [[ "${LLVM_VERSION}" == "default" ]]; then LLVM_VERSION=3.9.0; fi
213-
- if [[ "${BOOST_VERSION}" == "default" ]]; then BOOST_VERSION=1.62.0; fi
219+
- if [[ "${BOOST_VERSION}" == "default" ]]; then BOOST_VERSION=1.63.0; fi
214220

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

@@ -237,16 +243,18 @@ install:
237243
fi
238244
239245
############################################################################
240-
# Install a recent CMake (unless already installed on OS X)
246+
# Install a recent CMake
241247
############################################################################
242248
- |
243249
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
244-
CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz"
250+
CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz"
245251
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
246252
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
247253
else
248-
if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi
254+
brew install cmake
255+
brew upgrade cmake
249256
fi
257+
- cmake --version
250258

251259
############################################################################
252260
# Install Boost.Build
@@ -284,6 +292,7 @@ install:
284292
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_DIR}/install/lib"
285293
export PATH="${LLVM_DIR}/clang/bin:${PATH}"
286294
fi
295+
- ${CXX} --version
287296

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

317327
############################################################################
318328
# Go back to the root of the project and setup the build directory
319329
############################################################################
320330
- cd ${TRAVIS_BUILD_DIR}
321-
- (mkdir build && cd build && cmake .. -DBOOST_HANA_ENABLE_WERROR=ON ${CMAKE_OPTIONS})
331+
- (mkdir build && cd build && cmake .. ${CMAKE_OPTIONS})
322332

323333

324334
script:
@@ -329,7 +339,7 @@ script:
329339
if [[ "${CHECK_FORMATTING}" == "true" ]]; then
330340
# Find non-ASCII characters in headers
331341
hpps=$(find include doc -name \*\.hpp)
332-
cpps=$(find test example experimental -name \*\.cpp)
342+
cpps=$(find test example -name \*\.cpp)
333343
pcregrep --color='auto' -n "[\x80-\xFF]" ${hpps} ${cpps}
334344
if [[ $? -ne 1 ]]; then exit 1; fi
335345
@@ -356,7 +366,7 @@ script:
356366
357367
pushd doc/html
358368
git add --all .
359-
git commit --allow-empty -m "Update to ${TRAVIS_COMMIT:0:7}"
369+
git commit --allow-empty -m "Update documentation to ${TRAVIS_COMMIT:0:7}"
360370
# Suppress output to avoid leaking the token
361371
travis_retry git push origin gh-pages &>/dev/null
362372
popd
@@ -367,6 +377,7 @@ script:
367377
if [[ "${DOCUMENTATION}" == "true" && "${BOOST_BUILD}" == "true" ]]; then
368378
touch Jamroot
369379
(cd doc && b2)
380+
if [[ ! -d doc/html ]]; then exit 1; fi
370381
fi
371382
372383
############################################################################
@@ -409,8 +420,12 @@ script:
409420
############################################################################
410421
- |
411422
if [[ "${UNIT_TESTS}" == "true" && "${BOOST_BUILD}" != "true" ]]; then
412-
export CTEST_PARALLEL_LEVEL=2 # Run unit tests on two cores
413-
(cd build && make check -j2 -k)
423+
(cd build && make tests examples -j2 -k) &&
424+
if [[ "${ENABLE_MEMCHECK}" == "true" ]]; then
425+
(cd build && ctest --output-on-failure -j2 -D ExperimentalMemCheck)
426+
else
427+
(cd build && ctest --output-on-failure -j2)
428+
fi
414429
fi
415430
416431
- |

CMakeLists.txt

+60-63
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Copyright Louis Dionne 2013-2016
1+
# Copyright Louis Dionne 2013-2017
22
# Distributed under the Boost Software License, Version 1.0.
33
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
44

5-
cmake_minimum_required(VERSION 3.1)
5+
cmake_minimum_required(VERSION 3.7)
66
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
77

88

@@ -33,12 +33,23 @@ include(CheckCxxCompilerSupport)
3333
add_library(hana INTERFACE)
3434
target_include_directories(hana INTERFACE include)
3535

36+
include(CheckCXXCompilerFlag)
37+
# On Clang for Windows, -std=c++14 is not known, but -std=c++1y appears to work.
38+
if (MSVC AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
39+
check_cxx_compiler_flag(-std=c++1y BOOST_HANA_HAS_STD_CPP1Y)
40+
if (BOOST_HANA_HAS_STD_CPP1Y)
41+
target_add_compile_options(hana INTERFACE -std=c++1y)
42+
endif()
43+
else()
44+
# TODO: Set these as interface properties when supported
45+
set(CMAKE_CXX_STANDARD 14)
46+
set(CMAKE_CXX_STANDARD_REQUIRED YES)
47+
endif()
48+
3649

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

@@ -53,55 +64,49 @@ option(BOOST_HANA_ENABLE_EXCEPTIONS
5364

5465

5566
##############################################################################
56-
# Setup compiler flags (more can be set on a per-target basis or in subdirectories)
67+
# Function to setup common compiler flags on tests and examples
5768
##############################################################################
58-
include(CheckCXXCompilerFlag)
59-
macro(boost_hana_append_flag testname flag)
60-
check_cxx_compiler_flag(${flag} ${testname})
61-
if (${testname})
62-
add_compile_options(${flag})
63-
endif()
64-
endmacro()
69+
function(boost_hana_set_test_properties target)
70+
target_link_libraries(${target} PRIVATE hana)
71+
set_target_properties(${target} PROPERTIES CXX_EXTENSIONS NO)
6572

66-
# Compiler flags controlled by CMake options above
67-
if (BOOST_HANA_ENABLE_WERROR)
68-
boost_hana_append_flag(BOOST_HANA_HAS_WERROR -Werror)
69-
boost_hana_append_flag(BOOST_HANA_HAS_WX -WX)
70-
endif()
73+
macro(setflag testname flag)
74+
check_cxx_compiler_flag(${flag} ${testname})
75+
if (${testname})
76+
target_compile_options(${target} PRIVATE ${flag})
77+
endif()
78+
endmacro()
7179

72-
if (NOT BOOST_HANA_ENABLE_CONCEPT_CHECKS)
73-
add_definitions(-DBOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS)
74-
endif()
80+
setflag(BOOST_HANA_HAS_FDIAGNOSTICS_COLOR -fdiagnostics-color)
81+
setflag(BOOST_HANA_HAS_FTEMPLATE_BACKTRACE_LIMIT -ftemplate-backtrace-limit=0)
82+
setflag(BOOST_HANA_HAS_PEDANTIC -pedantic)
83+
setflag(BOOST_HANA_HAS_WALL -Wall)
84+
setflag(BOOST_HANA_HAS_WERROR -Werror)
85+
setflag(BOOST_HANA_HAS_WEXTRA -Wextra)
86+
setflag(BOOST_HANA_HAS_WNO_UNUSED_LOCAL_TYPEDEFS -Wno-unused-local-typedefs)
87+
setflag(BOOST_HANA_HAS_WWRITE_STRINGS -Wwrite-strings)
7588

76-
if (BOOST_HANA_ENABLE_DEBUG_MODE)
77-
add_definitions(-DBOOST_HANA_CONFIG_ENABLE_DEBUG_MODE)
78-
endif()
89+
if (NOT BOOST_HANA_ENABLE_EXCEPTIONS)
90+
setflag(BOOST_HANA_HAS_FNO_EXCEPTIONS -fno-exceptions)
91+
endif()
7992

80-
if (BOOST_HANA_ENABLE_STRING_UDL)
81-
add_definitions(-DBOOST_HANA_CONFIG_ENABLE_STRING_UDL)
82-
# GCC pretends to have the flag, but produces a "unrecognized command line option"
83-
# warning when we use it.
84-
if (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
85-
boost_hana_append_flag(BOOST_HANA_HAS_WNO_GNU_STRING_UDL
86-
-Wno-gnu-string-literal-operator-template)
93+
if (NOT BOOST_HANA_ENABLE_CONCEPT_CHECKS)
94+
target_compile_definitions(${target} PRIVATE -DBOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS)
8795
endif()
88-
endif()
8996

90-
if (NOT BOOST_HANA_ENABLE_EXCEPTIONS)
91-
boost_hana_append_flag(BOOST_HANA_HAS_FNO_EXCEPTIONS -fno-exceptions)
92-
endif()
97+
if (BOOST_HANA_ENABLE_DEBUG_MODE)
98+
target_compile_definitions(${target} PRIVATE -DBOOST_HANA_CONFIG_ENABLE_DEBUG_MODE)
99+
endif()
93100

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

106111

107112
##############################################################################
@@ -143,22 +148,6 @@ function(boost_hana_target_name_for out file)
143148
set(${out} "${_name}" PARENT_SCOPE)
144149
endfunction()
145150

146-
# boost_hana_add_test(<name> <command> [<arg>...])
147-
#
148-
# Creates a test called `name`, which runs the given `command` with the given
149-
# `arg`uments. However, if `BOOST_HANA_ENABLE_MEMCHECK` is set to `ON`, the
150-
# test will run the provided command under the memory checker.
151-
if (BOOST_HANA_ENABLE_MEMCHECK)
152-
find_package(Valgrind REQUIRED)
153-
function(boost_hana_add_test name)
154-
add_test(${name} ${Valgrind_EXECUTABLE} --leak-check=full --error-exitcode=1 ${ARGN})
155-
endfunction()
156-
else()
157-
function(boost_hana_add_test name)
158-
add_test(${name} ${ARGN})
159-
endfunction()
160-
endif()
161-
162151

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

171160

172161
##############################################################################
173-
# Setup subdirectories
162+
# Setup subdirectories and testing
174163
##############################################################################
175164
enable_testing()
165+
find_program(MEMORYCHECK_COMMAND valgrind)
166+
if (MEMORYCHECK_COMMAND)
167+
message(STATUS "Found Valgrind: ${MEMORYCHECK_COMMAND}")
168+
set(MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full --error-exitcode=1")
169+
else()
170+
message("Valgrind not found")
171+
endif()
172+
include(CTest)
173+
176174
add_subdirectory(benchmark)
177175
add_subdirectory(doc)
178176
add_subdirectory(example)
179-
add_subdirectory(experimental)
180177
add_subdirectory(test)
181178

182179

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2013-2016 Louis Dionne
1+
Copyright Louis Dionne 2013-2017
22

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

0 commit comments

Comments
 (0)