Commit Graph

174 Commits

Author SHA1 Message Date
Matthew Woehlke
e15fa9f99a Avoid C-style const casts (#659)
* Avoid C-style const casts

Replace C-style casts that discard `const` with `const_cast` (and, where
necessary, `reinterpret_cast` as well).

* Warn about C-style const-discarding casts

Change pybind11_enable_warnings to also enable `-Wcast-qual` (warn if a
C-style cast discards `const`) by default. The previous commit should
have gotten rid of all of these (at least, all the ones that tripped in
my build, which included the tests), and this should discourage more
from newly appearing.
2017-02-08 23:43:08 +01:00
Jason Rhinelander
a3fec901b8 Avoid CMP0048 warning (#570)
Fixes #567.

If pybind's CMakeLists gets loaded via an include_directory from another
CMakeLists with a higher minimum version (e.g. 3.0), the project()
command without a version produces a CMP0048 warning.

This commit explicitly requests the new behaviour if the policy exists,
as it won't cause problems (we set VERSION later).
2016-12-26 11:26:21 +01:00
Dean Moldovan
71e8a7962c Rename target from pybind11::pybind11 to pybind11::module
Makes room for an eventual pybind11::embedded target.
2016-12-19 16:34:48 +01:00
Dean Moldovan
b0f3885c95 Make sure add_subdirectory and find_package behave identically
Add a BUILD_INTERFACE and a pybind11::pybind11 alias for the interface
library to match the installed target.

Add new cmake tests for add_subdirectory and consolidates the
.cpp and .py files needed for the cmake build tests:

Before:
tests
|-- test_installed_module
|   |-- CMakeLists.txt
|   |-- main.cpp
|   \-- test.py
\-- test_installed_target
    |-- CMakeLists.txt
    |-- main.cpp
    \-- test.py

After:
tests
\-- test_cmake_build
    |-- installed_module/CMakeLists.txt
    |-- installed_target/CMakeLists.txt
    |-- subdirectory_module/CMakeLists.txt
    |-- subdirectory_target/CMakeLists.txt
    |-- main.cpp
    \-- test.py
2016-12-19 16:34:48 +01:00
Lori A. Burns
545b4dbc19 separate main CMakeLists.txt into Tools file also available upon installation 2016-12-13 21:44:19 +01:00
Lori A. Burns
5cafc99884 add CMake exported interface library and Config detection file 2016-12-13 21:44:19 +01:00
Lori A. Burns
44d7c59c55 make installation include and Config dirs configurable. set CMake project version from source. 2016-12-13 21:44:19 +01:00
Alexander Stukowski
9a110e6da8 Provide more control over automatic generation of docstrings (#486)
Added the docstring_options class, which gives global control over the generation of docstrings and function signatures.
2016-11-15 12:38:05 +01:00
Wenzel Jakob
26df852392 removed forgotten message() stmt from CMakeLists.txt 2016-10-10 01:35:27 +02:00
Wenzel Jakob
6a1734af23 minor cmake cleanups 2016-10-09 20:14:23 +02:00
Wenzel Jakob
dac3858e7d Make header files viewable in IDEs (fixes #424) 2016-09-29 21:30:00 +02:00
Trent Houliston
352149e892 Refactor the chrono cast functions into chrono.h.
Add unit tests and documentation for the chrono cast.
2016-09-13 19:58:05 +10:00
Dean Moldovan
b62a896f31 Add barebones build to Travis CI
This build makes sure everything still works without optional
dependencies (numpy/scipy/eigen) and also tests the automatic
discovery functions in CMake (Python version, C++ standard).

[skip appveyor]
2016-08-26 11:41:27 +02:00
Dean Moldovan
a0c1ccf0a9 Port tests to pytest
Use simple asserts and pytest's powerful introspection to make testing
simpler. This merges the old .py/.ref file pairs into simple .py files
where the expected values are right next to the code being tested.

This commit does not touch the C++ part of the code and replicates the
Python tests exactly like the old .ref-file-based approach.
2016-08-19 13:19:38 +02:00
Dean Moldovan
00a300950b Report warnings as errors on Travis and AppVeyor 2016-08-15 13:41:44 +02:00
Wenzel Jakob
2160860c0a minor cmake change as per #306 2016-08-02 02:19:35 +02:00
Trygve Laugstøl
9119f13072 Improving support for installing pybind11.
Mark the pybind11 headers as private to the target.

Fixes #305
2016-08-01 09:17:29 +02:00
Dean Moldovan
52ae7b1d33 Add 'check' target which both builds and tests 2016-06-02 09:05:15 +02:00
Boris Schäling
fc19c19804 Fix Cygwin support 2016-05-29 16:56:15 +02:00
Wenzel Jakob
c48da92561 Merge branch 'cygwin' of https://github.com/BorisSchaeling/pybind11 into BorisSchaeling-cygwin 2016-05-29 12:46:21 +02:00
Wenzel Jakob
67a6392987 very minor cmake adjustments 2016-05-29 12:35:16 +02:00
Boris Schäling
20ee935203 Use decltype to deduce return type of PyThread_create_key 2016-05-28 12:26:18 +02:00
Dean Moldovan
c3c27c4259 Make C++ standard configurable 2016-05-28 11:08:16 +02:00
Dean Moldovan
9fb50c56d0 Add LTO and strip to pybind11_add_module 2016-05-27 21:42:43 +02:00
Dean Moldovan
49720f0353 Add PYBIND11_ prefix to variable and remove redundant OSX property 2016-05-26 22:53:38 +02:00
Boris Schäling
8965644536 Make examples build and run on Cygwin 2016-05-26 22:42:07 +02:00
Dean Moldovan
03d6a514d2 Fix missing variable for Windows build 2016-05-25 13:39:32 +02:00
Dean Moldovan
8c6b0b8333 Don't build tests when project is used via add_subdirectory 2016-05-23 00:12:37 +02:00
Dean Moldovan
4563e9a8cd Add CMake function pybind11_add_module()
The function creates a pybind11 module using the specified source files.
2016-05-22 22:28:08 +02:00
Dean Moldovan
928fff649f Include a more robust FindPythonLibs module for CMake 2016-05-22 20:49:35 +02:00
Wenzel Jakob
25c03cecfa stl_bind redesign & cleanup pass 2016-05-16 12:12:58 +02:00
Sergey Lyskov
eae7744c0e adding stl_binders 2016-05-15 20:46:07 +02:00
Wenzel Jakob
9e0a0568fe transparent conversion of dense and sparse Eigen types 2016-05-05 21:44:29 +02:00
Wenzel Jakob
9ac5bc5531 fix captialization issue in CMakeLists.txt 2016-05-05 16:27:13 +02:00
Wenzel Jakob
bdd11030c2 minor cmake improvements on windows 2016-05-01 13:11:54 +02:00
Wenzel Jakob
e44e56fafc consider pybind11 include directory before python
This is needed in case an older pybind11 version was installed with pip
2016-04-30 23:00:01 +02:00
Wenzel Jakob
d7efa4ff7b return best representation of polymorphic types (fixes #105) 2016-04-13 13:51:33 +02:00
Wenzel Jakob
1c329aab5a pickling support (fixes #144) 2016-04-13 02:58:56 +02:00
Wenzel Jakob
eda978e003 support for opaque types 2016-03-15 15:07:55 +01:00
Wenzel Jakob
17cdb06c1b fix severe regression involving character arrays (fixes #137) 2016-03-10 13:24:10 +01:00
Wenzel Jakob
80c2451ac5 use relaxed testing scheme for MSVC and the intel compiler (they miss some RV optimizations) 2016-02-20 20:53:10 +01:00
Wenzel Jakob
e2bb4eb87a don't do -ipo check for non-intel compilers (causes issues with Clang on OSX) 2016-02-19 13:27:20 +01:00
Ben Pritchard
70ee47ddcf Add Intel to cmake file. Supress Intel inline/noinline warning 2016-02-18 13:06:43 -05:00
Wenzel Jakob
c91551b33b improved python detection in CMakeLists.txt (fixes #98) 2016-02-07 15:57:14 +01:00
Wenzel Jakob
ab7ef81ee1 Merge pull request #73 from ax3l/topic-cleanCMake
CMake: Test Counting
2016-01-21 19:23:23 +01:00
Wenzel Jakob
518cf721d9 improve cmake windows debug configuration (fixes #77) 2016-01-21 19:17:58 +01:00
Axel Huebl
6c37f2111d CMake: Test Counting
- automatically detect number of examples
2016-01-20 13:03:01 +01:00
Wenzel Jakob
48548ea4a5 general cleanup of the codebase
- new pybind11::base<> attribute to indicate a subclass relationship
- unified infrastructure for parsing variadic arguments in class_ and cpp_function
- use 'handle' and 'object' more consistently everywhere
2016-01-17 22:31:15 +01:00
Wenzel Jakob
5f218b3f2c keep_alive call policy (analogous to Boost.Python's with_custodian_and_ward, fixes #62) 2016-01-17 22:31:15 +01:00
Wenzel Jakob
6eb11da94a Very minor documentation fixes, updated logo 2016-01-17 22:31:15 +01:00
Wenzel Jakob
66c9a40213 Much more efficient generation of function signatures, updated docs
This modification taps into some newer C++14 features (if present) to
generate function signatures considerably more efficiently at compile
time rather than at run time.

With this change, pybind11 binaries are now *2.1 times* smaller compared
to the Boost.Python baseline in the benchmark. Compilation times get a
nice improvement as well.

Visual Studio 2015 unfortunately doesn't implement 'constexpr' well
enough yet to support this change and uses a runtime fallback.
2016-01-17 22:31:15 +01:00
Wenzel Jakob
caa9d44cc7 cmake: robustified search for python 2016-01-17 22:31:15 +01:00
Erik O'Leary
a1718a66d3 functional.h not included in "make install" 2015-12-21 20:26:02 -06:00
Wenzel Jakob
e52cf8ae91 also add stl.h header 2015-12-15 11:32:29 +01:00
Jan Dohl
3e2736b63c Add complex.h to list of installed headers 2015-12-15 03:24:40 +01:00
Wenzel Jakob
faaee1cbbd only use -flto when supported, quenched policy warnings 2015-11-30 12:45:38 +01:00
Wenzel Jakob
f2331666d1 improved compiler detection 2015-11-28 14:24:44 +01:00
Wenzel Jakob
3350b5e81c make install target optional 2015-11-24 21:33:28 +01:00
Luka Čehovin
19af357583 Enabling installation of headers on Unix systems. 2015-11-24 21:31:15 +01:00
Wenzel Jakob
b1b714023a consistent macro naming throughout the project 2015-10-18 16:48:30 +02:00
Wenzel Jakob
867ae377ed minor CMakeLists.txt tweak: optimize for small binaries even in release builds 2015-10-15 22:41:25 +02:00
Wenzel Jakob
8f4eb00690 last breaking change: be consistent about the project name 2015-10-15 18:23:56 +02:00
Wenzel Jakob
607654f7ec windows fixes 2015-10-13 23:58:10 +02:00
Wenzel Jakob
bcd3182f3d added a few more comments to the CMake build system 2015-10-13 03:03:06 +02:00
Wenzel Jakob
3b806d41eb Added configuration files for Travis CI integration 2015-10-11 18:31:46 +02:00
Wenzel Jakob
6d6fd099db fixed testing infrastructure 2015-10-01 17:34:26 +02:00
Wenzel Jakob
a2f6fde0dc support for overriding virtual functions 2015-10-01 17:13:35 +02:00
Wenzel Jakob
570822102c support for ancient Python versions (2.7.x) 2015-09-04 23:49:23 +02:00
Wenzel Jakob
02f770d06c win32 compilation flag improvements 2015-09-01 22:51:34 +02:00
Wenzel Jakob
cd5cda715b cleaned up handling of warnings on clang 2015-08-03 12:17:54 +02:00
Wenzel Jakob
281aa0e668 nicer code separation, cleanup logic, std::function type caster 2015-07-31 04:10:38 +02:00
Wenzel Jakob
a576e6a8ca keyword argument support, removed last traces of std::function<> usage 2015-07-29 23:39:11 +02:00
Wenzel Jakob
d4258bafef generate more compact binaries 2015-07-28 03:10:15 +02:00
Wenzel Jakob
38bd71134a Initial commit 2015-07-09 15:27:32 +02:00