Closed paulmelis closed 7 years ago
Hello Paul,
thank you for the suggestion. This is indeed something that should be used for the library search!
LD_LIBRARY_PATH
is used on Linux and DYLD_LIBRARY_PATH
is used on macOS. So I'd suggest having this dependent on sys.platform, with Linux behavior as default/fallback.
Also, an environment variable PYGLFW_LIBRARY
should allow the user to set what library should be used. That way, if you want to use a specific binary, you can be sure that another library with the same version won't be used instead.
What do you think?
Edit: Windows doesn't matter, as ctypes does the searching for us there. Added PYGLFW_LIBRARY
.
Please take a look at 8824afb59d55f4769797c4f60aeecc45cb09a94e and let me know what you think.
Hi Florian, Looks great!
Version 1.4.0 is on PyPI now. Thanks again!
This is with pyglfw 1.3.3 on Linux. The _load_library call in glfw.py uses a fixed set of paths that it searches for the GLFW shared lib. Unfortunately, I don't have GLFW3 installed system-wide as the available Debian package on jessie is a bit old. So I compiled and installed the latest GLFW3 in a custom location (/software/glfw/3.2.1 in this case), but I can't direct pyglfw to get the shared lib from there without hacking glfw.py.
Here's an updated excerpt of glfw.py, starting around line 150, to make it search the paths in LD_LIBRARY_PATH as well:
if sys.platform == 'win32':
only try glfw3.dll on windows
else: search_paths = [ '', '/usr/lib64', '/usr/local/lib64', '/usr/lib', '/usr/local/lib', '/run/current-system/sw/lib', '/usr/lib/x86_64-linux-gnu/' ]