提交 2ba62640 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Add documentation on the new optional c_compiler parameter.

上级 0681cf5a
......@@ -57,39 +57,63 @@ There are less methods to define for an Op than for a Type:
*Default:* The default behavior is to do nothing.
.. method:: c_headers()
.. method:: c_headers([c_compiler])
Returns a list of headers to include in the file. 'Python.h' is
included by default so you don't need to specify it. Also all
of the header required by the Types involved (inputs and
of the headers required by the Types involved (inputs and
outputs) will also be included.
.. method:: c_header_dirs()
The `c_compiler` [#2v]_ parameter is the C compiler that will
be used to compile the code for the node. You may get multiple
calls with different C compilers.
.. method:: c_header_dirs([c_compiler])
Returns a list of directories to search for headers (arguments
to -I).
.. method:: c_libraries()
The `c_compiler` [#2v]_ parameter is the C compiler that will
be used to compile the code for the node. You may get multiple
calls with different C compilers.
.. method:: c_libraries([c_compiler])
Returns a list of library names that your op needs to link to.
All ops are automatically linked with 'python' and the
libraries their types require. (arguments to -l)
.. method:: c_lib_dirs()
The `c_compiler` [#2v]_ parameter is the C compiler that will
be used to compile the code for the node. You may get multiple
calls with different C compilers.
.. method:: c_lib_dirs([c_compiler])
Returns a list of directory to search for libraries (arguments
to -L).
.. method:: c_compile_args()
The `c_compiler` [#2v]_ parameter is the C compiler that will
be used to compile the code for the node. You may get multiple
calls with different C compilers.
.. method:: c_compile_args([c_compiler])
Allows to specify additional arbitrary arguments to g++. This
is not usually required.
Allows to specify additional arbitrary arguments to the C
compiler. This is not usually required.
.. method:: c_no_compile_args()
The `c_compiler` [#2v]_ parameter is the C compiler that will
be used to compile the code for the node. You may get multiple
calls with different C compilers.
Returns a list of g++ arguments that are forbidden when
.. method:: c_no_compile_args([c_compiler])
Returns a list of C compiler arguments that are forbidden when
compiling this Op.
The `c_compiler` [#2v]_ parameter is the C compiler that will
be used to compile the code for the node. You may get multiple
calls with different C compilers.
.. method:: c_init_code()
Allows you to specify code that will be executed once when the
......@@ -245,6 +269,12 @@ In a nutshell, ``input_names`` and ``output_names`` parameterize the
names of the inputs your operation needs to use and the outputs it
needs to put variables into. But this will be clear with the examples.
.. rubric:: Footnotes
.. [#2v] There are actually two versions of this method one with a
`c_compiler` parameter and one without. The calling code will
try the version with c_compiler and try the version without
if it does not work.
Defining the methods
====================
......
......@@ -78,18 +78,32 @@ the most important ones:
When we are done using the data, clean up whatever we allocated and
decrease the appropriate reference counts.
.. method:: c_headers()
c_libraries()
c_header_dirs()
c_lib_dirs()
.. method:: c_headers([c_compiler])
c_libraries([c_compiler])
c_header_dirs([c_compiler])
c_lib_dirs([c_compiler])
Allows you to specify headers, libraries and associated directories.
.. method:: c_compile_args()
c_no_compile_args()
These methods have two versions, one with a `c_compiler`
argument and one without. The version with c_compiler is tried
first and if it doesn't work, the one without is.
The `c_compiler` argument is the C compiler that will be used
to compile the C code for the node that uses this type.
.. method:: c_compile_args([c_compiler])
c_no_compile_args([c_compiler])
Allows to specify special compiler arguments to add/exclude.
These methods have two versions, one with a `c_compiler`
argument and one without. The version with c_compiler is tried
first and if it doesn't work, the one without is.
The `c_compiler` argument is the C compiler that will be used
to compile the C code for the node that uses this type.
.. method:: c_init_code()
Allows you to specify code that will be executed once when the
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论