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,11 +160,15 @@ 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 = {}
if ldflags:
# ldflags parsed first to ensure the correct library search path order # ldflags parsed first to ensure the correct library search path order
extra_link = flags.parse(ldflags) ext_extra["extra_link_args"] = flags.parse(ldflags) + arch()
extra_compile = flags.parse(extra_cmd)
if extra_cmd:
ext_extra["extra_compile_args"] = flags.parse(extra_cmd) + arch() + target_specific()
ext = [Extension( ext = [Extension(
'libtorrent', 'libtorrent',
@ -172,9 +176,8 @@ else:
language='c++', language='c++',
include_dirs=flags.include_dirs, include_dirs=flags.include_dirs,
library_dirs=flags.library_dirs, library_dirs=flags.library_dirs,
extra_link_args=extra_link + arch(), libraries=['torrent-rasterbar'] + flags.libraries,
extra_compile_args=extra_compile + arch() + target_specific(), **ext_extra)
libraries=['torrent-rasterbar'] + flags.libraries)
] ]
setup( setup(