1717source_files_directory = Path (__file__ ).resolve ().parent .joinpath ('dxfeed' , 'dxfeed-c-api' , 'src' )
1818source_files_paths = [str (path ) for path in source_files_directory .glob ('*.c' )]
1919libs = list ()
20+ include_dirs = [str (source_files_directory .parent .joinpath ('include' )),
21+ str (source_files_directory )]
22+ ### Build dxfeed c library
23+ dxfeed_c_lib_args = dict ()
2024if platform .system () == 'Windows' :
2125 source_files_paths .remove (str (source_files_directory .joinpath ('Linux.c' )))
22- libs = [ 'ws2_32' ]
26+ libs . append ( 'ws2_32' )
2327else :
2428 source_files_paths .remove (str (source_files_directory .joinpath ('Win32.c' )))
29+ dxfeed_c_lib_args .update ({'sources' : source_files_paths ,
30+ 'include_dirs' : include_dirs })
2531
26- # Separate dxfeed c api library
27- dxfeed_c = ('dxfeed_c' , {'sources' : source_files_paths ,
28- 'libraries' : libs })
32+ if platform .system () == 'Darwin' :
33+ dxfeed_c_lib_args .update ({'macros' : [('MACOSX' , 'TRUE' )]})
2934
30- extensions = [Extension ('dxfeed.core.utils.helpers' , ['dxfeed/core/utils/helpers.' + ext ]),
31- Extension ('dxfeed.core.listeners.listener' , ['dxfeed/core/listeners/listener.' + ext ]),
32- Extension ('dxfeed.core.DXFeedPy' , ['dxfeed/core/DXFeedPy.' + ext_pp ], libraries = libs )]
35+ dxfeed_c = ('dxfeed_c' , dxfeed_c_lib_args )
36+
37+ extensions = [Extension ('dxfeed.core.utils.helpers' , ['dxfeed/core/utils/helpers.' + ext ],
38+ include_dirs = include_dirs ),
39+ Extension ('dxfeed.core.listeners.listener' , ['dxfeed/core/listeners/listener.' + ext ],
40+ include_dirs = include_dirs ),
41+ Extension ('dxfeed.core.DXFeedPy' , ['dxfeed/core/DXFeedPy.' + ext_pp ], libraries = libs ,
42+ include_dirs = include_dirs )]
3343
3444if use_cython :
3545 extensions = cythonize (extensions , language_level = 3 )
@@ -41,8 +51,7 @@ def build(setup_kwargs):
4151 'zip_safe' : False ,
4252 'libraries' : [dxfeed_c ],
4353 'packages' : find_packages (),
44- 'include_dirs' : ['dxfeed/dxfeed-c-api/include' ,
45- 'dxfeed/dxfeed-c-api/src' ],
54+ 'include_dirs' : include_dirs ,
4655 })
4756
4857def build_extensions ():
0 commit comments