Commit Graph

21 Commits

Author SHA1 Message Date
Wenzel Jakob e7d304fbc6
added citation reference (fixes #767) (#1189) 2017-11-17 18:44:20 +01:00
Dean Moldovan 56613945ae Use semi-constexpr signatures on MSVC
MSCV does not allow `&typeid(T)` in constexpr contexts, but the string
part of the type signature can still be constexpr. In order to avoid
`typeid` as long as possible, `descr` is modified to collect type
information as template parameters instead of constexpr `typeid`.
The actual `std::type_info` pointers are only collected in the end,
as a `constexpr` (gcc/clang) or regular (MSVC) function call.

Not only does it significantly reduce binary size on MSVC, gcc/clang
benefit a little bit as well, since they can skip some intermediate
`std::type_info*` arrays.
2017-09-16 12:02:49 +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
Dean Moldovan 443ab5946b Replace PYBIND11_PLUGIN with PYBIND11_MODULE
This commit also adds `doc()` to `object_api` as a shortcut for the
`attr("__doc__")` accessor.

The module macro changes from:
```c++
PYBIND11_PLUGIN(example) {
    pybind11::module m("example", "pybind11 example plugin");
    m.def("add", [](int a, int b) { return a + b; });
    return m.ptr();
}
```

to:

```c++
PYBIND11_MODULE(example, m) {
    m.doc() = "pybind11 example plugin";
    m.def("add", [](int a, int b) { return a + b; });
}
```

Using the old macro results in a deprecation warning. The warning
actually points to the `pybind11_init` function (since attributes
don't bind to macros), but the message should be quite clear:
"PYBIND11_PLUGIN is deprecated, use PYBIND11_MODULE".
2017-05-29 03:21:19 +02:00
Lori A. Burns 5cafc99884 add CMake exported interface library and Config detection file 2016-12-13 21:44:19 +01:00
Wenzel Jakob 2fb5f1d0c3 added message about recursion limits 2016-11-16 17:37:10 +01:00
Jason Rhinelander fb7c9fd326 Remove obsolete example reference (#457)
* Remove obsolete example reference
* Make example fully-working (except for #includes)

Fixes #456.
2016-10-22 18:54:33 +02:00
Jason Rhinelander 20ef62656f Fix minor documentation spelling mistakes 2016-09-21 13:39:02 -04:00
Wenzel Jakob fe34241e50 minor doc & style fixes 2016-09-06 13:02:29 +09:00
Wenzel Jakob 70f5a4dc8b minor: added error message to faq 2016-09-05 17:19:18 +09:00
Wenzel Jakob f600c1d899 updated FAQ section on Python detection 2016-06-03 14:47:54 +02:00
Wenzel Jakob a439ccaa0e minor FAQ edits, referenced cppimport project 2016-05-17 10:47:52 +02:00
Wenzel Jakob c62360d994 minor FAQ updates 2016-05-03 14:32:47 +02:00
Wenzel Jakob f64feaf3e4 documentation improvements 2016-04-28 15:32:07 +02:00
Wenzel Jakob e84f557edf documentation improvements 2016-04-26 23:48:55 +02:00
Wenzel Jakob c79dbe425d FAQ improvements 2016-04-18 10:53:38 +02:00
Wenzel Jakob 2e03a5857c added comment about cmake issues (#99) 2016-04-14 11:27:15 +02:00
Wenzel Jakob 50ed3614de added a faq entry about import issues 2016-04-11 17:38:25 +02:00
Wenzel Jakob a3e34f4a5f comment about old versions of visual studio 2016-03-15 15:06:47 +01:00
Wenzel Jakob 4a48afb356 doc updates 2016-03-09 21:31:21 +01:00
Wenzel Jakob de623a7668 added faq 2016-03-09 21:11:19 +01:00