Skip to content

Commit fa51ea2

Browse files
authored
Put options before objects when compiling (#18656)
This change is part of tile-ai#21. On darwin platform, when trying to compile a `.c` file as objective-c, `-x objective-c++` needs to be prior to source files in command line arguments. Without this PR, it's not straightforward to do so.
1 parent 99c1d92 commit fa51ea2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python/tvm/contrib/cc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,12 @@ def _linux_compile(
348348
if compile_shared or output.endswith(".so") or output.endswith(".dylib"):
349349
cmd += ["-shared"]
350350
cmd += ["-o", output]
351+
if options:
352+
cmd += options
351353
if isinstance(objects, str):
352354
cmd += [objects]
353355
else:
354356
cmd += objects
355-
if options:
356-
cmd += options
357357
env = None
358358
if ccache_env is not None:
359359
if shutil.which("ccache"):

0 commit comments

Comments
 (0)