Search code examples
pythonwindowsvisual-studiopipsfml

How to specify C++ header and library folder in a setup.py (pySFML)?


pysfml is a library I love, but it has not been maintained for a while now, and is not available with pip.

I am using windows 10 and visual C++ 2015.

The setup.py is this one:

https://github.com/Sonkun/python-sfml/blob/master/setup.py

I edited line 60, but I still have an error since I did not specific .lib files.

I also edited line 81 like so:

library_dirs=[os.path.join('extlibs', 'libs-msvc-universal', arch)]+[os.path.join('C:\\_code\\libs\\SFML-2.5.0\\lib')] if sys.hexversion >= 0x03050000 else [], setup.py finishes, but when I import it in python it says ImportError: DLL load failed: The specified module could not be found.

I even add the dlls in the .egg file it generated in /dist and installed the .egg manually with the same error.


Solution

  • line 126 shall be

    dlls = [("Lib\\site-packages\\sfml", glob('extlibs\\' + arch + '\\openal32.dll'))]+[("sfml\\", glob('C:\\_code\\libs\\SFML-2.5.0\\bin\\*'))]

    I have no idea how to make a setup.py take a prebuilt sfml, so I don't know how to patch it.