-
-
Notifications
You must be signed in to change notification settings - Fork 763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve to detect cross-compilation toolchains #780
Labels
Milestone
Comments
This was referenced May 18, 2020
Switch the given toolchain in any platform$ xmake f --toolchain=clang
$ xmake $ xmake f --toolchain=llvm --sdk=/xxx/llvm
$ xmake $ xmake f -p cross --sdk=/xxx/llvm
$ xmake |
Custom toolchain in project xmake.lua-- define toolchain
toolchain("myclang")
-- mark as standalone toolchain
set_kind("standalone")
-- set toolset
set_toolset("cc", "clang")
set_toolset("cxx", "clang", "clang++")
set_toolset("ld", "clang++", "clang")
set_toolset("sh", "clang++", "clang")
set_toolset("ar", "ar")
set_toolset("ex", "ar")
set_toolset("strip", "strip")
set_toolset("mm", "clang")
set_toolset("mxx", "clang", "clang++")
set_toolset("as", "clang")
add_defines("MYCLANG")
-- check toolchain
on_check(function (toolchain)
return import("lib.detect.find_tool")("clang")
end)
-- on load
on_load(function (toolchain)
-- get march
local march = is_arch("x86_64", "x64") and "-m64" or "-m32"
-- init flags for c/c++
toolchain:add("cxflags", march)
toolchain:add("ldflags", march)
toolchain:add("shflags", march)
if not is_plat("windows") and os.isdir("/usr") then
for _, includedir in ipairs({"/usr/local/include", "/usr/include"}) do
if os.isdir(includedir) then
toolchain:add("includedirs", includedir)
end
end
for _, linkdir in ipairs({"/usr/local/lib", "/usr/lib"}) do
if os.isdir(linkdir) then
toolchain:add("linkdirs", linkdir)
end
end
end
-- init flags for objc/c++ (with ldflags and shflags)
toolchain:add("mxflags", march)
-- init flags for asm
toolchain:add("asflags", march)
end) $ xmake f --toolchain=myclang
$ xmake |
Set the different toolchain to the given targettarget("test")
set_toolchains("clang", "yasm")
target("test2")
set_toolset("cc", "clang")
set_toolset("ld", "clang++") |
Closed
GnuGNU Arm Embedded Toolchain xmake f -p cross --sdk=~/files/gcc-arm-none-eabi-9-2019-q4-major/ --toolchain=gnu-rm
xmake |
Show toolchains$ xmake show -l toolchains
xcode Xcode IDE
vs VisualStudio IDE
yasm The Yasm Modular Assembler
clang A C language family frontend for LLVM
go Go Programming Language Compiler
dlang D Programming Language Compiler
sdcc Small Device C Compiler
cuda CUDA Toolkit
ndk Android NDK
rust Rust Programming Language Compiler
llvm A collection of modular and reusable compiler and toolchain technologies
cross Common cross compilation toolchain
nasm NASM Assembler
gcc GNU Compiler Collection
mingw Minimalist GNU for Windows
gnu-rm GNU Arm Embedded Toolchain
envs Environment variables toolchain
fasm Flat Assembler |
Closed
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Roadmap
toolchain("xxx")
scope description备注:重构工具链,实现平台定义和工具链完全分离,提供更好的工具链扩展性,支持对独立工具链完整快速切换,支持对target的单独工具链配置,支持在xmake.lua自定义工具链,内置支持更多常用交叉编译工具链
The text was updated successfully, but these errors were encountered: