Skip to content

Commit

Permalink
Add --cplus option for c++.
Browse files Browse the repository at this point in the history
  • Loading branch information
bfroehle committed Aug 3, 2012
1 parent a1daa02 commit 3abe888
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions IPython/extensions/cythonmagic.py
Expand Up @@ -127,6 +127,10 @@ def f(x):
help="Add a path to the list of include directories (can be specified "
"multiple times)."
)
@magic_arguments.argument(
'-+', '--cplus', action='store_true', default=False,
help="Output a C++ rather than C file."
)
@magic_arguments.argument(
'-f', '--force', action='store_true', default=False,
help="Force the compilation of the pyx module even if it hasn't "
Expand Down Expand Up @@ -182,11 +186,16 @@ def f(x):
extra_compile_args = args.compile_args,
extra_link_args = args.link_args,
libraries = args.lib,
language = 'c++' if args.cplus else 'c',
)
build_extension = self._get_build_extension()
try:
build_extension.extensions = cythonize([extension], quiet=quiet,
annotate=args.annotate, force=args.force)
opts = dict(
quiet=quiet,
annotate = args.annotate,
force = args.force,
)
build_extension.extensions = cythonize([extension], **opts)
except CompileError:
return
build_extension.build_temp = os.path.dirname(pyx_file)
Expand Down

0 comments on commit 3abe888

Please sign in to comment.