FrozenGene commented on a change in pull request #4817: [CONTRIB][CC] Enhance 
cc.cross_compiler
URL: https://github.com/apache/incubator-tvm/pull/4817#discussion_r375099901
 
 

 ##########
 File path: python/tvm/contrib/cc.py
 ##########
 @@ -131,14 +116,43 @@ def cross_compiler(compile_func, base_options=None, 
output_format="so", get_targ
     -------
     fcompile : Callable[[str, str, Optional[str]], None]
         A compilation function that can be passed to export_library.
+
+    Examples
+    --------
+    .. code-block:: python
+
+       from tvm.contrib import cc, ndk
+       # export using arm gcc
+       mod = build_runtime_module()
+       mod.export_library(path_dso,
+                          cc.cross_compiler("arm-linux-gnueabihf-gcc"))
+       # specialize ndk compilation options.
+       specialized_ndk = cc.cross_compiler(
+           ndk.create_shared, ["--sysroot=/path/to/sysroot"])
 
 Review comment:
   options should be better changed into ["--sysroot=/path/to/sysroot", 
"-shared", "-fPIC", "-lm"], because when users pass options into ndk, we won't 
append the latter three options so that we won't compile into shared libraries.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to