Commit Graph

25 Commits

Author SHA1 Message Date
Nicolas Bigaouette
8bd1f49de7 Remove references to PYBIND11_PYTHON_VERSION: Use PYTHON_LIBRARY and PYTHON_INCLUDE_DIR instead.
The cmake documentation[0] mention that PYTHON_LIBRARY and PYTHON_INCLUDE_DIR
should be used to select which Python interpreter to use.

[0] https://cmake.org/cmake/help/v3.0/module/FindPythonLibs.html
2016-01-12 13:45:08 -05:00
Nicolas Bigaouette
6435a09034 Revert "Tell cmake to use EXACT python version (from PYBIND11_PYTHON_VERSION)."
This reverts commit 2f97147fc7 as per
suggestion in !65.
2016-01-12 12:56:17 -05:00
Nicolas Bigaouette
2f97147fc7 Tell cmake to use EXACT python version (from PYBIND11_PYTHON_VERSION).
This should insure that both the `PythonLibs` and `PythonInterp` points to
the same python version.

Without this, the Python library and interpreter might not match version.
For example, if both Python 2.7 and 3.4 is installed, `PythonLibs` will
find /usr/lib/x86_64-linux-gnu/libpython3.4m.so while
`PythonInterp` will find /usr/bin/python2.7 (at least on Ubuntu 14.04).

When `PythonLibs` and `PythonInterp` don't point to the same Python version,
the examples will all fail:

```bash
$ cmake ..
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Setting build type to 'MinSizeRel' as none was specified.
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.4m.so (found suitable version "3.4.3", minimum required is "2.7")
-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.6", minimum required is "2.7")
-- Performing Test HAS_LTO_FLAG
-- Performing Test HAS_LTO_FLAG - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nbigaouette/pybind11/build
$ make test
Running tests...
Test project /home/nbigaouette/pybind11/build
      Start  1: example1
 1/12 Test  #1: example1 .........................***Failed    0.02 sec
      Start  2: example2
 2/12 Test  #2: example2 .........................***Failed    0.03 sec
      Start  3: example3
 3/12 Test  #3: example3 .........................***Failed    0.02 sec
      Start  4: example4
 4/12 Test  #4: example4 .........................***Failed    0.02 sec
      Start  5: example5
 5/12 Test  #5: example5 .........................***Failed    0.02 sec
      Start  6: example6
 6/12 Test  #6: example6 .........................***Failed    0.02 sec
      Start  7: example7
 7/12 Test  #7: example7 .........................***Failed    0.02 sec
      Start  8: example8
 8/12 Test  #8: example8 .........................***Failed    0.02 sec
      Start  9: example9
 9/12 Test  #9: example9 .........................***Failed    0.02 sec
      Start 10: example10
10/12 Test #10: example10 ........................***Failed    0.02 sec
      Start 11: example11
11/12 Test #11: example11 ........................***Failed    0.03 sec
      Start 12: example12
12/12 Test #12: example12 ........................***Failed    0.02 sec

0% tests passed, 12 tests failed out of 12

Total Test time (real) =   0.25 sec

The following tests FAILED:
          1 - example1 (Failed)
          2 - example2 (Failed)
          3 - example3 (Failed)
          4 - example4 (Failed)
          5 - example5 (Failed)
          6 - example6 (Failed)
          7 - example7 (Failed)
          8 - example8 (Failed)
          9 - example9 (Failed)
         10 - example10 (Failed)
         11 - example11 (Failed)
         12 - example12 (Failed)
Errors while running CTest
make: *** [test] Error 8
```

By adding the `EXACT` version to the `find_package()` calls, the version
discrepancy is at least caught at the cmake call:

```bash
$ cmake ..
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Setting build type to 'MinSizeRel' as none was specified.
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find PythonLibs: Found unsuitable version "3.4.3", but required
  is exact version "2.7" (found /usr/lib/x86_64-linux-gnu/libpython3.4m.so)
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:313 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindPythonLibs.cmake:208 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:27 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/nbigaouette/pybind11/build/CMakeFiles/CMakeOutput.log".
```
2016-01-12 12:13:37 -05: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