This allows building against the Python libraries even when the
Python interpreter/executable is missing. The correct extensions
for the binary modules will be guessed, the tests will fail,
and the bytecode for any pure-Python modules will not be
precompiled.
This requires a macro to override find_package,
as the default behavior in CMake is to fall back
from MODULE onto CONFIG.
Note that Bullet is given a specific override
not to look for a CONFIG, since Bullet tends to
use weird paths in its CONFIG script.
This is preferable because imported targets generally include
all of the relevant information specific to the particular
installation of each package, and without needing to hunt down
a bunch of variables to do it.
To do this, package_option() (which is starting to grow in scope
a little beyond just providing the package option, come to think
of it) is given a new IMPORTED_AS option, which tells the package
configuration system to look for one or more imported targets and
link against them instead.
Instead, let's use a PKG::PKGNAME interface library, which simplifies
the linking and also allows us to use imported libraries from
find_package in the future.
This should obviate the need for pystub as well.
Note that it's currently a little bit hacky; the source will
have to be moved to make the CMake dependencies work better.
This reimplements the spinlock on top of std::atomic_flag, which is guaranteed to be lockless. It also inserts the PAUSE (REP NOP) instruction which is strongly recommended to be placed in busy-wait loops by Intel.
This also includes a recursive spinlock implementation.
The spinlock implementation is disabled by default, but can be enabled by adding the --override MUTEX_SPINLOCK=1 flag to makepanda.
For example, this will let us pass a ConfigVariableFilename to anything that accepts a Filename, just like in C++.
Does not work if the return value if the typecast operator requires management.
Currently, the WeakPointerTo comparison operators compare the raw pointers, but this is not useful as it may cause a false equality if one weak pointer in the comparison is expired and points to memory that has since been reused.
Instead, we can define a comparison based on the control block pointer, which exists since the new weak pointer implementation in 0bb81a43c9. This is implemented in the owner_before method, matching C++11 std::weak_ptr semantics.
I would now recommend deprecating most comparison operators of WeakPointerTo or redefining them to make more sense, ie. comparing equal if they (once) referred to the same object and not if they simply point to the same memory address. This has not yet been done, though code that uses the comparison operators has been fixed in this commit.
Overloads of std::owner_less have been provided for creating a map or set with Weak(Const)PointerTo keys.
Only the basics are supported; the __members__ or iter interface is not supported at this time.
See also #351 for discussion on pulling in enum34 module.
If a class inherits from ReferenceCount, it can be destructed by downcasting to ReferenceCount, so it should not be an obstacle to properly clean it up when such a class is returned from C++.
This issue comes up when a CycleData is returned via MemoryUsagePointers, which is not exposed so is wrapped as NodeReferenceCount instead, which has a protected destructor.