Skip to content

Commit 15f6b5f

Browse files
authored
Merge pull request #66 from bluescarni/pr/iter
Iterative improvements
2 parents 686da9e + 4dceab7 commit 15f6b5f

File tree

9 files changed

+36
-63
lines changed

9 files changed

+36
-63
lines changed

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if(NOT CMAKE_BUILD_TYPE)
1212
FORCE)
1313
endif()
1414

15-
project(pygmo VERSION 2.17.0 LANGUAGES CXX C)
15+
project(pygmo VERSION 2.16.1 LANGUAGES CXX C)
1616

1717
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/yacma")
1818

@@ -172,6 +172,9 @@ endif()
172172

173173
# pybind11.
174174
find_package(pybind11 REQUIRED)
175+
if(${pybind11_VERSION} VERSION_LESS "2.6")
176+
message(FATAL_ERROR "pybind11 >= 2.6 is required, but version ${pybind11_VERSION} was found instead.")
177+
endif()
175178

176179
# Configure the sphinx config file.
177180
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/doc/conf.py.in" "${CMAKE_CURRENT_SOURCE_DIR}/doc/conf.py" @ONLY)

azure-pipelines.yml

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -123,26 +123,11 @@ jobs:
123123
pagmo-devel ^
124124
ninja ^
125125
clangdev ^
126+
pybind11 ^
126127
scipy
127128
conda list
128129
displayName: "Install conda packages"
129130
130-
# Install pybind11.
131-
- script: |
132-
setlocal EnableDelayedExpansion
133-
git clone https://github.com/pybind/pybind11.git
134-
cd pybind11
135-
mkdir build
136-
cd build
137-
cmake .. -G "Visual Studio 15 2017" -A x64 ^
138-
-DCMAKE_PREFIX_PATH=C:\tools\miniconda3\Library ^
139-
-DCMAKE_INSTALL_PREFIX=C:\tools\miniconda3\Library ^
140-
-DPYBIND11_TEST=NO
141-
cmake --build . --config Release --target install
142-
cd ..
143-
cd ..
144-
displayName: "Install pybind11"
145-
146131
- script: |
147132
cd tools
148133
Powershell.exe -File start_ip_cluster.ps1
@@ -290,26 +275,11 @@ jobs:
290275
pagmo-devel ^
291276
ninja ^
292277
clangdev ^
278+
pybind11 ^
293279
scipy
294280
conda list
295281
displayName: "Install conda packages"
296282
297-
# Install pybind11.
298-
- script: |
299-
setlocal EnableDelayedExpansion
300-
git clone https://github.com/pybind/pybind11.git
301-
cd pybind11
302-
mkdir build
303-
cd build
304-
cmake .. -G "Visual Studio 15 2017" -A x64 ^
305-
-DCMAKE_PREFIX_PATH=C:\tools\miniconda3\Library ^
306-
-DCMAKE_INSTALL_PREFIX=C:\tools\miniconda3\Library ^
307-
-DPYBIND11_TEST=NO
308-
cmake --build . --config Release --target install
309-
cd ..
310-
cd ..
311-
displayName: "Install pybind11"
312-
313283
- script: |
314284
cd tools
315285
Powershell.exe -File start_ip_cluster.ps1
@@ -457,26 +427,11 @@ jobs:
457427
pagmo-devel ^
458428
ninja ^
459429
clangdev ^
430+
pybind11 ^
460431
scipy
461432
conda list
462433
displayName: "Install conda packages"
463434
464-
# Install pybind11.
465-
- script: |
466-
setlocal EnableDelayedExpansion
467-
git clone https://github.com/pybind/pybind11.git
468-
cd pybind11
469-
mkdir build
470-
cd build
471-
cmake .. -G "Visual Studio 15 2017" -A x64 ^
472-
-DCMAKE_PREFIX_PATH=C:\tools\miniconda3\Library ^
473-
-DCMAKE_INSTALL_PREFIX=C:\tools\miniconda3\Library ^
474-
-DPYBIND11_TEST=NO
475-
cmake --build . --config Release --target install
476-
cd ..
477-
cd ..
478-
displayName: "Install pybind11"
479-
480435
- script: |
481436
cd tools
482437
Powershell.exe -File start_ip_cluster.ps1

doc/changelog.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@
33
Changelog
44
=========
55

6+
2.16.1 (unreleased)
7+
-------------------
8+
9+
Changes
10+
~~~~~~~
11+
12+
- pygmo now requires pybind11 >= 2.6 when compiling
13+
from source
14+
(`#66 <https://github.com/esa/pygmo2/pull/66>`__).
15+
16+
Fix
17+
~~~
18+
19+
- Various doc and build system fixes
20+
(`#66 <https://github.com/esa/pygmo2/pull/66>`__,
21+
`#60 <https://github.com/esa/pygmo2/pull/60>`__).
22+
23+
624
2.16.0 (2020-09-25)
725
-------------------
826

doc/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ In order to install pygmo from source, you will need:
123123
* a C++17 capable compiler (recent versions of GCC,
124124
Clang or MSVC should do),
125125
* a `Python <https://www.python.org/>`__ installation,
126-
* `pybind11 <https://github.com/pybind/pybind11>`__,
126+
* `pybind11 <https://github.com/pybind/pybind11>`__ (version >= 2.6),
127127
* the `pagmo C++ library <https://esa.github.io/pagmo2/>`__,
128128
* the `Boost libraries <https://www.boost.org/>`__,
129129
* `CMake <https://cmake.org/>`__, version 3.8 or later.

pygmo/CMakeLists.txt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ YACMA_PYTHON_MODULE(core
7878
)
7979

8080
target_link_libraries(core PRIVATE Pagmo::pagmo Boost::boost Boost::serialization)
81+
# NOTE: quench warnings from Boost when building the library.
82+
target_compile_definitions(core PRIVATE BOOST_ALLOW_DEPRECATED_HEADERS)
8183
target_include_directories(core SYSTEM PRIVATE "${pybind11_INCLUDE_DIR}")
8284
target_compile_definitions(core PRIVATE "${pybind11_DEFINITIONS}")
8385
target_compile_options(core PRIVATE
@@ -88,15 +90,10 @@ target_compile_options(core PRIVATE
8890
)
8991
set_target_properties(core PROPERTIES CXX_VISIBILITY_PRESET hidden)
9092
set_target_properties(core PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE)
91-
if(NOT CMAKE_CXX_STANDARD)
92-
# The user did not provide the CMAKE_CXX_STANDARD variable,
93-
# go with the default (C++17).
94-
message(STATUS "Setting the C++ standard version to the default value (17).")
95-
set_property(TARGET core PROPERTY CXX_STANDARD 17)
96-
else()
97-
message(STATUS "Using the manually-specified value for the C++ standard version (${CMAKE_CXX_STANDARD}).")
98-
endif()
99-
set_property(TARGET core PROPERTY CXX_STANDARD_REQUIRED YES)
93+
# Set the minimum C++ standard to C++17 when building
94+
# the core module.
95+
target_compile_features(core PRIVATE cxx_std_17)
96+
# Enforce vanilla C++ when compiling.
10097
set_property(TARGET core PROPERTY CXX_EXTENSIONS NO)
10198

10299
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.9.0")

pygmo/_r_policy_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class r(object):
143143
def replace(self, inds, nx, nix, nobj, nec, nic, tol, mig):
144144
return 1
145145
r_pol = r_policy(r())
146-
self.assertRaises(RuntimeError, lambda: r_pol.replace(([1, 2], [[.1, .2], [.3, .4]], [
146+
self.assertRaises(TypeError, lambda: r_pol.replace(([1, 2], [[.1, .2], [.3, .4]], [
147147
[1.1], [2.2]]), 2, 0, 1, 0, 0, [], ([], np.zeros((0, 2)), np.zeros((0, 2)))))
148148

149149
class r(object):

pygmo/_s_policy_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class r(object):
143143
def select(self, inds, nx, nix, nobj, nec, nic, tol):
144144
return 1
145145
s_pol = s_policy(r())
146-
self.assertRaises(RuntimeError, lambda: s_pol.select(([1, 2], [[.1, .2], [.3, .4]], [
146+
self.assertRaises(TypeError, lambda: s_pol.select(([1, 2], [[.1, .2], [.3, .4]], [
147147
[1.1], [2.2]]), 2, 0, 1, 0, 0, []))
148148

149149
class r(object):

pygmo/common_utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ inline Vector ndarr_to_vector(const py::array_t<T, ExtraFlags> &a)
140140
template <typename Array, typename T, typename Allocator>
141141
inline Array vector_to_ndarr(const std::vector<T, Allocator> &v)
142142
{
143-
return Array(v.size(), v.data());
143+
return Array(boost::numeric_cast<py::ssize_t>(v.size()), v.data());
144144
}
145145

146146
// Convert a numpy array into a sparsity pattern.

tools/docker_manylinux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -x
77
set -e
88

99
PAGMO_LATEST="2.16.0"
10-
PYBIND11_VERSION="2.5.0"
10+
PYBIND11_VERSION="2.6.1"
1111

1212
if [[ ${PYGMO_BUILD_TYPE} == *38* ]]; then
1313
PYTHON_DIR="cp38-cp38"

0 commit comments

Comments
 (0)