| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>xmake</title>
- <link rel="icon" href="/assets/img/favicon.ico">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
- <meta name="description" content="Description">
- <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
- <link href="/assets/npm/github-markdown/github-markdown.min.css" rel="stylesheet">
- <style>
- .markdown-body {
- box-sizing: border-box;
- min-width: 200px;
- max-width: 980px;
- margin: 0 auto;
- padding: 45px;
- }
- @media (max-width: 767px) {
- .markdown-body {
- padding: 15px;
- }
- }
- </style>
- </head>
- <body>
- <article class="markdown-body">
- <h4>This is a mirror page, please see the original page: </h4><a href="https://xmake.io/#/zh-cn/">https://xmake.io/#/zh-cn/</a>
- <div id="wwads-panel" class="wwads-cn wwads-vertical wwads-sticky" data-id="239" style="max-width:180px;bottom:20px;right:20px;width:200px;height:260px;background:#fff;position:fixed"></div>
- </br>
- <script type="text/javascript" charset="UTF-8" src="https://cdn.wwads.cn/js/makemoney.js" async></script>
- <script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?serve=CE7I52QU&placement=xmakeio" id="_carbonads_js"></script>
- <style>
- #carbonads {
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu,
- Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;
- }
- #carbonads {
- display: flex;
- max-width: 330px;
- background-color: hsl(0, 0%, 98%);
- box-shadow: 0 1px 4px 1px hsla(0, 0%, 0%, .1);
- }
- #carbonads a {
- color: inherit;
- text-decoration: none;
- }
- #carbonads a:hover {
- color: inherit;
- }
- #carbonads span {
- position: relative;
- display: block;
- overflow: hidden;
- }
- #carbonads .carbon-wrap {
- display: flex;
- }
- .carbon-img {
- display: block;
- margin: 0;
- line-height: 1;
- }
- .carbon-img img {
- display: block;
- }
- .carbon-text {
- font-size: 13px;
- padding: 10px;
- line-height: 1.5;
- text-align: left;
- }
- .carbon-poweredby {
- display: block;
- padding: 8px 10px;
- background: repeating-linear-gradient(-45deg, transparent, transparent 5px, hsla(0, 0%, 0%, .025) 5px, hsla(0, 0%, 0%, .025) 10px) hsla(203, 11%, 95%, .4);
- text-align: center;
- text-transform: uppercase;
- letter-spacing: .5px;
- font-weight: 600;
- font-size: 9px;
- line-height: 1;
- }
- </style>
- <h2 id="">项目支持</h2>
- <p>通过<a href="https://xmake.io/#/about/sponsor">成为赞助者</a>来支持该项目。您的logo将显示在此处,并带有指向您网站的链接。🙏</p>
- <p><a href="https://opencollective.com/xmake#sponsors" target="_blank"><img src="https://opencollective.com/xmake/sponsors.svg?width=890"></a><br><a href="https://opencollective.com/xmake#backers" target="_blank"><img src="https://opencollective.com/xmake/backers.svg?width=600"></a></p>
- <h2 id="">技术支持</h2>
- <p>你也可以考虑通过 <a href="https://github.com/sponsors/waruqi">Github 的赞助计划</a> 赞助我们来获取额外的技术支持服务,然后你就能获取 <a href="https://github.com/xmake-io/technical-support">xmake-io/technical-support</a> 仓库的访问权限,获取更多技术咨询相关的信息。</p>
- <ul>
- <li>[x] 更高优先级的 Issues 问题处理</li>
- <li>[x] 一对一技术咨询服务</li>
- <li>[x] Review xmake.lua 并提供改进建议</li>
- </ul>
- <h2 id="">简介</h2>
- <p>Xmake 是一个基于 Lua 的轻量级跨平台构建工具。</p>
- <p>它非常的轻量,没有任何依赖,因为它内置了 Lua 运行时。</p>
- <p>它使用 xmake.lua 维护项目构建,相比 makefile/CMakeLists.txt,配置语法更加简洁直观,对新手非常友好,短时间内就能快速入门,能够让用户把更多的精力集中在实际的项目开发上。</p>
- <p>我们能够使用它像 Make/Ninja 那样可以直接编译项目,也可以像 CMake/Meson 那样生成工程文件,另外它还有内置的包管理系统来帮助用户解决 C/C++ 依赖库的集成使用问题。</p>
- <p>目前,Xmake 主要用于 C/C++ 项目的构建,但是同时也支持其他 native 语言的构建,可以实现跟 C/C++ 进行混合编译,同时编译速度也是非常的快,可以跟 Ninja 持平。</p>
- <pre><code>Xmake = Build backend + Project Generator + Package Manager + [Remote|Distributed] Build + Cache
- </code></pre><p>尽管不是很准确,但我们还是可以把 Xmake 按下面的方式来理解:</p>
- <pre><code>Xmake ≈ Make/Ninja + CMake/Meson + Vcpkg/Conan + distcc + ccache/sccache
- </code></pre><p>如果你想要了解更多,请参考:<a href="https://xmake.io/#/zh-cn/getting_started">在线文档</a>, <a href="https://github.com/xmake-io/xmake">Github</a>以及<a href="https://gitee.com/tboox/xmake">Gitee</a>,同时也欢迎加入我们的 <a href="https://xmake.io/#/zh-ch/about/contact">社区</a>.</p>
- <h2 id="">课程</h2>
- <p>xmake 官方也推出了一些入门课程,带你一步步快速上手 xmake,课程列表如下:</p>
- <ul>
- <li><a href="https://xmake.io/#/zh-cn/about/course">Xmake 带你轻松构建 C/C++ 项目</a></li>
- </ul>
- <h2 id="">安装</h2>
- <h4 id="curl">使用curl</h4>
- <pre><code class="lang-bash">curl -fsSL https://xmake.io/shget.text | bash
- </code></pre>
- <h4 id="wget">使用wget</h4>
- <pre><code class="lang-bash">wget https://xmake.io/shget.text -O - | bash
- </code></pre>
- <h4 id="powershell">使用powershell</h4>
- <pre><code class="lang-powershell">Invoke-Expression (Invoke-Webrequest 'https://xmake.io/psget.text' -UseBasicParsing).Content
- </code></pre>
- <h4 id="">其他安装方式</h4>
- <p>如果不想使用脚本安装,也可以点击查看 <a href="https://xmake.io/#/zh-cn/guide/installation">安装文档</a>,了解其他安装方法。</p>
- <h2 id="">简单的工程描述</h2>
- <p><img src="https://xmake.io/assets/img/index/showcode1.png" width="340px" /></p>
- <h2 id="">包依赖描述</h2>
- <p><img src="https://xmake.io/assets/img/index/add_require.png" width="600px" /></p>
- <p>官方的xmake包管理仓库: <a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a></p>
- <h2 id="">构建工程</h2>
- <pre><code class="lang-bash">$ xmake
- </code></pre>
- <h2 id="">运行目标</h2>
- <pre><code class="lang-bash">$ xmake run console
- </code></pre>
- <h2 id="">调试程序</h2>
- <pre><code class="lang-bash">$ xmake run -d console
- </code></pre>
- <h2 id="">配置平台</h2>
- <pre><code class="lang-bash">$ xmake f -p [windows|linux|macosx|android|iphoneos ..] -a [x86|arm64 ..] -m [debug|release]
- $ xmake
- </code></pre>
- <h2 id="">图形化菜单配置</h2>
- <pre><code class="lang-bash">$ xmake f --menu
- </code></pre>
- <p><img src="https://xmake.io/assets/img/index/menuconf.png" width="650px" /></p>
- <h2 id="ninja">跟ninja一样快的构建速度</h2>
- <p>测试工程: <a href="https://github.com/xmake-io/xmake/tree/master/core">xmake-core</a></p>
- <h3 id="">多任务并行编译测试</h3>
- <table>
- <thead>
- <tr>
- <th>构建系统</th>
- <th>Termux (8core/-j12)</th>
- <th>构建系统</th>
- <th>MacOS (8core/-j12)</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>xmake</td>
- <td>24.890s</td>
- <td>xmake</td>
- <td>12.264s</td>
- </tr>
- <tr>
- <td>ninja</td>
- <td>25.682s</td>
- <td>ninja</td>
- <td>11.327s</td>
- </tr>
- <tr>
- <td>cmake(gen+make)</td>
- <td>5.416s+28.473s</td>
- <td>cmake(gen+make)</td>
- <td>1.203s+14.030s</td>
- </tr>
- <tr>
- <td>cmake(gen+ninja)</td>
- <td>4.458s+24.842s</td>
- <td>cmake(gen+ninja)</td>
- <td>0.988s+11.644s</td>
- </tr>
- </tbody>
- </table>
- <h3 id="">单任务编译测试</h3>
- <table>
- <thead>
- <tr>
- <th>构建系统</th>
- <th>Termux (-j1)</th>
- <th>构建系统</th>
- <th>MacOS (-j1)</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>xmake</td>
- <td>1m57.707s</td>
- <td>xmake</td>
- <td>39.937s</td>
- </tr>
- <tr>
- <td>ninja</td>
- <td>1m52.845s</td>
- <td>ninja</td>
- <td>38.995s</td>
- </tr>
- <tr>
- <td>cmake(gen+make)</td>
- <td>5.416s+2m10.539s</td>
- <td>cmake(gen+make)</td>
- <td>1.203s+41.737s</td>
- </tr>
- <tr>
- <td>cmake(gen+ninja)</td>
- <td>4.458s+1m54.868s</td>
- <td>cmake(gen+ninja)</td>
- <td>0.988s+38.022s</td>
- </tr>
- </tbody>
- </table>
- <h2 id="">包依赖管理</h2>
- <h3 id="">下载和编译</h3>
- <p><img src="https://xmake.io/assets/img/index/package_manage.png" width="650px" /></p>
- <h3 id="">架构和流程</h3>
- <p><img src="https://xmake.io/assets/img/index/package_arch.png" width="650px" /></p>
- <h3 id="">支持的包管理仓库</h3>
- <ul>
- <li>官方自建仓库 <a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a> (tbox >1.6.1)</li>
- <li>官方包管理器 <a href="https://github.com/xmake-io/xrepo">Xrepo</a></li>
- <li><a href="https://xmake.io/#/zh-cn/package/remote_package?id=%e4%bd%bf%e7%94%a8%e8%87%aa%e5%bb%ba%e7%a7%81%e6%9c%89%e5%8c%85%e4%bb%93%e5%ba%93">用户自建仓库</a></li>
- <li>Conan (conan::openssl/1.1.1g)</li>
- <li>Conda (conda::libpng 1.3.67)</li>
- <li>Vcpkg (vcpkg::ffmpeg)</li>
- <li>Homebrew/Linuxbrew (brew::pcre2/libpcre2-8)</li>
- <li>Pacman on archlinux/msys2 (pacman::libcurl)</li>
- <li>Apt on ubuntu/debian (apt::zlib1g-dev)</li>
- <li>Clib (clib::<a href="mailto:clibs/[email protected]">clibs/[email protected]</a>)</li>
- <li>Dub (dub::log 0.4.3)</li>
- <li>Portage on Gentoo/Linux (portage::libhandy)</li>
- <li>Nimble for nimlang (nimble::zip >1.3)</li>
- <li>Cargo for rust (cargo::base64 0.13.0)</li>
- </ul>
- <h3 id="">包管理特性</h3>
- <ul>
- <li>官方仓库提供近 500+ 常用包,真正做到全平台一键下载集成编译</li>
- <li>全平台包支持,支持交叉编译的依赖包集成</li>
- <li>支持包虚拟环境管理和加载,<code>xrepo env shell</code></li>
- <li>Windows 云端预编译包加速</li>
- <li>支持自建包仓库,私有仓库部署</li>
- <li>第三方包仓库支持,提供更加丰富的包源,例如:vcpkg, conan, conda 等等</li>
- <li>支持自动拉取使用云端工具链</li>
- <li>支持包依赖锁定</li>
- </ul>
- <h2 id="">支持平台</h2>
- <ul>
- <li>Windows (x86, x64)</li>
- <li>macOS (i386, x86_64, arm64)</li>
- <li>Linux (i386, x86_64, cross-toolchains ..)</li>
- <li>*BSD (i386, x86_64)</li>
- <li>Android (x86, x86_64, armeabi, armeabi-v7a, arm64-v8a)</li>
- <li>iOS (armv7, armv7s, arm64, i386, x86_64)</li>
- <li>WatchOS (armv7k, i386)</li>
- <li>AppleTVOS (armv7, arm64, i386, x86_64)</li>
- <li>MSYS (i386, x86_64)</li>
- <li>MinGW (i386, x86_64, arm, arm64)</li>
- <li>Cygwin (i386, x86_64)</li>
- <li>Wasm (wasm32)</li>
- <li>Cross (cross-toolchains ..)</li>
- </ul>
- <h2 id="">支持工具链</h2>
- <pre><code class="lang-bash">$ xmake show -l toolchains
- xcode Xcode IDE
- msvc Microsoft Visual C/C++ Compiler
- yasm The Yasm Modular Assembler
- clang A C language family frontend for LLVM
- go Go Programming Language Compiler
- dlang D Programming Language Compiler
- gfortran GNU Fortran Programming Language Compiler
- zig Zig Programming Language Compiler
- sdcc Small Device C Compiler
- cuda CUDA Toolkit (nvcc, nvc, nvc++, nvfortran)
- ndk Android NDK
- rust Rust Programming Language Compiler
- swift Swift 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
- tinycc Tiny C Compiler
- emcc A toolchain for compiling to asm.js and WebAssembly
- icc Intel C/C++ Compiler
- ifort Intel Fortran Compiler
- muslcc The musl-based cross-compilation toolchain
- fpc Free Pascal Programming Language Compiler
- wasi WASI-enabled WebAssembly C/C++ toolchain
- nim Nim Programming Language Compiler
- circle A new C++20 compiler
- armcc ARM Compiler Version 5 of Keil MDK
- armclang ARM Compiler Version 6 of Keil MDK
- c51 Keil development tools for the 8051 Microcontroller Architecture
- </code></pre>
- <h2 id="">支持语言</h2>
- <ul>
- <li>C/C++</li>
- <li>Objc/Objc++</li>
- <li>Swift</li>
- <li>Assembly</li>
- <li>Golang</li>
- <li>Rust</li>
- <li>Dlang</li>
- <li>Fortran</li>
- <li>Cuda</li>
- <li>Zig</li>
- <li>Vala</li>
- <li>Pascal</li>
- <li>Nim</li>
- </ul>
- <h2 id="">支持特性</h2>
- <ul>
- <li>语法简单易上手</li>
- <li>快速安装,无任何依赖</li>
- <li>全平台一键编译</li>
- <li>支持交叉编译,智能分析交叉工具链信息</li>
- <li>极速,多任务并行编译支持</li>
- <li>C++20 Module 支持</li>
- <li>支持跨平台的 C/C++ 依赖包快速集成,内置包管理器</li>
- <li>多语言混合编译支持</li>
- <li>丰富的插件支持,提供各种工程生成器,例如:vs/makefile/cmakelists/compile_commands 生成插件</li>
- <li>REPL 交互式执行支持</li>
- <li>增量编译支持,头文件依赖自动分析</li>
- <li>工具链的快速切换、定制化支持</li>
- <li>丰富的扩展模块支持</li>
- <li>远程编译支持</li>
- <li>分布式编译支持</li>
- <li>内置的本地和远程编译缓存支持</li>
- </ul>
- <h2 id="">工程类型</h2>
- <ul>
- <li>静态库程序</li>
- <li>动态库类型</li>
- <li>控制台程序</li>
- <li>Cuda 程序</li>
- <li>Qt 应用程序</li>
- <li>WDK Windows 驱动程序</li>
- <li>WinSDK 应用程序</li>
- <li>MFC 应用程序</li>
- <li>iOS/MacOS 应用程序(支持.metal)</li>
- <li>Framework和Bundle程序(iOS/MacOS)</li>
- <li>SWIG 模块 (Lua, python, ...)</li>
- <li>Luarocks 模块</li>
- <li>Protobuf 程序</li>
- <li>Lex/yacc 程序</li>
- <li>C++20 模块</li>
- <li>Linux 内核驱动模块</li>
- </ul>
- <h2 id="">分布式编译</h2>
- <ul>
- <li>[x] 跨平台支持</li>
- <li>[x] 支持 msvc, clang, gcc 和交叉编译工具链</li>
- <li>[x] 支持构建 android, ios, linux, win, macOS 程序</li>
- <li>[x] 除了编译工具链,无任何其他依赖</li>
- <li>[x] 支持编译服务器负载均衡调度</li>
- <li>[x] 支持大文件实时压缩传输 (lz4)</li>
- <li>[x] 几乎零配置成本,无需共享文件系统,更加方便和安全</li>
- </ul>
- <p>更多详情见:<a href="https://github.com/xmake-io/xmake/issues/274">#274</a></p>
- <h2 id="">远程编译</h2>
- <p>更多详情见:<a href="https://github.com/xmake-io/xmake/issues/622">#622</a></p>
- <h2 id="">本地和远程编译缓存</h2>
- <p>更多详情见: <a href="https://github.com/xmake-io/xmake/issues/2371">#622</a></p>
- <h2 id="">更多例子</h2>
- <h4 id="debugrelease">Debug 和 Release模式</h4>
- <pre><code class="lang-lua">add_rules("mode.debug", "mode.release")
- target("console")
- set_kind("binary")
- add_files("src/*.c")
- if is_mode("debug") then
- add_defines("DEBUG")
- end
- </code></pre>
- <h4 id="">自定义脚本</h4>
- <pre><code class="lang-lua">target("test")
- set_kind("binary")
- add_files("src/*.c")
- after_build(function (target)
- print("hello: %s", target:name())
- os.exec("echo %s", target:targetfile())
- end)
- </code></pre>
- <h4 id="">依赖包自动集成</h4>
- <p>下载和使用在 <a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a> 和第三方包仓库的依赖包:</p>
- <pre><code class="lang-lua">add_requires("tbox >1.6.1", "libuv master", "vcpkg::ffmpeg", "brew::pcre2/libpcre2-8")
- add_requires("conan::openssl/1.1.1g", {alias = "openssl", optional = true, debug = true})
- target("test")
- set_kind("binary")
- add_files("src/*.c")
- add_packages("tbox", "libuv", "vcpkg::ffmpeg", "brew::pcre2/libpcre2-8", "openssl")
- </code></pre>
- <p>另外,我们也可以使用 <a href="https://github.com/xmake-io/xrepo">xrepo</a> 命令来快速安装依赖包。</p>
- <h4 id="qtquickapp">Qt QuickApp 应用程序</h4>
- <pre><code class="lang-lua">target("test")
- add_rules("qt.quickapp")
- add_files("src/*.cpp")
- add_files("src/qml.qrc")
- </code></pre>
- <h4 id="cuda">Cuda 程序</h4>
- <pre><code class="lang-lua">target("test")
- set_kind("binary")
- add_files("src/*.cu")
- add_cugencodes("native")
- add_cugencodes("compute_35")
- </code></pre>
- <h4 id="wdkumdf">WDK/UMDF 驱动程序</h4>
- <pre><code class="lang-lua">target("echo")
- add_rules("wdk.driver", "wdk.env.umdf")
- add_files("driver/*.c")
- add_files("driver/*.inx")
- add_includedirs("exe")
- target("app")
- add_rules("wdk.binary", "wdk.env.umdf")
- add_files("exe/*.cpp")
- </code></pre>
- <p>更多WDK驱动程序例子(umdf/kmdf/wdm),见:<a href="https://xmake.io/#/zh-cn/guide/project_examples?id=wdk%e9%a9%b1%e5%8a%a8%e7%a8%8b%e5%ba%8f">WDK工程例子</a></p>
- <h4 id="iosmacos">iOS/MacOS 应用程序</h4>
- <pre><code class="lang-lua">target("test")
- add_rules("xcode.application")
- add_files("src/*.m", "src/**.storyboard", "src/*.xcassets")
- add_files("src/Info.plist")
- </code></pre>
- <h4 id="frameworkbundleiosmacos">Framework 和 Bundle 程序(iOS/MacOS)</h4>
- <pre><code class="lang-lua">target("test")
- add_rules("xcode.framework") -- 或者 xcode.bundle
- add_files("src/*.m")
- add_files("src/Info.plist")
- </code></pre>
- <h4 id="openmp">OpenMP 程序</h4>
- <pre><code class="lang-lua">add_requires("libomp", {optional = true})
- target("loop")
- set_kind("binary")
- add_files("src/*.cpp")
- add_rules("c++.openmp")
- add_packages("libomp")
- </code></pre>
- <h4 id="zig">Zig 程序</h4>
- <pre><code class="lang-lua">target("test")
- set_kind("binary")
- add_files("src/main.zig")
- </code></pre>
- <h3 id="">自动拉取远程工具链</h3>
- <h4 id="llvm">拉取指定版本的 llvm 工具链</h4>
- <p>我们使用 llvm-10 中的 clang 来编译项目。</p>
- <pre><code class="lang-lua">add_requires("llvm 10.x", {alias = "llvm-10"})
- target("test")
- set_kind("binary")
- add_files("src/*.c)
- set_toolchains("llvm@llvm-10")
- `
- </code></pre>
- <h4 id="">拉取交叉编译工具链</h4>
- <p>我们也可以拉取指定的交叉编译工具链来编译项目。</p>
- <pre><code class="lang-lua">add_requires("muslcc")
- target("test")
- set_kind("binary")
- add_files("src/*.c)
- set_toolchains("@muslcc")
- </code></pre>
- <h4 id="">拉取工具链并且集成对应工具链编译的依赖包</h4>
- <p>我们也可以使用指定的muslcc交叉编译工具链去编译和集成所有的依赖包。</p>
- <pre><code class="lang-lua">add_requires("muslcc")
- add_requires("zlib", "libogg", {system = false})
- set_toolchains("@muslcc")
- target("test")
- set_kind("binary")
- add_files("src/*.c")
- add_packages("zlib", "libogg")
- </code></pre>
- <h2 id="">插件</h2>
- <h4 id="idemakefilevs2002vs2022">生成IDE工程文件插件(makefile, vs2002 - vs2022, ...)</h4>
- <pre><code class="lang-bash">$ xmake project -k vsxmake -m "debug,release" # 新版vs工程生成插件(推荐)
- $ xmake project -k vs -m "debug,release"
- $ xmake project -k cmake
- $ xmake project -k ninja
- $ xmake project -k compile_commands
- </code></pre>
- <h4 id="lua">加载自定义lua脚本插件</h4>
- <pre><code class="lang-bash">$ xmake l ./test.lua
- $ xmake l -c "print('hello xmake!')"
- $ xmake l lib.detect.find_tool gcc
- $ xmake l
- > print("hello xmake!")
- > {1, 2, 3}
- < {
- 1,
- 2,
- 3
- }
- </code></pre>
- <p>更多内置插件见相关文档:<a href="https://xmake.io/#/zh-cn/plugin/builtin_plugins">内置插件文档</a></p>
- <p>其他扩展插件,请到插件仓库进行下载安装: <a href="https://github.com/xmake-io/xmake-plugins">xmake-plugins</a>.</p>
- <h2 id="ide">IDE和编辑器插件</h2>
- <ul>
- <li><a href="https://github.com/xmake-io/xmake-vscode">xmake-vscode</a></li>
- </ul>
- <p><img src="https://raw.githubusercontent.com/xmake-io/xmake-vscode/master/res/problem.gif" width="650px" /></p>
- <ul>
- <li><a href="https://github.com/xmake-io/xmake-sublime">xmake-sublime</a></li>
- </ul>
- <p><img src="https://raw.githubusercontent.com/xmake-io/xmake-sublime/master/res/problem.gif" width="650px" /></p>
- <ul>
- <li><a href="https://github.com/xmake-io/xmake-idea">xmake-idea</a></li>
- </ul>
- <p><img src="https://raw.githubusercontent.com/xmake-io/xmake-idea/master/res/problem.gif" width="650px" /></p>
- <ul>
- <li><a href="https://github.com/Mythos-404/xmake.nvim">xmake.nvim</a> (第三方开发, 感谢<a href="https://github.com/Mythos-404">@Mythos_404</a>)</li>
- </ul>
- <p><img src="https://raw.githubusercontent.com/Mythos-404/xmake.nvim/main/assets/XmakePreview.gif" width="650px" /></p>
- <ul>
- <li><p><a href="https://github.com/luzhlon/xmake.vim">xmake.vim</a> (third-party, thanks <a href="https://github.com/luzhlon">@luzhlon</a>)</p>
- </li>
- <li><p><a href="https://github.com/HelloWorld886/xmake-visualstudio">xmake-visualstudio</a> (third-party, thanks <a href="https://github.com/HelloWorld886">@HelloWorld886</a>)</p>
- </li>
- <li><p><a href="https://github.com/Arthapz/xmake-project-manager">xmake-qtcreator</a> (third-party, thanks <a href="https://github.com/Arthapz">@Arthapz</a>)</p>
- </li>
- </ul>
- <h3 id="xmakegradlejni">XMake Gradle插件 (JNI)</h3>
- <p>我们也可以在Gradle中使用<a href="https://github.com/xmake-io/xmake-gradle">xmake-gradle</a>插件来集成编译JNI库</p>
- <pre><code>plugins {
- id 'org.tboox.gradle-xmake-plugin' version '1.1.5'
- }
- android {
- externalNativeBuild {
- xmake {
- path "jni/xmake.lua"
- }
- }
- }
- </code></pre><p>当<code>gradle-xmake-plugin</code>插件被应用生效后,<code>xmakeBuild</code>任务会自动注入到现有的<code>assemble</code>任务中去,自动执行jni库编译和集成。</p>
- <pre><code class="lang-console">$ ./gradlew app:assembleDebug
- > Task :nativelib:xmakeConfigureForArm64
- > Task :nativelib:xmakeBuildForArm64
- >> xmake build
- [ 50%]: cache compiling.debug nativelib.cc
- [ 75%]: linking.debug libnativelib.so
- [100%]: build ok!
- >> install artifacts to /Users/ruki/projects/personal/xmake-gradle/nativelib/libs/arm64-v8a
- > Task :nativelib:xmakeConfigureForArmv7
- > Task :nativelib:xmakeBuildForArmv7
- >> xmake build
- [ 50%]: cache compiling.debug nativelib.cc
- [ 75%]: linking.debug libnativelib.so
- [100%]: build ok!
- >> install artifacts to /Users/ruki/projects/personal/xmake-gradle/nativelib/libs/armeabi-v7a
- > Task :nativelib:preBuild
- > Task :nativelib:assemble
- > Task :app:assembleDebug
- </code></pre>
- <h2 id="ci">CI 集成</h2>
- <h3 id="githubaction">GitHub Action</h3>
- <p>我们可以使用 <a href="https://github.com/xmake-io/github-action-setup-xmake">github-action-setup-xmake</a> 在 Github Action 上实现跨平台安装集成 Xmake。</p>
- <pre><code>uses: xmake-io/github-action-setup-xmake@v1
- with:
- xmake-version: latest
- </code></pre><h2 id="xmake">谁在使用 Xmake?</h2>
- <p>请点击 <a href="https://xmake.io/#/zh-cn/about/who_is_using_xmake">用户列表</a> 查看完整用户使用列表。</p>
- <p>如果您在使用 xmake,也欢迎通过 PR 将信息提交至上面的列表,让更多的用户了解有多少用户在使用 xmake,也能让用户更加安心使用 xmake。</p>
- <p>我们也会有更多的动力去持续投入,让 xmake 项目和社区更加繁荣。</p>
- <h2 id="">联系方式</h2>
- <ul>
- <li>邮箱:<a href="mailto:[email protected]">[email protected]</a></li>
- <li>主页:<a href="https://xmake.io/#/zh-cn/">xmake.io</a></li>
- <li>社区<ul>
- <li><a href="https://www.reddit.com/r/xmake/">Reddit论坛</a></li>
- <li><a href="https://t.me/tbooxorg">Telegram群组</a></li>
- <li><a href="https://discord.gg/xmake">Discord聊天室</a></li>
- <li>QQ群:343118190, 662147501</li>
- </ul>
- </li>
- <li>源码:<a href="https://github.com/xmake-io/xmake">Github</a>, <a href="https://gitee.com/tboox/xmake">Gitee</a></li>
- <li>微信公众号:tboox-os</li>
- </ul>
- <h2 id="">感谢</h2>
- <p>感谢所有对xmake有所<a href="CONTRIBUTING.md">贡献</a>的人:<br><a href="https://github.com/xmake-io/xmake/graphs/contributors"><img src="https://opencollective.com/xmake/contributors.svg?width=890&button=false" /></a></p>
- <ul>
- <li><a href="https://github.com/TitanSnow">TitanSnow</a>: 提供xmake <a href="https://github.com/TitanSnow/ts-xmake-logo">logo</a> 和安装脚本。</li>
- <li><a href="https://github.com/uael">uael</a>: 提供语义版本跨平台c库 <a href="https://github.com/uael/sv">sv</a>。</li>
- <li><a href="https://github.com/OpportunityLiu">OpportunityLiu</a>: 改进cuda构建, tests框架和ci。</li>
- <li><a href="https://github.com/xq114">xq144</a>: 改进 <code>xrepo env shell</code>,并贡献大量包到 <a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a> 仓库。</li>
- </ul>
- </article>
- </body>
- </html>
|