Commit 57cc7cd2 authored by Karl Kempe's avatar Karl Kempe

Add --src flag to add c/c++ src files (cythonmagic)

parent 3d4f7a19
......@@ -188,6 +188,11 @@ class CythonMagics(Magics):
help="Add a path to the list of include directories (can be specified "
"multiple times)."
)
@magic_arguments.argument(
'-S', '--src', action='append', default=[],
help="Add a path to the list of src files (can be specified "
"multiple times)."
)
@magic_arguments.argument(
'-+', '--cplus', action='store_true', default=False,
help="Output a C++ rather than C file."
......@@ -252,6 +257,7 @@ class CythonMagics(Magics):
if need_cythonize:
c_include_dirs = args.include
c_src_files = map(str, args.src)
if 'numpy' in code:
import numpy
c_include_dirs.append(numpy.get_include())
......@@ -261,7 +267,7 @@ class CythonMagics(Magics):
f.write(code)
extension = Extension(
name = module_name,
sources = [pyx_file],
sources = [pyx_file] + c_src_files,
include_dirs = c_include_dirs,
library_dirs = args.library_dirs,
extra_compile_args = args.compile_args,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment