Skip to content

Commit

Permalink
Fix includes
Browse files Browse the repository at this point in the history
  • Loading branch information
kunitoki committed Jan 14, 2024
1 parent b66d9f2 commit 821a98c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 11 deletions.
1 change: 0 additions & 1 deletion modules/juce_python/bindings/ScriptJuceCoreBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#define JUCE_PYTHON_INCLUDE_PYBIND11_OPERATORS
#include "../utilities/PyBind11Includes.h"
#undef JUCE_PYTHON_INCLUDE_PYBIND11_OPERATORS

namespace PYBIND11_NAMESPACE {
namespace detail {
Expand Down
20 changes: 15 additions & 5 deletions modules/juce_python/bindings/ScriptJuceDataStructuresBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#define JUCE_PYTHON_INCLUDE_PYBIND11_OPERATORS
#define JUCE_PYTHON_INCLUDE_PYBIND11_FUNCTIONAL
#include "../utilities/PyBind11Includes.h"
#undef JUCE_PYTHON_INCLUDE_PYBIND11_OPERATORS
#undef JUCE_PYTHON_INCLUDE_PYBIND11_FUNCTIONAL

#include <functional>
#include <string_view>
Expand Down Expand Up @@ -255,12 +253,17 @@ void registerJuceDataStructuresBindings (pybind11::module_& m)
return result.cast<int>();
}

py::pybind11_fail("Tried to call pure virtual function \"ValueTreeComparator::compareElements\"");
py::pybind11_fail("Tried to call pure virtual function \"ValueTree::Comparator::compareElements\"");
}
};

py::class_<ValueTree> classValueTree (m, "ValueTree");
py::class_<ValueTree::Listener, PyValueTreeListener> classValueTreeListener (classValueTree, "Listener");
py::class_<PyValueTreeComparator> classValueTreeComparator (classValueTree, "Comparator");

classValueTreeListener.def (py::init<>());

classValueTreeComparator.def (py::init<>());

classValueTree
.def (py::init<>())
Expand Down Expand Up @@ -319,7 +322,7 @@ void registerJuceDataStructuresBindings (pybind11::module_& m)
.def ("removeListener", &ValueTree::removeListener)
.def ("setPropertyExcludingListener", &ValueTree::setPropertyExcludingListener)
.def ("sendPropertyChangeMessage", &ValueTree::sendPropertyChangeMessage)
//.def ("sort", &ValueTree::sort)
.def ("sort", &ValueTree::template sort<PyValueTreeComparator>)
.def ("getReferenceCount", &ValueTree::getReferenceCount)
;

Expand Down Expand Up @@ -356,7 +359,14 @@ void registerJuceDataStructuresBindings (pybind11::module_& m)
.def (py::init<const ValueTree&>())
.def ("stateChanged", &ValueTreeSynchroniser::stateChanged)
.def ("sendFullSyncCallback", &ValueTreeSynchroniser::sendFullSyncCallback)
//.def_static ("applyChange", &ValueTreeSynchroniser::applyChange)
.def_static ("applyChange", [](ValueTree* root, const py::buffer& data, UndoManager* undoManager)
{
jassert (root != nullptr); // TODO

py::buffer_info info = data.request();

return ValueTreeSynchroniser::applyChange (*root, info.ptr, static_cast<size_t> (info.size), undoManager);
})
.def ("getRoot", &ValueTreeSynchroniser::getRoot, py::return_value_policy::reference)
;

Expand Down
2 changes: 0 additions & 2 deletions modules/juce_python/bindings/ScriptJuceEventsBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#define JUCE_PYTHON_INCLUDE_PYBIND11_OPERATORS
#define JUCE_PYTHON_INCLUDE_PYBIND11_FUNCTIONAL
#include "../utilities/PyBind11Includes.h"
#undef JUCE_PYTHON_INCLUDE_PYBIND11_OPERATORS
#undef JUCE_PYTHON_INCLUDE_PYBIND11_FUNCTIONAL

#include <functional>
#include <string_view>
Expand Down
2 changes: 0 additions & 2 deletions modules/juce_python/bindings/ScriptJuceGraphicsBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#define JUCE_PYTHON_INCLUDE_PYBIND11_OPERATORS
#define JUCE_PYTHON_INCLUDE_PYBIND11_STL
#include "../utilities/PyBind11Includes.h"
#undef JUCE_PYTHON_INCLUDE_PYBIND11_OPERATORS
#undef JUCE_PYTHON_INCLUDE_PYBIND11_STL

#include "../pybind11/operators.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include "../utilities/ClassDemangling.h"

#define JUCE_PYTHON_INCLUDE_PYBIND11_OPERATORS
#define JUCE_PYTHON_INCLUDE_PYBIND11_IOSTREAM
#include "../utilities/PyBind11Includes.h"
#undef JUCE_PYTHON_INCLUDE_PYBIND11_OPERATORS

#if JUCE_WINDOWS
#define VC_EXTRALEAN
Expand Down
16 changes: 16 additions & 0 deletions modules/juce_python/utilities/PyBind11Includes.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,45 @@

#if defined (JUCE_PYTHON_INCLUDE_PYBIND11_OPERATORS)
#include <pybind11/operators.h>
#undef JUCE_PYTHON_INCLUDE_PYBIND11_OPERATORS
#endif

#if defined (JUCE_PYTHON_INCLUDE_PYBIND11_STL)
#include <pybind11/stl.h>
#undef JUCE_PYTHON_INCLUDE_PYBIND11_STL
#endif

#if defined (JUCE_PYTHON_INCLUDE_PYBIND11_FUNCTIONAL)
#include <pybind11/functional.h>
#undef JUCE_PYTHON_INCLUDE_PYBIND11_FUNCTIONAL
#endif

#if defined (JUCE_PYTHON_INCLUDE_PYBIND11_IOSTREAM)
#include <pybind11/iostream.h>
#undef JUCE_PYTHON_INCLUDE_PYBIND11_IOSTREAM
#endif

#else // JUCE_PYTHON_USE_EXTERNAL_PYBIND11
#include "../pybind11/embed.h"

#if defined (JUCE_PYTHON_INCLUDE_PYBIND11_OPERATORS)
#include "../pybind11/operators.h"
#undef JUCE_PYTHON_INCLUDE_PYBIND11_OPERATORS
#endif

#if defined (JUCE_PYTHON_INCLUDE_PYBIND11_STL)
#include "../pybind11/stl.h"
#undef JUCE_PYTHON_INCLUDE_PYBIND11_STL
#endif

#if defined (JUCE_PYTHON_INCLUDE_PYBIND11_FUNCTIONAL)
#include "../pybind11/functional.h"
#undef JUCE_PYTHON_INCLUDE_PYBIND11_FUNCTIONAL
#endif

#if defined (JUCE_PYTHON_INCLUDE_PYBIND11_IOSTREAM)
#include "../pybind11/iostream.h"
#undef JUCE_PYTHON_INCLUDE_PYBIND11_IOSTREAM
#endif

#endif

0 comments on commit 821a98c

Please sign in to comment.