Ralf W. Grosse-Kunstleve
723307283e
feat: remove Python 3.7 support ( #5191 )
...
* First pass updating misc files, informed by https://github.com/pybind/pybind11/pull/5177/commits
* Remove jobs using silkeh/clang and gcc docker containers that come with Python 3.7
* Add silkeh/clang:17-bookworm
* Add job using GCC 7
* Revert "Add job using GCC 7"
This reverts commit 518515a761
.
* Try running in ubuntu-18.04 container under ubuntu-latest (to get GCC 7)
* Fix `-` vs `:` mixup.
* This reverts commit b1c4304475
.
Revert "Try running in ubuntu:18.04 container under ubuntu-latest (to get GCC 7)"
This reverts commit b203a294bb
.
* `git grep 0x03080000` cleanup.
* `git grep -I -E '3\.7'` cleanup.
Removes two changes made under pybind/pybind11#3702
* Revert "`git grep -I -E '3\.7'` cleanup."
This reverts commit bb5b9d187b
.
* Remove comments that are evidently incorrect:
```
...
-- The CXX compiler identification is Clang 15.0.7
...
- Found Python: /usr/bin/python3.9 (found suitable version "3.9.2", minimum required is "3.7") found components: Interpreter Development.Module Development.Embed
...
/__w/pybind11/pybind11/include/pybind11/gil.h:150:13: error: 'auto key' can be declared as 'auto *key' [readability-qualified-auto,-warnings-as-errors]
auto key = internals.tstate;
^~~~~
auto *
/__w/pybind11/pybind11/include/pybind11/gil.h:174:13: error: 'auto key' can be declared as 'auto *key' [readability-qualified-auto,-warnings-as-errors]
auto key = detail::get_internals().tstate;
^~~~~
auto *
```
* .github/workflows/configure.yml: Change from Python 3.7 to 3.8
* Misc cleanup pass
* Miscellaneous changes based on manual review of the `git grep` matches below:
```
git_grep_37_38.sh |& sort | uniq -c
```
With git_grep_37_38.sh:
```
set -x
git grep 0x0307
git grep 0x0308
git grep PY_MINOR_VERSION
git grep PYPY_VERSION
git grep -I -E '3\.7'
git grep -I -E '3\.8'
git grep -I -E '\(3, 7'
git grep -I -E '\(3, 8'
git grep -I -E '3[^A-Za-z0-9.]+7'
git grep -I -E '3[^A-Za-z0-9.]+8'
```
Output:
```
1 .appveyor.yml: $env:CMAKE_INCLUDE_PATH = "eigen-3.3.7;$env:CMAKE_INCLUDE_PATH"
1 .appveyor.yml: 7z x eigen-3.3.7.zip -y > $null
1 .appveyor.yml: Start-FileDownload 'https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip '
1 CMakeLists.txt: # Bug in macOS CMake < 3.7 is unable to download catch
1 CMakeLists.txt: elseif(WINDOWS AND CMAKE_VERSION VERSION_LESS 3.8)
1 CMakeLists.txt: if(OSX AND CMAKE_VERSION VERSION_LESS 3.7)
1 CMakeLists.txt: message(WARNING "CMAKE 3.7+ needed on macOS to download catch, and newer HIGHLY recommended")
1 CMakeLists.txt: message(WARNING "CMAKE 3.8+ tested on Windows, previous versions untested")
1 CMakeLists.txt: # Only tested with 3.8+ in CI.
1 docs/advanced/functions.rst:Python 3.8 introduced a new positional-only argument syntax, using ``/`` in the
1 docs/changelog.rst:* Adapt pybind11 to a C API convention change in Python 3.8. `#1950
1 docs/changelog.rst:* Allow thread termination to be avoided during shutdown for CPython 3.7+ via
1 docs/changelog.rst: considered as conversion, consistent with Python 3.8+.
1 docs/changelog.rst: CPython 3.8 and 3.9 debug builds.
1 docs/changelog.rst:* Enum now has an ``__index__`` method on Python <3.8 too.
1 docs/changelog.rst: on Python 3.8. `#1780 <https://github.com/pybind/pybind11/pull/1780 >`_.
1 docs/changelog.rst:* PyPy 3.10 support was added, PyPy 3.7 support was dropped.
2 docs/changelog.rst:* Support PyPy 7.3.7 and the PyPy3.8 beta. Test python-3.11 on PRs with the
1 docs/changelog.rst:* Use ``macos-13`` (Intel) for CI jobs for now (will drop Python 3.7 soon).
1 docs/changelog.rst:* Use new Python 3.7 Thread Specific Storage (TSS) implementation if available.
1 docs/compiling.rst: cmake -DPYBIND11_PYTHON_VERSION=3.8 ..
1 docs/compiling.rst: find_package(Python 3.8 COMPONENTS Interpreter Development REQUIRED)
1 docs/limitations.rst:- PyPy3 7.3.1 and 7.3.2 have issues with several tests on 32-bit Windows.
1 docs/requirements.txt:idna==3.7 \
1 + git grep 0x0307
1 + git grep 0x0308
1 + git grep -I -E '\(3, 7'
1 + git grep -I -E '3\.7'
1 + git grep -I -E '\(3, 8'
1 + git grep -I -E '3\.8'
1 + git grep -I -E '3[^A-Za-z0-9.]+7'
1 + git grep -I -E '3[^A-Za-z0-9.]+8'
1 + git grep PY_MINOR_VERSION
1 + git grep PYPY_VERSION
2 .github/workflows/ci.yml: - '3.8'
1 .github/workflows/ci.yml: - 3.8
1 .github/workflows/ci.yml: - name: Add Python 3.8
1 .github/workflows/ci.yml: - 'pypy-3.8'
2 .github/workflows/ci.yml: python: '3.8'
1 .github/workflows/ci.yml: - python: '3.8'
1 .github/workflows/ci.yml: - python: 3.8
1 .github/workflows/ci.yml: python: 'pypy-3.8'
1 .github/workflows/configure.yml: cmake: "3.8"
1 .github/workflows/configure.yml: name: 🐍 3.8 • CMake ${{ matrix.cmake }} • ${{ matrix.runs-on }}
1 .github/workflows/configure.yml: - name: Setup Python 3.8
1 .github/workflows/configure.yml: python-version: 3.8
1 .github/workflows/pip.yml: name: 🐍 3.8 • 📦 & 📦 tests • ubuntu-latest
1 .github/workflows/pip.yml: name: 🐍 3.8 • 📦 tests • windows-latest
2 .github/workflows/pip.yml: - name: Setup 🐍 3.8
2 .github/workflows/pip.yml: python-version: 3.8
2 include/pybind11/cast.h:#if !defined(PYPY_VERSION)
2 include/pybind11/cast.h:#if defined(PYPY_VERSION)
2 include/pybind11/cast.h: // PyPy: 7.3.7's 3.8 does not implement PyLong_*'s __index__ calls.
5 include/pybind11/detail/class.h:#if !defined(PYPY_VERSION)
1 include/pybind11/detail/class.h:#if defined(PYPY_VERSION)
1 include/pybind11/detail/class.h: // This was not needed before Python 3.8 (Python issue 35810)
1 include/pybind11/detail/common.h: && !defined(PYPY_VERSION) && !defined(PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF)
2 include/pybind11/detail/common.h:# error "PYTHON < 3.8 IS UNSUPPORTED. pybind11 v2.13 was the last to support Python 3.7."
1 include/pybind11/detail/common.h:#if defined(PYPY_VERSION) && !defined(PYBIND11_SIMPLE_GIL_MANAGEMENT)
1 include/pybind11/detail/common.h:#if PY_VERSION_HEX < 0x03080000
1 include/pybind11/detail/common.h: = PYBIND11_TOSTRING(PY_MAJOR_VERSION) "." PYBIND11_TOSTRING(PY_MINOR_VERSION); \
1 include/pybind11/detail/internals.h: // called. PYBIND11_TLS_FREE is PyThread_tss_free on python 3.7+. On older python, it does
1 include/pybind11/detail/internals.h:#if PYBIND11_INTERNALS_VERSION <= 4 || defined(PYPY_VERSION)
1 include/pybind11/detail/internals.h:// The old Python Thread Local Storage (TLS) API is deprecated in Python 3.7 in favor of the new
1 include/pybind11/detail/type_caster_base.h:#if defined(PYPY_VERSION)
1 include/pybind11/embed.h:# define PYBIND11_PYCONFIG_SUPPORT_PY_VERSION_HEX (0x03080000)
1 include/pybind11/embed.h:#if defined(PYPY_VERSION)
1 include/pybind11/eval.h: // globals if not yet present. Python 3.8 made PyRun_String behave
2 include/pybind11/eval.h:#if defined(PYPY_VERSION)
2 include/pybind11/eval.h: // was missing from PyPy3.8 7.3.7.
2 include/pybind11/gil.h: /// allowed during shutdown. Check _Py_IsFinalizing() on Python 3.7+, and
1 include/pybind11/pybind11.h:#if !defined(PYPY_VERSION)
4 include/pybind11/pybind11.h:#if !defined(PYPY_VERSION) && PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 9
1 include/pybind11/pytypes.h:#endif //! defined(PYPY_VERSION)
2 include/pybind11/pytypes.h:#if !defined(PYPY_VERSION)
1 include/pybind11/pytypes.h:# if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x07030a00
1 include/pybind11/pytypes.h:#ifdef PYPY_VERSION
1 include/pybind11/stl/filesystem.h:# if !defined(PYPY_VERSION)
2 pybind11/__init__.py:if sys.version_info < (3, 8):
2 pybind11/__init__.py: msg = "pybind11 does not support Python < 3.8. v2.13 was the last release supporting Python 3.7."
1 pyproject.toml:master.py-version = "3.8"
1 pyproject.toml:python_version = "3.8"
1 README.rst:lines of code and depend on Python (3.8+, or PyPy) and the C++
2 README.rst:- Python 3.8+, and PyPy3 7.3 are supported with an implementation-agnostic
1 setup.cfg: Programming Language :: Python :: 3.8
1 setup.cfg:python_requires = >=3.8
1 setup.py:# TODO: use literals & overload (typing extensions or Python 3.8)
1 tests/CMakeLists.txt:if(NOT CMAKE_VERSION VERSION_LESS 3.8)
2 tests/constructor_stats.h:#if defined(PYPY_VERSION)
1 tests/env.py: doesn't work on CPython 3.8.0 with pytest==3.3.2 on Ubuntu 18.04 (#2922 ).
1 tests/requirements.txt:build~=1.0; python_version>="3.8"
1 tests/requirements.txt:numpy~=1.21.5; platform_python_implementation!="PyPy" and python_version>="3.8" and python_version<"3.10"
1 tests/requirements.txt:numpy~=1.23.0; python_version=="3.8" and platform_python_implementation=="PyPy"
1 tests/test_buffers.py: env.PYPY, reason="PyPy 7.3.7 doesn't clear this anymore", strict=False
1 tests/test_builtin_casters.py: # Before Python 3.8, `PyLong_AsLong` does not pick up on `obj.__index__`,
2 tests/test_builtin_casters.py: if (3, 8) <= sys.version_info < (3, 10) and env.CPYTHON:
4 tests/test_builtin_casters.py: # TODO: PyPy 3.8 does not behave like CPython 3.8 here yet (7.3.7)
1 tests/test_callbacks.py: assert m.test_callback3(z.double) == "func(43) = 86"
2 tests/test_call_policies.cpp:#if !defined(PYPY_VERSION)
1 tests/test_chrono.py: diff = m.test_chrono_float_diff(43.789012, 1.123456)
1 tests/test_constants_and_functions.py: assert m.f3(86) == 89
1 tests/test_eigen_matrix.py: a_copy3[8, 1] = 11
1 tests/test_eigen_matrix.py: assert np.all(cornersc == np.array([[1.0, 3], [7, 9]]))
1 tests/test_eigen_matrix.py: assert np.all(cornersr == np.array([[1.0, 3], [7, 9]]))
1 tests/test_eigen_matrix.py: mymat = chol(np.array([[1.0, 2, 4], [2, 13, 23], [4, 23, 77]]))
1 tests/test_exceptions.py: if hasattr(pytest, unraisable): # Python >= 3.8 and pytest >= 6
2 tests/test_exceptions.py:@pytest.mark.xfail(env.PYPY, reason="Failure on PyPy 3.8 (7.3.7)", strict=False)
1 tests/test_factory_constructors.py: assert [i.alive() for i in cstats] == [13, 7]
1 tests/test_kwargs_and_defaults.cpp:#ifdef PYPY_VERSION
1 tests/test_local_bindings.py: assert i1.get3() == 8
1 tests/test_methods_and_attributes.cpp:#if !defined(PYPY_VERSION)
1 tests/test_numpy_array.py: a = np.arange(3 * 7 * 2) + 1
1 tests/test_numpy_array.py: assert str(excinfo.value) == "cannot reshape array of size 42 into shape (3,7,1)"
2 tests/test_numpy_array.py: assert x.shape == (3, 7, 2)
2 tests/test_numpy_array.py: m.reshape_tuple(a, (3, 7, 1))
2 tests/test_numpy_array.py: x = m.reshape_tuple(a, (3, 7, 2))
1 tests/test_numpy_vectorize.py: assert np.isclose(m.vectorized_func3(np.array(3 + 7j)), [6 + 14j])
1 tests/test_pickling.cpp:#if !defined(PYPY_VERSION)
1 tests/test_pytypes.cpp:#if (defined(__APPLE__) && defined(__clang__)) || defined(PYPY_VERSION)
1 tests/test_smart_ptr.cpp: m.def("make_myobject3_1", []() { return new MyObject3(8); });
1 tests/test_smart_ptr.py: assert cstats.values() == ["MyObject3[9]", "MyObject3[8]", "MyObject3[9]"]
1 tests/test_stl_binders.py: assert v_int2 == m.VectorInt([0, 99, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 88])
1 tests/test_stl_binders.py: assert v_int2 == m.VectorInt([0, 99, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 88, 4])
1 tests/test_type_caster_pyobject_ptr.cpp:#if !defined(PYPY_VERSION) // It is not worth the trouble doing something special for PyPy.
1 tools/FindPythonLibsNew.cmake: set(PythonLibsNew_FIND_VERSION "3.8")
1 tools/JoinPaths.cmake:# https://docs.python.org/3.7/library/os.path.html#os.path.join
1 tools/pybind11NewTools.cmake: Python 3.8 REQUIRED COMPONENTS ${_pybind11_interp_component} ${_pybind11_dev_component}
1 tools/pybind11NewTools.cmake:# Python debug libraries expose slightly different objects before 3.8
1 tools/pybind11Tools.cmake: "3.12;3.11;3.10;3.9;3.8"
1 tools/pybind11Tools.cmake: if(NOT DEFINED PYPY_VERSION)
1 tools/pybind11Tools.cmake: message(STATUS "PYPY ${PYPY_VERSION} (Py ${PYTHON_VERSION})")
1 tools/pybind11Tools.cmake:# Python debug libraries expose slightly different objects before 3.8
1 tools/pybind11Tools.cmake: set(PYPY_VERSION
```
* Change `[tool.ruff]` `target-version` to `"py38"`, as suggested by @Skylion007
2024-07-30 09:18:35 -07:00
Ralf W. Grosse-Kunstleve
f1a2e03d19
feat: remove Python 3.6 support ( #5177 )
...
* Change Python version guard: PYTHON < 3.7 IS UNSUPPORTED.
* Replace or remove Python 3.6 jobs.
* Move appveyor to Python 3.8
* Change `[tool.pylint]` `master.py-version` from `3.6` to `3.8`
* Change `[tool.pylint]` `master.py-version` to `3.7`
* Remove `centos:7` job; Change almalinux:8 job to use Python 3.8
* Try 🐍 3.8 • ubuntu-20.04 • x64 without `-DCMAKE_CXX_FLAGS="-D_=1"`
* Update setup.cfg as suggested by @henryiii
* Try running `cmake --build . --target cpptest` on all platforms (`standard` job).
* Disable deadsnakes jobs entirely.
* Apply PR #5179 : Add Python 3.10, 3.11, 3.12 to win32 job matrix.
* Add back `-DCMAKE_CXX_FLAGS="-D_=1"` but do not install boost in that case.
* PY_VERSION_HEX < 3.7 cleanup pass: include/pybind11
* WITH_THREAD cleanup pass: include/pybind11
* Undo incorrect change.
* Revert "Disable deadsnakes jobs entirely."
This reverts commit bbcd0087b2
.
* WITH_THREAD cleanup pass: tests/
* Change Python version guard in pybind11/__init__.py: pybind11 does not support Python < 3.7.
* Misc cleanup pass
* chore: use future imports
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* Update tests/test_numpy_array.py
* Update test_numpy_array.py
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-06-22 00:55:00 -04:00
Axel Huebl
76b7f53649
Python_ADDITIONAL_VERSIONS: 3.12 ( #4909 )
...
Add 3.12 to the default `Python_ADDITIONAL_VERSIONS`.
2023-10-31 22:56:16 -04:00
László Papp
5891867ee4
fix(cmake): support DEBUG_POSTFIX correctly ( #4761 )
...
* cmake: split extension
Into suffix and debug postfix. Pybind11 is currently treating both as
suffix, which is problematic when something else defines the
DEBUG_POSTFIX because they will be concatenated.
pybind11_extension sets SUFFIX to _d.something and if DEBUG_POSTFIX is
set to _d.
_d + _d.something = _d_d.something
The issue has been reported at:
https://github.com/pybind/pybind11/issues/4699
* style: pre-commit fixes
* fix(cmake): support postfix for old FindPythonInterp mode too
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2023-09-15 18:05:43 -04:00
Pieter P
4bf60c609a
Disable strip when build type is unset ( #4454 ) ( #4780 )
2023-08-07 20:58:30 -07:00
gitartpiano
88b019a8a5
fix pybind11Tools.cmake typo causing Unknown arguments ( #4327 )
...
* fix pybind11Tools.cmake typo causing Unknown arguments
CMake Error at pybind11/tools/pybind11Tools.cmake:217 (if):
if given arguments:
"NOT" "MSVC" "AND" "NOT" "TEST" "MATCHES" "DEBUG|RELWITHDEBINFO"
Unknown arguments specified
https://github.com/pybind/pybind11/issues/4325
* Apply the same fix in tools/pybind11NewTools.cmake
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2022-11-11 17:52:57 -08:00
Henry Schreiner
bbb89da152
fix(cmake): support vcpkg, try 2 ( #4123 )
...
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-08-09 00:03:36 -04:00
Daniel Dinu
8a4bca8216
fix(cmake): use case-insensitive CMAKE_BUILD_TYPE comparisons ( #4078 )
2022-08-08 10:01:39 -04:00
Henry Schreiner
1e4bd22bdc
fix(cmake): support release and debug at the same time ( #3948 )
2022-05-18 23:19:33 -04:00
Henry Schreiner
522c59ceb2
chore: drop Python 3.5 ( #3719 )
...
* chore: drop Python 3.5 support
* chore: more fstrings with flynt's help
* ci: drop Python 3.5
* chore: bump dependency versions
* docs: touch up py::args
* tests: remove deprecation warning
* Ban smartquotes
* Very minor tweaks (by-product of reviewing PR #3719 ).
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2022-02-11 19:06:16 -05:00
Ralf W. Grosse-Kunstleve
6493f496e3
Python 2 removal part 1: tests (C++ code is intentionally ~untouched) ( #3688 )
...
* `#error BYE_BYE_GOLDEN_SNAKE`
* Removing everything related to 2.7 from ci.yml
* Commenting-out Centos7
* Removing `PYTHON: 27` from .appveyor.yml
* "PY2" removal, mainly from tests. C++ code is not touched.
* Systematic removal of `u` prefix from `u"..."` and `u'...'` literals. Collateral cleanup of a couple minor other things.
* Cleaning up around case-insensitive hits for `[^a-z]py.*2` in tests/.
* Removing obsolete Python 2 mention in compiling.rst
* Proper `#error` for Python 2.
* Using PY_VERSION_HEX to guard `#error "PYTHON 2 IS NO LONGER SUPPORTED.`
* chore: bump pre-commit
* style: run pre-commit for pyupgrade 3+
* tests: use sys.version_info, not PY
* chore: more Python 2 removal
* Uncommenting Centos7 block (PR #3691 showed that it is working again).
* Update pre-commit hooks
* Fix pre-commit hook
* refactor: remove Python 2 from CMake
* refactor: remove Python 2 from setup code
* refactor: simplify, better static typing
* feat: fail with nice messages
* refactor: drop Python 2 C++ code
* docs: cleanup for Python 3
* revert: intree
revert: intree
* docs: minor touchup to py2 statement
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
2022-02-10 18:28:08 -08:00
Henry Schreiner
90707b46f2
fix(build): support conan's multiple includes of all files ( #3420 )
2021-10-27 15:06:02 -04:00
Henry Schreiner
e7e2c79f3f
fix: improve support for Python 3.11-dev ( #3368 )
...
* ci: support Python 3.11-dev
Also update 3.10 to final, better PyPy usage
* fix: use PyFrame_GetCode on Python 3.9+
* ci: some bitiness of pypy not supported on win
* chore: update CMake support to 3.22rc1 to quiet warning
* fix: use dev version of py to fix Py 3.11
* tests: print proper Eigen version
* ci: include pypy2, not sure why
* ci: avoid running on Python 3.11 for now
* ci: fix runs
* ci: simpler PyPy usage, drop unmaintained scipy + pypy index
* ci: only binary numpy, wait on pypy 3.8
* refactor: address review
2021-10-26 14:50:34 -04:00
Henry Schreiner
6ad3f874a7
fix(build): avoid a possible warning about shadowed variables and changing behaviors ( #3220 )
2021-09-23 15:42:16 -04:00
Henry Schreiner
eb83feefff
style: avoid using unintialized variables ( #2806 )
...
* style: avoid using unintialized variables
Tested with cmake --warn-unintialized -S . -B build
* refactor: use function for possibly uninit vars
2021-01-19 18:48:22 -05:00
Henry Schreiner
230fa53f16
fix: Don't override global settings for VISIBILITY if set ( #2793 )
...
Sometimes programmers want to control this, and while it can be changed after the fact, it's commonly set via a CMAKE_ variable; if that variable is set, we should respect that (like the CMAKE_INTERPROCEDURAL_OPTIMIZATION setting).
2021-01-14 08:31:48 -05:00
Yannick Jadoul
f243450e89
ci: disable builds for 3.10.0a4, and enable a nightly 3.10-dev build ( #2792 )
...
* Disable builds for 3.10.0a4, and enable a nightly 3.10-dev build
* Fix job name
* Remove deadsnakes job for now
* Add deadsnakes jobs
* There's no deadsnakes 2.7
* Add 3.10 to versions to be discovered by legacy FindPython, and fix debug input to deadsnakes/action
* Try out branch with fix
* Update to deadsnakes/action@v2.1.1
2021-01-13 23:13:19 -05:00
Henry Schreiner
ffb113d1d8
fix: regression with installed pybind11 overriding local one ( #2716 )
...
* fix: regression with installed pybind11 overriding discovered one
Closes #2709
* docs: wording incorrect
2020-12-15 21:55:14 -05:00
Henry Schreiner
b8dc60ec8f
fix: Python include directory was missing from DIRS ( #2636 )
2020-11-02 20:45:54 -05:00
Henry Schreiner
a42211536b
fix: new line in PYPY_VERSION
2020-10-15 17:38:49 -04:00
Henry Schreiner
2a2f52201d
fix: find_import didn't work properly for classic tools ( #2550 )
...
* fix: find_import didn't work properly for classic tools
* ci: fix all files not being checked in style run
2020-10-05 15:31:00 -04:00
Henry Schreiner
3488494a81
refactor: import check as a common function ( #2526 )
...
* feat: import check as a common function
* docs: add cmake to docs
2020-10-02 22:34:22 -04:00
Wenzel Jakob
36c666f027
pybind11_add_module(): OPT_SIZE target
2020-09-06 16:46:38 +02:00
Henry Schreiner
9b8cb02030
fix: respect PYTHON_VERSION if set in classic mode ( #2414 )
...
* fix: respect PYTHON_VERSION if set in classic mode
* fix: add warning when using PYTHON_VERSION
2020-08-26 09:07:30 -04:00
Bjorn
d4d7ef5d27
Update pybind11Tools.cmake ( #2419 )
...
CPython configured with `--with-pydebug` could not use `pybind11_add_module`
2020-08-21 14:52:38 -04:00
Henry Schreiner
1729aae96f
feat: new FindPython support ( #2370 )
...
* feat: FindPython support
* refactor: rename to PYBIND11_FINDPYTHON
* docs: Caps fixes
* feat: NOPYTHON mode
* test: check simple call
* docs: add changelog/upgrade guide
* feat: Support Python3 and Python2
* refactor: Use targets in tests
* fix: support CMake 3.4+
* feat: classic search also finds virtual environments
* docs: some updates from @wjakob's review
* fix: wrong name for QUIET mode variable, reported by @skoslowski
* refactor: cleaner output messaging
* fix: support debug Python's in FindPython mode too
* fixup! refactor: cleaner output messaging
* fix: missing pybind11_FOUND and pybind11_INCLUDE_DIR restored to subdir mode
* fix: nicer reporting of Python / PyPy
* fix: out-of-order variable fix
* docs: minor last-minute cleanup
2020-08-19 12:26:26 -04:00
Henry Schreiner
0af7fe6c19
fix: typo in pybind11_add_module ( #2374 )
2020-08-08 17:34:38 -04:00
Henry Schreiner
227170dc2f
fix: better handling of PYBIND11_CPP_STANDARD
2020-08-06 11:54:41 -04:00
Henry Schreiner
df115977df
chore: cleanup
2020-08-06 11:54:41 -04:00
Henry Schreiner
94db5c5ed1
format: apply cmake-format
2020-07-30 20:27:55 -04:00
Henry Schreiner
1b92cd1703
fix: address review points from @YannickJadoul
2020-07-30 20:27:55 -04:00
Henry Schreiner
6ec1775fff
feat: drop CMake 3.6 and below, modernize CMake
...
fix: include PYTHON_IS_DEBUG
2020-07-30 20:27:55 -04:00
Henry Schreiner
1f53c373e4
fix: C++17 mode on Clang may error
2020-07-26 09:25:27 -04:00
Nils Leif Fischer
141e8cc0af
Fix uninitialized-variables cmake warnings
2020-07-01 00:19:25 +02:00
Chuck Atkins
d730fbc0d5
Utilize CMake's language standards abstraction when possible
2020-04-26 09:17:10 +02:00
Wenzel Jakob
bb9c91cce8
pybind11Tools.cmake: search for Python 3.9
2020-03-04 16:17:20 +01:00
Axel Huebl
a6355b00f8
CMake: Add Python 3.8 to pybind11Tools ( #1974 )
...
Add Python 3.8 to considered versions in CMake for additional
hints.
https://cmake.org/cmake/help/v3.2/module/FindPythonLibs.html
2019-10-31 12:40:15 +01:00
Dmitry
8f5a8ab4ac
Don't strip debug symbols in RelWithDebInfo mode ( #1892 )
2019-08-23 16:18:05 +02:00
Lori A. Burns
868d94fcb4
Apply c++ standard flag only to files of CXX language. ( #1678 )
2019-06-11 22:07:57 +02:00
Rune Paamand
06d021b6e4
Issue #1532 : Incompatible config options, /MP vs /Gm for MSVC in DEBUG ( #1533 )
...
* Issue #1532 : Incompatible config options, /MP vs /Gm for MSVC in DEBUG
2018-10-25 01:35:33 +02:00
Davis E. King
9343e68b46
Fix cmake scripts so projects using CUDA .cu files build correctly. ( #1441 )
2018-09-14 14:28:54 +02:00
Axel Huebl
435dbdd114
add_module: allow include as SYSTEM ( #1416 )
...
pybind11 headers passed via the `pybind11_add_module` CMake
function can now be included as `SYSTEM` includes (`-isystem`).
This allows to set stricter (or experimental) warnings in
calling projects that might throw otherwise in headers
a user of pybind11 can not influence.
2018-08-29 13:20:11 +02:00
Axel Huebl
3a94561c4d
Debug Builds: -DPy_DEBUG ( #1438 )
...
builds against a python debug library were unreliable and
could lead to symbol errors during linking.
Setting the `Py_DEBUG` define is necessary when linking
against a debug build:
https://stackoverflow.com/questions/39161202/how-to-work-around-missing-pymodule-create2-in-amd64-win-python35-d-lib
https://docs.python.org/2/c-api/intro.html#debugging-builds
https://docs.python.org/3.6/c-api/intro.html#debugging-builds
2018-08-29 13:18:43 +02:00
Dean Moldovan
76e06c89e4
Avoid duplicate C++ standard flags if CMAKE_CXX_STANDARD is set
...
CMAKE_CXX_STANDARD is only available on CMake >= 3.1. If the flag is
set, we avoid initializing PYBIND11_CPP_STANDARD.
2017-08-17 03:04:44 +02:00
Jason Rhinelander
97aa54fefa
Compile with hidden visibility always; set via cmake property rather than compiler flag
...
This updates the compilation to always apply hidden visibility to
resolve the issues with default visibility causing problems under debug
compilations. Moreover using the cmake property makes it easier for a
caller to override if absolutely needed for some reason.
For `pybind11_add_module` we use cmake to set the property; for the
targets, we append to compilation option to non-MSVC compilers.
2017-08-14 11:44:17 -04:00
Jason Rhinelander
fad5d3386c
Detect c++ standard unconditionally
...
Currently select_cxx_standard(), which sets PYBIND11_CPP_STANDARD when
not externally set, is only called from pybind11_add_module(), but the
embed target setup (which runs unconditionally) makes use of
${PYBIND11_CPP_STANDARD}, which isn't set yet. This commit removes the
`select_cxx_standard` function completely and just always runs the
standard detection code.
This also tweaks the detection code to not bothering checking for the
`-std=c++11` flag when the `-std=c++14` detection succeeded.
2017-07-16 11:01:00 -04:00
Jason Rhinelander
77710ff01c
Make PYBIND11_CPP_STANDARD work under MSVC
...
Under MSVC we were ignoring PYBIND11_CPP_STANDARD and simply not
passing any standard (which makes MSVC default to its C++14 mode).
MSVC 2015u3 added the `/std:c++14` and `/std:c++latest` flags; the
latter, under MSVC 2017, enables some C++17 features (such as
`std::optional` and `std::variant`), so it is something we need to
start supporting under MSVC.
This makes the PYBIND11_CPP_STANDARD cmake variable work under MSVC,
defaulting it to /std:c++14 (matching the default -std=c++14 for
non-MSVC).
It also adds a new appveyor test running under MSVC 2017 with
/std:c++latest, which runs (and passes) the
`std::optional`/`std::variant` tests.
Also updated the documentation to clarify the c++ flags and add show
MSVC flag examples.
2017-05-09 16:41:47 -04:00
Dean Moldovan
d361ea15fb
Don't strip debug symbols in debug mode ( #669 )
2017-02-14 20:11:25 +01:00
Jason Rhinelander
c137c0a87b
Store LTO flags in PYBIND11_LTO_{CXX,LINKER}_FLAGS cache variables
...
This both lets us not bother rechecking LTO flags when cmake reinvokes
itself, and also lets the cmake invoker override to specify custom or
no LTO flags by setting the cache variable with
-DPYBIND11_LTO_CXX_FLAGS= when invoking cmake.
2017-02-14 10:59:59 +01:00
Jason Rhinelander
1bee6e7df8
Overhaul LTO flag detection
...
Clang on linux currently fails to run cmake:
$ CC=clang CXX=clang++ cmake ..
...
-- Configuring done
CMake Error at tools/pybind11Tools.cmake:135 (target_compile_options):
Error evaluating generator expression:
$<:-flto>
Expression did not evaluate to a known generator expression
Call Stack (most recent call first):
tests/CMakeLists.txt:68 (pybind11_add_module)
But investigating this led to various other -flto detection problems;
this commit thus overhauls LTO flag detection:
- -flto needs to be passed to the linker as well
- Also compile with -fno-fat-lto-objects under GCC
- Pass the equivalent flags to MSVC
- Enable LTO flags for via generator expressions (for non-debug builds
only), so that multi-config builds (like on Windows) still work
properly. This seems reasonable, however, even on single-config
builds (and simplifies the cmake code a bit).
- clang's lto linker plugins don't accept '-Os', so replace it with
'-O3' when doing a MINSIZEREL build
- Enable trying ThinLTO by default for test suite (only affects clang)
- Match Clang$ rather than ^Clang$ because, for cmake with 3.0+
policies in effect, the compiler ID will be AppleClang on macOS.
2017-02-14 10:59:59 +01:00