Skip to content

Commit c240b5d

Browse files
committed
Moved source files of each module to a subfolder named after the module
1 parent e2a6123 commit c240b5d

20 files changed

+14
-11
lines changed

setup.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@ def cython_sources(self, sources, extension):
2929
# move its headers (foo.h and foo_api.h) to include/pysfml
3030
destination = os.path.join('include', 'pysfml')
3131

32-
source = os.path.join('src', 'sfml', module + '.h')
32+
filename = module + '.h'
33+
source = os.path.join('src', 'sfml', module, filename)
3334
if os.path.isfile(source):
3435
try:
3536
shutil.move(source, destination)
3637
except shutil.Error:
3738
pass
3839

39-
source = os.path.join('src', 'sfml', module + '_api.h')
40+
filename = module + '_api.h'
41+
source = os.path.join('src', 'sfml', module, filename)
4042
if os.path.isfile(source):
4143
try:
4244
shutil.move(source, destination)
@@ -65,9 +67,9 @@ def remove_if_exist(filename):
6567
pass
6668

6769
for module in modules:
68-
remove_if_exist(os.path.join(include_path, module + '.h'))
69-
remove_if_exist(os.path.join(include_path, module + '._api.h'))
70-
remove_if_exist(os.path.join(source_path, module + '.cpp'))
70+
remove_if_exist(os.path.join(include_path, module, module + '.h'))
71+
remove_if_exist(os.path.join(include_path, module, module + '._api.h'))
72+
remove_if_exist(os.path.join(source_path, module, module + '.cpp'))
7173

7274
# use extlibs on Windows only
7375
if platform.system() == 'Windows':
@@ -83,7 +85,7 @@ def remove_if_exist(filename):
8385
else:
8486
extension = lambda name, files, libs: Extension(
8587
name='sfml.' + name,
86-
sources=files,
88+
sources= [os.path.join('src', 'sfml', name, filename) for filename in files],
8789
include_dirs=['include', 'include/Includes'],
8890
language='c++',
8991
libraries=libs,
@@ -92,26 +94,27 @@ def remove_if_exist(filename):
9294

9395
system = extension(
9496
'system',
95-
[sources['system'], 'src/sfml/error.cpp', 'src/sfml/NumericObject.cpp', 'src/sfml/hacks.cpp'],
97+
['system.pyx', 'error.cpp', 'hacks.cpp'],#, 'NumericObject.cpp'],
9698
['sfml-system'])
9799

98100
window = extension(
99-
'window', [sources['window'], 'src/sfml/DerivableWindow.cpp'],
101+
'window',
102+
['window.pyx', 'DerivableWindow.cpp'],
100103
['sfml-system', 'sfml-window'])
101104

102105
graphics = extension(
103106
'graphics',
104-
[sources['graphics'], 'src/sfml/DerivableRenderWindow.cpp', 'src/sfml/DerivableDrawable.cpp', 'src/sfml/NumericObject.cpp'],
107+
['graphics.pyx', 'DerivableRenderWindow.cpp', 'DerivableDrawable.cpp'],
105108
['sfml-system', 'sfml-window', 'sfml-graphics'])
106109

107110
audio = extension(
108111
'audio',
109-
[sources['audio'], 'src/sfml/DerivableSoundRecorder.cpp', 'src/sfml/DerivableSoundStream.cpp'],
112+
['audio.pyx', 'DerivableSoundRecorder.cpp', 'DerivableSoundStream.cpp'],
110113
['sfml-system', 'sfml-audio'])
111114

112115
network = extension(
113116
'network',
114-
[sources['network']],
117+
['network.pyx'],
115118
['sfml-system', 'sfml-network'])
116119

117120
major, minor, _, _ , _ = sys.version_info
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)