diff --git a/configure.ac b/configure.ac index d26b2004bc..a99e5c0f0c 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,10 @@ AC_ARG_ENABLE([python], [python_scripting=$enableval], [python_scripting='yes']) +AC_ARG_WITH(pybind11, + [--with-pybind11=/path/to/pybind11/include pybind11 include path to use (optional)], + pybind11_include_path="$withval") + if [[ "$darkmod_plugins" != 'no' ]] then # Enable conditional directories (used by plugins/Makefile.am) @@ -157,7 +161,6 @@ BOOST_BIND BOOST_FOREACH BOOST_FORMAT BOOST_FUNCTION -BOOST_SMART_PTR BOOST_TOKENIZER # These ones require libraries too @@ -174,14 +177,25 @@ then then PYTHON_LIBS=`$PYTHON_CONFIG --libs` PYTHON_CPPFLAGS=`$PYTHON_CONFIG --includes` + PYBIND11_CPPFLAGS=`` + + # Add the path to the pybind11 library if we got one from the arguments + if test "x$pybind11_include_path" != x ; then + PYBIND11_CPPFLAGS="-I$pybind11_include_path" + fi # pybind11.h is including Python.h, need to help it find the Python.h header - CPPFLAGS="$USER_CPPFLAGS $PYTHON_CPPFLAGS" - AC_CHECK_HEADER([pybind11/pybind11.h], [], [AC_MSG_ERROR([Missing pybind11.h, please install the pybind11 package])]) + CPPFLAGS="$USER_CPPFLAGS $PYTHON_CPPFLAGS $PYBIND11_CPPFLAGS" + + AC_CHECK_HEADER([pybind11/pybind11.h], [], + [AC_MSG_ERROR([Missing pybind11.h, please install the pybind11 package for your system. \ +If there's no pybind11 package for your distribution, please download it from the pybind11 \ +website and specify the path to the include folder using --with-pybind11=/path/to/pybind11/include])]) script_module='script' AC_SUBST([script_module]) AC_SUBST([PYTHON_CPPFLAGS]) AC_SUBST([PYTHON_LIBS]) + AC_SUBST([PYBIND11_CPPFLAGS]) fi fi diff --git a/m4/libtool.m4 b/m4/libtool.m4 index ee80844b61..10ab2844c4 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -728,6 +728,7 @@ _LT_CONFIG_SAVE_COMMANDS([ cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. diff --git a/plugins/script/Makefile.am b/plugins/script/Makefile.am index 5888d14d35..fa4b1dfee9 100644 --- a/plugins/script/Makefile.am +++ b/plugins/script/Makefile.am @@ -1,6 +1,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs \ $(XML_CFLAGS) \ $(PYTHON_CPPFLAGS) \ + $(PYBIND11_CPPFLAGS) \ -DPKGLIBDIR='"$(pkglibdir)"' modulesdir = $(pkglibdir)/modules diff --git a/plugins/script/PythonModule.cpp b/plugins/script/PythonModule.cpp index 0a342cd2e9..5d3ea85035 100644 --- a/plugins/script/PythonModule.cpp +++ b/plugins/script/PythonModule.cpp @@ -24,6 +24,11 @@ void PythonModule::RegisterToPython(const ModuleRegistrationCallback& callback) { _registrationCallback = callback; + rMessage() << "Registering darkradiant module to Python using pybind11 version " << + PYBIND11_VERSION_MAJOR << "." << + PYBIND11_VERSION_MINOR << "." << + PYBIND11_VERSION_PATCH << std::endl; + // Register the darkradiant module to Python int result = PyImport_AppendInittab(NAME(), InitModule);