[PATCH] D96882: sysroot.py: add support for non-darwin platforms
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 17 10:57:42 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6073f87d7f16: sysroot.py: add support for non-darwin platforms (authored by thakis).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96882/new/
https://reviews.llvm.org/D96882
Files:
llvm/utils/gn/build/BUILD.gn
llvm/utils/sysroot.py
Index: llvm/utils/sysroot.py
===================================================================
--- llvm/utils/sysroot.py
+++ llvm/utils/sysroot.py
@@ -35,13 +35,16 @@
os.path.join(vsinstalldir, 'VC'))
os.mkdir(os.path.join(out_dir, 'Windows Kits'))
mkjunction(os.path.join(out_dir, 'Windows Kits', '10'), winsdk)
+ elif sys.platform == 'darwin':
+ assert False, "FIXME: Implement on darwin"
else:
- assert False, "FIXME: Implement on non-win"
+ os.symlink('/', out_dir)
print('Done.')
+ abs_out_dir = os.path.abspath(out_dir)
if sys.platform == 'win32':
# CMake doesn't like backslashes in commandline args.
- abs_out_dir = os.path.abspath(out_dir).replace(os.path.sep, '/')
+ abs_out_dir = abs_out_dir.replace(os.path.sep, '/')
print('Pass -DLLVM_WINSYSROOT=' + abs_out_dir + ' to cmake.')
else:
print('Pass -DCMAKE_SYSROOT=' + abs_out_dir + ' to cmake.')
Index: llvm/utils/gn/build/BUILD.gn
===================================================================
--- llvm/utils/gn/build/BUILD.gn
+++ llvm/utils/gn/build/BUILD.gn
@@ -285,9 +285,14 @@
}
}
if (sysroot != "") {
- assert(current_os == "win", "FIXME: Make sysroot work on non-win")
- assert(is_clang, "sysroot only works with clang-cl as host compiler")
- cflags += [ "/winsysroot" + rebase_path(sysroot, root_build_dir) ]
+ assert(current_os != "mac" && current_os != "ios",
+ "FIXME: Make sysroot work on darwin")
+ if (current_os == "win") {
+ assert(is_clang, "sysroot only works with clang-cl as host compiler")
+ cflags += [ "/winsysroot" + rebase_path(sysroot, root_build_dir) ]
+ } else {
+ cflags += [ "--sysroot=" + rebase_path(sysroot, root_build_dir) ]
+ }
}
if (use_ubsan) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96882.324358.patch
Type: text/x-patch
Size: 1843 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210217/1e55ea25/attachment.bin>
More information about the llvm-commits
mailing list