fix `Extension` creation without compile_cmd

This commit is contained in:
se-m 2020-01-07 21:24:06 +03:00 committed by Arvid Norberg
parent 549db2beb9
commit 2a15b25ab3
1 changed files with 18 additions and 15 deletions

View File

@ -160,22 +160,25 @@ else:
src_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "src")) src_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "src"))
source_list = [os.path.join(src_dir, s) for s in os.listdir(src_dir) if s.endswith(".cpp")] source_list = [os.path.join(src_dir, s) for s in os.listdir(src_dir) if s.endswith(".cpp")]
if extra_cmd: flags = flags_parser()
flags = flags_parser() ext_extra = {}
# ldflags parsed first to ensure the correct library search path order
extra_link = flags.parse(ldflags)
extra_compile = flags.parse(extra_cmd)
ext = [Extension( if ldflags:
'libtorrent', # ldflags parsed first to ensure the correct library search path order
sources=sorted(source_list), ext_extra["extra_link_args"] = flags.parse(ldflags) + arch()
language='c++',
include_dirs=flags.include_dirs, if extra_cmd:
library_dirs=flags.library_dirs, ext_extra["extra_compile_args"] = flags.parse(extra_cmd) + arch() + target_specific()
extra_link_args=extra_link + arch(),
extra_compile_args=extra_compile + arch() + target_specific(), ext = [Extension(
libraries=['torrent-rasterbar'] + flags.libraries) 'libtorrent',
] sources=sorted(source_list),
language='c++',
include_dirs=flags.include_dirs,
library_dirs=flags.library_dirs,
libraries=['torrent-rasterbar'] + flags.libraries,
**ext_extra)
]
setup( setup(
name='python-libtorrent', name='python-libtorrent',