Skip to content

Commit a757fbf

Browse files
committed
Updated setup.py to use SFML_HEADERS and SFML_LIBRARIES env variables
1 parent 607dfaf commit a757fbf

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

setup.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
print("Please install Cython and try again.")
1414
exit(1)
1515

16+
SFML_HEADERS = os.getenv('SFML_HEADERS')
17+
SFML_LIBRARIES = os.getenv('SFML_LIBRARIES')
18+
1619
if platform.architecture()[0] == "32bit":
1720
arch = "x86"
1821
elif platform.architecture()[0] == "64bit":
@@ -75,11 +78,24 @@ def cython_sources(self, sources, extension):
7578

7679
return ret
7780

81+
include_dirs = []
82+
library_dirs = []
83+
84+
include_dirs.append(os.path.join('include', 'Includes'))
85+
if SFML_HEADERS:
86+
include_dirs.append(SFML_HEADERS)
87+
88+
if sys.hexversion >= 0x03050000:
89+
library_dirs.append(os.path.join('extlibs', 'libs-msvc-universal', arch))
90+
91+
if SFML_LIBRARIES:
92+
include_dirs.append(SFML_LIBRARIES)
93+
7894
def extension(name, files, libs): return Extension(
7995
name='sfml.' + name,
8096
sources=[os.path.join('src', 'sfml', name, filename) for filename in files],
81-
include_dirs=[os.path.join('include', 'Includes')],
82-
library_dirs=[os.path.join('extlibs', 'libs-msvc-universal', arch)] if sys.hexversion >= 0x03050000 else [],
97+
include_dirs=include_dirs,
98+
library_dirs=library_dirs,
8399
language='c++',
84100
libraries=libs,
85101
define_macros=[('SFML_STATIC', '1')] if platform.system() == 'Windows' else []

0 commit comments

Comments
 (0)