Skip to content

Commit e507494

Browse files
committed
Merge 'develop' into 'master' for Hana version 1.2.0
2 parents 9fc8598 + 8b1fbe3 commit e507494

Some content is hidden

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

70 files changed

+1715
-638
lines changed

.appveyor.yml

+4-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
shallow_clone: true
66

77
os:
8-
- Visual Studio 2015 Update 2
8+
- Visual Studio 2015
99

1010
build:
1111
verbosity: detailed
@@ -17,12 +17,6 @@ branches:
1717
except:
1818
- /pr\/.+/
1919

20-
environment:
21-
matrix:
22-
- TESTS_ONLY: true
23-
- EXAMPLES_ONLY: true
24-
25-
2620
install:
2721
############################################################################
2822
# All external dependencies are installed in C:\projects\deps
@@ -42,7 +36,7 @@ install:
4236
############################################################################
4337
# Install a recent CMake
4438
############################################################################
45-
- set CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-win64-x64.zip"
39+
- set CMAKE_URL="https://cmake.org/files/v3.8/cmake-3.8.0-win64-x64.zip"
4640
- appveyor DownloadFile %CMAKE_URL% -FileName cmake.zip
4741
- 7z x cmake.zip -oC:\projects\deps > nul
4842
- move C:\projects\deps\cmake-* C:\projects\deps\cmake # Move to a version-agnostic directory
@@ -64,6 +58,5 @@ before_build:
6458
build_script:
6559
- mkdir build
6660
- cd build
67-
- cmake .. -GNinja -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_CXX_FLAGS="-fms-compatibility-version=19"
68-
- if "%TESTS_ONLY%" == "true" (ninja tests && ctest -R --output-on-failure "test.+")
69-
- if "%EXAMPLES_ONLY%" == "true" (ninja examples && ctest -R --output-on-failure "example.+")
61+
- cmake .. -GNinja -DCMAKE_CXX_COMPILER=clang-cl
62+
- cmake --build . --target check

.travis.yml

+5-12
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ env:
1818
# ${GITHUB_TOKEN} environment variable.
1919
- secure: "gB1wvjk565j3O4UBGjyN44Vd8IGqcNHzkbvRdFNHp7C+C+JG2vhAeLlpiK0Zd483gdTjq9gPjIDwpwyG2UJ+yjT1kMTJvD1YNWpGcK6vOHYl1yMOwv/LBdnKn+J7i/FnoeULGRCCI2Fpp1qILhxeZgLxTxsdQaYXlAkkR0i8cgQ="
2020

21-
# Workaround for https://github.com/travis-ci/travis-ci/issues/4681
22-
matrix:
23-
- TRAVIS_EMPTY_JOB_WORKAROUND=true
24-
2521

2622
addons:
2723
apt:
@@ -46,9 +42,6 @@ cache:
4642

4743

4844
matrix:
49-
exclude:
50-
- env: TRAVIS_EMPTY_JOB_WORKAROUND=true
51-
5245
include:
5346
##########################################################################
5447
# Check for code formatting errors
@@ -229,15 +222,15 @@ install:
229222
if [[ -z "$(ls -A ${BOOST_DIR})" ]]; then
230223
if [[ "${BOOST_VERSION}" == "trunk" ]]; then
231224
BOOST_URL="http://github.com/boostorg/boost.git"
232-
travis_retry git clone --depth 1 --recursive --quiet ${BOOST_URL} ${BOOST_DIR} || exit 1
233-
(cd ${BOOST_DIR} && ./bootstrap.sh && ./b2 headers)
225+
travis_retry git clone --depth 1 --recursive ${BOOST_URL} ${BOOST_DIR} || exit 1
226+
(cd ${BOOST_DIR} && ./bootstrap.sh && ./b2 headers) || exit 1
234227
else
235228
BOOST_URL="http://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/boost_${BOOST_VERSION//\./_}.tar.gz"
236229
mkdir -p ${BOOST_DIR}
237-
{ travis_retry wget --quiet -O - ${BOOST_URL} | tar --strip-components=1 -xz -C ${BOOST_DIR}; } || exit 1
230+
{ travis_retry wget -O - ${BOOST_URL} | tar --strip-components=1 -xz -C ${BOOST_DIR}; } || exit 1
238231
fi
239232
# Make sure we don't conflict with the Hana shipped with Boost
240-
rm -rf ${BOOST_ROOT}/include/boost/{hana,hana.hpp}
233+
rm -rf ${BOOST_DIR}/include/boost/{hana,hana.hpp} || exit 1
241234
fi
242235
CMAKE_OPTIONS+=" -DBOOST_ROOT=${BOOST_DIR}"
243236
fi
@@ -247,7 +240,7 @@ install:
247240
############################################################################
248241
- |
249242
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
250-
CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz"
243+
CMAKE_URL="https://cmake.org/files/v3.8/cmake-3.8.0-Linux-x86_64.tar.gz"
251244
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
252245
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
253246
else

CMakeLists.txt

+27-40
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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.7)
5+
cmake_minimum_required(VERSION 3.8)
66
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
77

88

@@ -28,24 +28,28 @@ include(CheckCxxCompilerSupport)
2828

2929

3030
##############################################################################
31-
# Setup the 'hana' header-only library target.
31+
# Setup the 'hana' header-only library target, along with its install target
32+
# and exports.
3233
##############################################################################
3334
add_library(hana INTERFACE)
34-
target_include_directories(hana INTERFACE include)
35-
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)
35+
target_include_directories(hana INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
36+
$<INSTALL_INTERFACE:include>)
37+
# With Clang on Windows, the -std=c++14 flag is incorrectly set and the compiler
38+
# complains about the unkown option. TODO: Remove this workaround once the
39+
# underlying bug is fixed in CMake: https://gitlab.kitware.com/cmake/cmake/issues/17015
40+
if (NOT (MSVC AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
41+
target_compile_features(hana INTERFACE cxx_std_14)
4742
endif()
4843

44+
# Export the `hana` library into a HanaConfig.cmake file
45+
install(TARGETS hana EXPORT HanaConfig)
46+
install(EXPORT HanaConfig DESTINATION lib/cmake/hana)
47+
install(DIRECTORY include/boost DESTINATION include FILES_MATCHING PATTERN "*.hpp")
48+
49+
# Also install an optional pkg-config file
50+
configure_file(cmake/hana.pc.in hana.pc @ONLY)
51+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/hana.pc" DESTINATION lib/pkgconfig)
52+
4953

5054
##############################################################################
5155
# Setup CMake options
@@ -66,6 +70,7 @@ option(BOOST_HANA_ENABLE_EXCEPTIONS
6670
##############################################################################
6771
# Function to setup common compiler flags on tests and examples
6872
##############################################################################
73+
include(CheckCXXCompilerFlag)
6974
function(boost_hana_set_test_properties target)
7075
target_link_libraries(${target} PRIVATE hana)
7176
set_target_properties(${target} PROPERTIES CXX_EXTENSIONS NO)
@@ -110,17 +115,11 @@ endfunction()
110115

111116

112117
##############################################################################
113-
# Setup include paths. More include paths can be added in subdirectories.
118+
# Look for the rest of Boost, which is an optional dependency of some tests.
114119
##############################################################################
115-
include_directories(${Boost.Hana_SOURCE_DIR}/include)
116-
117120
find_package(Boost 1.59)
118-
if (Boost_FOUND)
119-
include_directories(${Boost_INCLUDE_DIRS})
120-
else()
121-
message(WARNING
122-
"The Boost library headers were not found; targets depending "
123-
"on Boost won't be available.")
121+
if (NOT Boost_FOUND)
122+
message(WARNING "The rest of Boost was not found; some tests and examples will be disabled.")
124123
endif()
125124

126125

@@ -142,9 +141,9 @@ function(boost_hana_target_name_for out file)
142141
set(_extension "${ARGV2}")
143142
endif()
144143

145-
file(RELATIVE_PATH _relative ${Boost.Hana_SOURCE_DIR} ${file})
146-
string(REPLACE "${_extension}" "" _name ${_relative})
147-
string(REGEX REPLACE "/" "." _name ${_name})
144+
file(RELATIVE_PATH _relative "${Boost.Hana_SOURCE_DIR}" "${file}")
145+
string(REPLACE "${_extension}" "" _name "${_relative}")
146+
string(REGEX REPLACE "/" "." _name "${_name}")
148147
set(${out} "${_name}" PARENT_SCOPE)
149148
endfunction()
150149

@@ -154,7 +153,7 @@ endfunction()
154153
##############################################################################
155154
add_custom_target(check
156155
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
157-
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
156+
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
158157
COMMENT "Build and then run all the tests and examples.")
159158

160159

@@ -175,15 +174,3 @@ add_subdirectory(benchmark)
175174
add_subdirectory(doc)
176175
add_subdirectory(example)
177176
add_subdirectory(test)
178-
179-
180-
##############################################################################
181-
# Setup the 'install' target.
182-
# This copies the whole content of include/ to ${CMAKE_INSTALL_PREFIX}.
183-
##############################################################################
184-
install(DIRECTORY include/boost DESTINATION include
185-
PATTERN ".DS_Store" EXCLUDE)
186-
187-
# We also install an optional pkg-config file.
188-
configure_file(cmake/hana.pc.in hana.pc @ONLY)
189-
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/hana.pc DESTINATION lib/pkgconfig)

README.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,18 @@ Please see [LICENSE.md](LICENSE.md).
173173
## Releasing
174174
This section acts as a reminder of the few simple steps required to release a
175175
new version of the library. This is only relevant to Hana's developers. To
176-
release a new version of the library, create an annotated tag using `git tag -a`.
176+
release a new version of the library, make sure the current version in
177+
`include/boost/hana/version.hpp` matches the release you're about to publish.
178+
Then, create an annotated tag with:
179+
```sh
180+
git tag -a --file=- v<version> <<EOM
181+
...your message here...
182+
EOM
183+
```
184+
177185
Then, push the tag and create a new GitHub release pointing to that tag.
178186
Once that is done, bump the version number in `include/boost/hana/version.hpp`
179-
so that it matches the next planned release. Finally, do not forget to update
187+
so that it matches the next _planned_ release. Finally, do not forget to update
180188
the [Homebrew formula][] to point to the latest version.
181189
182190

benchmark/CMakeLists.txt

+11-8
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,20 @@ file(GLOB_RECURSE BOOST_HANA_BENCHMARKS *.erb.json)
5151
foreach(benchmark IN LISTS BOOST_HANA_BENCHMARKS)
5252
boost_hana_target_name_for(target ${benchmark} ".erb.json")
5353
get_filename_component(directory "${benchmark}" DIRECTORY)
54-
file(GLOB cpp_files ${directory}/*.erb.cpp)
54+
file(GLOB cpp_files "${directory}/*.erb.cpp")
5555
configure_file("${benchmark}" "${CMAKE_CURRENT_BINARY_DIR}/${target}.erb.json" @ONLY)
5656

57-
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${target}.measure.cpp "")
58-
add_executable(${target}.measure EXCLUDE_FROM_ALL ${CMAKE_CURRENT_BINARY_DIR}/${target}.measure.cpp)
59-
target_include_directories(${target}.measure PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
57+
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${target}.measure.cpp" "")
58+
add_executable(${target}.measure EXCLUDE_FROM_ALL "${CMAKE_CURRENT_BINARY_DIR}/${target}.measure.cpp")
59+
target_include_directories(${target}.measure PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
6060
if (MPL11_FOUND)
61-
target_include_directories(${target}.measure PRIVATE ${MPL11_INCLUDE_DIR})
61+
target_include_directories(${target}.measure PRIVATE "${MPL11_INCLUDE_DIR}")
6262
endif()
6363
if (Meta_FOUND)
64-
target_include_directories(${target}.measure PRIVATE ${Meta_INCLUDE_DIR})
64+
target_include_directories(${target}.measure PRIVATE "${Meta_INCLUDE_DIR}")
65+
endif()
66+
if (Boost_FOUND)
67+
target_link_libraries(${target}.measure PRIVATE Boost::boost)
6568
endif()
6669
boost_hana_set_test_properties(${target}.measure)
6770
if (BOOST_HANA_HAS_FTEMPLATE_DEPTH)
@@ -72,13 +75,13 @@ foreach(benchmark IN LISTS BOOST_HANA_BENCHMARKS)
7275
add_custom_target(${target}.measure.run COMMAND ${target}.measure)
7376

7477
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${target}.json"
75-
COMMAND ${RUBY_EXECUTABLE} -r tilt -r ${CMAKE_CURRENT_BINARY_DIR}/measure.rb
78+
COMMAND ${RUBY_EXECUTABLE} -r tilt -r "${CMAKE_CURRENT_BINARY_DIR}/measure.rb"
7679
-e "MEASURE_FILE = '${CMAKE_CURRENT_BINARY_DIR}/${target}.measure.cpp'"
7780
-e "MEASURE_TARGET = '${target}.measure'"
7881
-e "json = Tilt::ERBTemplate.new('${CMAKE_CURRENT_BINARY_DIR}/${target}.erb.json').render"
7982
-e "File.open('${CMAKE_CURRENT_BINARY_DIR}/${target}.json', 'w') { |f| f.write(json) } "
8083
WORKING_DIRECTORY ${directory}
81-
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${target}.erb.json ${cpp_files}
84+
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${target}.erb.json" ${cpp_files}
8285
VERBATIM USES_TERMINAL
8386
COMMENT "Generating dataset for ${target}"
8487
)

0 commit comments

Comments
 (0)