| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643 |
- <!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/#/">https://xmake.io/#/</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="supportthisproject">Support this project</h2>
- <p>Support this project by <a href="https://xmake.io/#/about/sponsor">becoming a sponsor</a>. Your logo will show up here with a link to your website. 🙏</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=890"></a></p>
- <h2 id="technicalsupport">Technical support</h2>
- <p>You can also consider sponsoring us to get extra technical support services via the <a href="https://github.com/sponsors/waruqi">Github sponsor program</a>. If you do, you can get access to the <a href="https://github.com/xmake-io/technical-support">xmake-io/technical-support</a> repository, which has the following bennefits:</p>
- <ul>
- <li>[X] Handling Issues with higher priority</li>
- <li>[X] One-to-one technical consulting service</li>
- <li>[X] Review your xmake.lua and provide suggestions for improvement</li>
- </ul>
- <h2 id="introduction">Introduction</h2>
- <p>What is Xmake?</p>
- <ol>
- <li>Xmake is a cross-platform build utility based on the Lua scripting language.</li>
- <li>Xmake is very lightweight and has no dependencies outside of the standard library.</li>
- <li>Uses the <code>xmake.lua</code> file to maintain project builds with a simple and readable syntax.</li>
- </ol>
- <p>Xmake can be used to directly build source code (like with Make or Ninja), or it can generate project source files like CMake or Meson. It also has a <em>built-in</em> package management system to help users integrate C/C++ dependencies.</p>
- <pre><code>Xmake = Build backend + Project Generator + Package Manager + [Remote|Distributed] Build + Cache
- </code></pre><p>Although less precise, one can still understand Xmake in the following way:</p>
- <pre><code>Xmake ≈ Make/Ninja + CMake/Meson + Vcpkg/Conan + distcc + ccache/sccache
- </code></pre><p>If you want to know more, please refer to: the <a href="https://xmake.io/#/getting_started">Documentation</a>, <a href="https://github.com/xmake-io/xmake">GitHub</a> or <a href="https://gitee.com/tboox/xmake">Gitee</a>. You are also welcome to join our <a href="https://xmake.io/#/about/contact">community</a>.</p>
- <p>The official Xmake repository can be found at <a href="https://github.com/xmake-io/xmake-repo">xmake-io/xmake-repo</a>.</p>
- <h2 id="installation">Installation</h2>
- <h3 id="withcurl">With cURL</h3>
- <pre><code class="lang-bash">curl -fsSL https://xmake.io/shget.text | bash
- </code></pre>
- <h3 id="withwget">With Wget</h3>
- <pre><code class="lang-bash">wget https://xmake.io/shget.text -O - | bash
- </code></pre>
- <h3 id="withpowershell">With PowerShell</h3>
- <pre><code class="lang-sh">Invoke-Expression (Invoke-Webrequest 'https://xmake.io/psget.text' -UseBasicParsing).Content
- </code></pre>
- <h3 id="otherinstallationmethods">Other installation methods</h3>
- <p>If you don't want to use the above scripts to install Xmake, visit the <a href="https://xmake.io/#/guide/installation">Installation Guide</a> for other installation methods (building from source, package managers, etc.).</p>
- <h2 id="simpleprojectdescription">Simple Project Description</h2>
- <pre><code class="lang-lua">target("console")
- set_kind("binary")
- add_files("src/*.c")
- </code></pre>
- <p>Creates a new target <code>console</code> of kind <code>binary</code>, and adds all the files ending in <code>.c</code> in the <code>src</code> directory.</p>
- <h2 id="packagedependences">Package dependences</h2>
- <pre><code class="lang-lua">add_requires("tbox 1.6.*", "zlib", "libpng ~1.6")
- </code></pre>
- <p>Adds a requirement of tbox v1.6, zlib (any version), and libpng v1.6.</p>
- <p>The official xmake package repository exists at: <a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a></p>
- <p><p align="center"><br><img src="https://github.com/xmake-io/xmake-docs/raw/master/assets/img/index/package.gif" width="650px" /><br></p>
- </p>
- <h2 id="commandlineinterfacereference">Commandline interface reference</h2>
- <p>The below assumes you are currently in the project's root directory.</p>
- <h3 id="buildaproject">Build a project</h3>
- <pre><code class="lang-bash">$ xmake
- </code></pre>
- <h3 id="runtarget">Run target</h3>
- <pre><code class="lang-bash">$ xmake run console
- </code></pre>
- <h3 id="debugtarget">Debug target</h3>
- <pre><code class="lang-bash">$ xmake run -d console
- </code></pre>
- <h3 id="configureplatform">Configure platform</h3>
- <pre><code class="lang-bash">$ xmake f -p [windows|linux|macosx|android|iphoneos ..] -a [x86|arm64 ..] -m [debug|release]
- $ xmake
- </code></pre>
- <h3 id="menuconfiguration">Menu configuration</h3>
- <pre><code class="lang-bash">$ xmake f --menu
- </code></pre>
- <p><p align="center"><br><img src="https://xmake.io/assets/img/index/menuconf.png" width="650px"/><br></p>
- </p>
- <h2 id="supportedplatforms">Supported platforms</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="supportedtoolchains">Supported toolchains</h2>
- <h3 id="idetied">IDE-Tied</h3>
- <ul>
- <li>Xcode</li>
- <li>MSVC (Microsoft Visual C compiler)</li>
- <li>Android NDK</li>
- </ul>
- <h3 id="languages">Languages</h3>
- <ul>
- <li>Zig</li>
- <li>Go(lang)</li>
- <li>Swift</li>
- <li>Nim</li>
- <li>Rust</li>
- <li>GCC (GNU Compiler Collection)</li>
- <li>Clang</li>
- <li>TinyCC</li>
- <li>icc (Intel C Compiler)</li>
- <li>icpc (Intel C++ Compiler)</li>
- <li>icx (Intel LLVM C/C++ Compiler)</li>
- <li>Clang-CL (Clang Compatability with MSVC)</li>
- <li>DPC++ (Intel LLVM C++ Compiler using SYCL)</li>
- <li>MinGW (GNU for Windows)</li>
- <li>C51 (Keil C Compiler for the 8051)</li>
- <li>GNU-RM (GNU Arm Embedded Toolchain)</li>
- <li>ArmCC (Keil C Compiler for Keil MKD Version 5)</li>
- <li>Circle (New C++20 compiler)</li>
- <li>WASI (C/C++ WebAssembly Toolchain)</li>
- <li>ArmClang (Version 6 of the Keil MDK)</li>
- <li>SDCC (Small Device C Compiler)</li>
- <li>GDC (GNU D Compiler)</li>
- <li>LDC (LLVM D Compiler)</li>
- <li>DMD (Dlang)</li>
- <li>FPC (Free Pascal Programming Language Compiler)</li>
- <li>GFortran (GNU Fortran Compiler)</li>
- <li>Ifort (Intel Fortran Compiler)</li>
- <li>CUDA (nvcc, nvc, nvc++, nvfortran)</li>
- <li>Emscripten</li>
- <li>LLVM</li>
- <li>Icarus Verilog</li>
- <li>Verilator (SystemVerilog simulator and lint system)</li>
- </ul>
- <h3 id="assemblers">Assemblers</h3>
- <ul>
- <li>FASM</li>
- <li>NASM</li>
- <li>YASM</li>
- <li>MASM32 (Microsoft Macro Assembler 32-bit SDK)</li>
- </ul>
- <h2 id="supportedlanguages">Supported languages</h2>
- <ul>
- <li>C, C++ (including cpp2)</li>
- <li>Objective-C and Objective-C++</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>
- <li>Verilog</li>
- <li>FASM</li>
- <li>NASM</li>
- <li>YASM</li>
- <li>MASM32</li>
- </ul>
- <h2 id="features">Features</h2>
- <p>Xmake exhibits:</p>
- <ul>
- <li>Simple yet flexible configuration grammar.</li>
- <li>Quick, dependency-free installation.</li>
- <li>Easy compilation for most all supported platforms.</li>
- <li>Supports cross-compilation with intelligent analysis of cross toolchain information.</li>
- <li>Extremely fast parallel compilation support.</li>
- <li>Supports C++ modules (new in C++20).</li>
- <li>Supports cross-platform C/C++ dependencies with built-in package manager.</li>
- <li>Multi-language compilation support including mixed-language projects.</li>
- <li>Rich plug-in support with various project generators (ex. Visual Studio/Makefiles/CMake/<code>compile_commands.json</code>)</li>
- <li>REPL interactive execution support</li>
- <li>Incremental compilation support with automatic analysis of header files</li>
- <li>Built-in toolchain management</li>
- <li>A large number of expansion modules</li>
- <li>Remote compilation support</li>
- <li>Distributed compilation support</li>
- <li>Local and remote build cache support</li>
- </ul>
- <h2 id="supportedprojecttypes">Supported Project Types</h2>
- <p>Xmake supports the below types of projects:</p>
- <ul>
- <li>Static libraries</li>
- <li>Shared libraries</li>
- <li>Console/CLI applications</li>
- <li>CUDA programs</li>
- <li>Qt applications</li>
- <li>WDK drivers (umdf/kmdf/wdm)</li>
- <li>WinSDK applications</li>
- <li>MFC applications</li>
- <li>Darwin applications (with metal support)</li>
- <li>Frameworks and bundles (in Darwin)</li>
- <li>SWIG modules (Lua, Python, ...)</li>
- <li>LuaRocks modules</li>
- <li>Protobuf programs</li>
- <li>Lex/Yacc programs</li>
- <li>Linux kernel modules</li>
- </ul>
- <h2 id="packagemanagement">Package management</h2>
- <h3 id="downloadandbuild">Download and build</h3>
- <p>Xmake can automatically fetch and install dependencies!</p>
- <p><p align="center"><br><img src="https://xmake.io/assets/img/index/package_manage.png" width="650px" /><br></p>
- </p>
- <h3 id="supportedpackagerepositories">Supported package repositories</h3>
- <ul>
- <li>Official package repository <a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a> (tbox >1.6.1)</li>
- <li>Official package manager <a href="https://github.com/xmake-io/xrepo">Xrepo</a></li>
- <li><a href="https://xmake.io/#/package/remote_package?id=using-self-built-private-package-repository">User-built repositories</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="packagemanagementfeatures">Package management features</h3>
- <ul>
- <li>The official repository provides nearly 500+ packages with simple compilation on all supported platforms</li>
- <li>Full platform package support, support for cross-compiled dependent packages</li>
- <li>Support package virtual environment using <code>xrepo env shell</code></li>
- <li>Precompiled package acceleration for Windows (NT)</li>
- <li>Support self-built package repositories and private repository deployment</li>
- <li>Third-party package repository support for repositories such as: vcpkg, conan, conda, etc.</li>
- <li>Supports automatic pulling of remote toolchains</li>
- <li>Supports dependency version locking</li>
- </ul>
- <h2 id="processingarchitecture">Processing architecture</h2>
- <p>Below is a diagram showing roughly the architecture of Xmake, and thus how it functions.</p>
- <p><p align="center"><br><img src="https://xmake.io/assets/img/index/package_arch.png" width="650px" /><br></p>
- </p>
- <h2 id="distributedcompilation">Distributed Compilation</h2>
- <ul>
- <li>[X] Cross-platform support.</li>
- <li>[X] Support for MSVC, Clang, GCC and other cross-compilation toolchains.</li>
- <li>[X] Support for building for Android, Linux, Windows NT, and Darwin hosts.</li>
- <li>[X] No dependencies other than the compilation toolchain.</li>
- <li>[X] Support for build server load balancing scheduling.</li>
- <li>[X] Support for real time compressed transfer of large files (lz4).</li>
- <li>[X] Almost zero configuration cost, no shared filesystem required, for convenience and security.</li>
- </ul>
- <p>For more details see: <a href="https://github.com/xmake-io/xmake/issues/274">#274</a></p>
- <h2 id="remotecompilation">Remote Compilation</h2>
- <p>For more details see: <a href="https://github.com/xmake-io/xmake/issues/622">#622</a></p>
- <h2 id="localremotebuildcache">Local/Remote Build Cache</h2>
- <p>For more details see: <a href="https://github.com/xmake-io/xmake/issues/2371">#622</a></p>
- <h2 id="benchmark">Benchmark</h2>
- <p>Xmake's speed on is par with Ninja! The test project: <a href="https://github.com/xmake-io/xmake/tree/master/core">xmake-core</a></p>
- <h3 id="multitaskparallelcompilation">Multi-task parallel compilation</h3>
- <table>
- <thead>
- <tr>
- <th>buildsystem</th>
- <th>Termux (8core/-j12)</th>
- <th>buildsystem</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>
- <h2 id="singletaskcompilation">Single task compilation</h2>
- <table>
- <thead>
- <tr>
- <th>buildsystem</th>
- <th>Termux (-j1)</th>
- <th>buildsystem</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="moreexamples">More Examples</h2>
- <h3 id="debugandreleaseprofiles">Debug and release profiles</h3>
- <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>
- <h3 id="customscripts">Custom scripts</h3>
- <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>
- <h3 id="automaticintegrationofdependentpackages">Automatic integration of dependent packages</h3>
- <p>Download and use packages in <a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a> or third-party repositories:</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>In addition, we can also use the <a href="https://github.com/xmake-io/xrepo">xrepo</a> command to quickly install dependencies.</p>
- <h3 id="qtquickappprogram">Qt QuickApp Program</h3>
- <pre><code class="lang-lua">target("test")
- add_rules("qt.quickapp")
- add_files("src/*.cpp")
- add_files("src/qml.qrc")
- </code></pre>
- <h3 id="cudaprogram">Cuda Program</h3>
- <pre><code class="lang-lua">target("test")
- set_kind("binary")
- add_files("src/*.cu")
- add_cugencodes("native")
- add_cugencodes("compute_35")
- </code></pre>
- <h3 id="wdkumdfdriverprogram">WDK/UMDF Driver Program</h3>
- <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>For more WDK driver examples (UMDF/KMDF/WDM), please visit <a href="https://xmake.io/#/guide/project_examples?id=wdk-driver-program">WDK Program Examples</a></p>
- <h3 id="darwinapplications">Darwin Applications</h3>
- <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>
- <h3 id="frameworkandbundleprogramdarwin">Framework and Bundle Program (Darwin)</h3>
- <pre><code class="lang-lua">target("test")
- add_rules("xcode.framework") -- or xcode.bundle
- add_files("src/*.m")
- add_files("src/Info.plist")
- </code></pre>
- <h3 id="openmpprogram">OpenMP Program</h3>
- <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>
- <h3 id="zigprogram">Zig Program</h3>
- <pre><code class="lang-lua">target("test")
- set_kind("binary")
- add_files("src/main.zig")
- </code></pre>
- <h3 id="automaticallyfetchremotetoolchain">Automatically fetch remote toolchain</h3>
- <h4 id="fetchaspecialversionofllvm">fetch a special version of LLVM</h4>
- <p>Require the Clang version packaged with LLM-10 to compile a project.</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="fetchacrosscompilationtoolchain">Fetch a cross-compilation toolchain</h4>
- <p>We can also pull a specified cross-compilation toolchain in to compile the project.</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="fetchtoolchainandpackages">Fetch toolchain and packages</h4>
- <p>We can also use the specified <code>muslcc</code> cross-compilation toolchain to compile and integrate all dependent packages.</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="plugins">Plugins</h2>
- <h4 id="generateideprojectfilepluginmakefilevs2002vs2022">Generate IDE project file plugin(makefile, vs2002 - vs2022 .. )</h4>
- <pre><code class="lang-bash">$ xmake project -k vsxmake -m "debug,release" # New vsproj generator (Recommended)
- $ xmake project -k vs -m "debug,release"
- $ xmake project -k cmake
- $ xmake project -k ninja
- $ xmake project -k compile_commands
- </code></pre>
- <h4 id="runacustomluascriptplugin">Run a custom lua script plugin</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>To see a list of bultin plugs, please visit <a href="https://xmake.io/#/plugin/builtin_plugins">Builtin plugins</a>.</p>
- <p>Please download and install other plugins from the plugins repository <a href="https://github.com/xmake-io/xmake-plugins">xmake-plugins</a>.</p>
- <h2 id="ideeditorintegration">IDE/Editor Integration</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> (third-party, thanks <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><a href="https://github.com/luzhlon/xmake.vim">xmake.vim</a> (third-party, thanks <a href="https://github.com/luzhlon">@luzhlon</a>)</li>
- <li><a href="https://github.com/HelloWorld886/xmake-visualstudio">xmake-visualstudio</a> (third-party, thanks <a href="https://github.com/HelloWorld886">@HelloWorld886</a>)</li>
- <li><a href="https://github.com/Arthapz/xmake-project-manager">xmake-qtcreator</a> (third-party, thanks <a href="https://github.com/Arthapz">@Arthapz</a>)</li>
- </ul>
- <h3 id="xmakegradlepluginjni">Xmake Gradle Plugin (JNI)</h3>
- <p>We can use the <a href="https://github.com/xmake-io/xmake-gradle">xmake-gradle</a> plugin to compile JNI libraries via gradle.</p>
- <pre><code>plugins {
- id 'org.tboox.gradle-xmake-plugin' version '1.1.5'
- }
- android {
- externalNativeBuild {
- xmake {
- path "jni/xmake.lua"
- }
- }
- }
- </code></pre><p>The <code>xmakeBuild</code> task will be injected into the <code>assemble</code> task automatically if the <code>gradle-xmake-plugin</code> has been applied.</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="ciintegration">CI Integration</h2>
- <h3 id="githubaction">GitHub Action</h3>
- <p>The <a href="https://github.com/xmake-io/github-action-setup-xmake">github-action-setup-xmake</a> plugin for GitHub Actions can allow you to use Xmake with minimal efforts if you use GitHub Actions for your CI pipeline.</p>
- <pre><code class="lang-yaml">uses: xmake-io/github-action-setup-xmake@v1
- with:
- xmake-version: latest
- </code></pre>
- <h2 id="whoisusingxmake">Who is using Xmake?</h2>
- <p>The list of people and projects who are using Xmake is available <a href="https://xmake.io/#/about/who_is_using_xmake">here</a>.</p>
- <p>If you are using Xmake, you are welcome to submit your information to the above list through a PR, so that other users and the developers can gauge interest. Ihis also let users to use xmake more confidently and give us motivation to continue to maintain it.</p>
- <p>This will help the Xmake project and it's community grow stronger and expand!</p>
- <h2 id="contacts">Contacts</h2>
- <ul>
- <li>Email:<a href="mailto:[email protected]">[email protected]</a></li>
- <li>Homepage:<a href="https://xmake.io">xmake.io</a></li>
- <li>Community<ul>
- <li><a href="https://www.reddit.com/r/xmake/">Chat on Reddit</a></li>
- <li><a href="https://t.me/tbooxorg">Chat on Telegram</a></li>
- <li><a href="https://discord.gg/xmake">Chat on Discord</a></li>
- <li>Chat on QQ Group: 343118190, 662147501</li>
- </ul>
- </li>
- <li>Source Code:<a href="https://github.com/xmake-io/xmake">GitHub</a>, <a href="https://gitee.com/tboox/xmake">Gitee</a></li>
- <li>WeChat Public: tboox-os</li>
- </ul>
- <h2 id="thanks">Thanks</h2>
- <p>This project exists thanks to all the people who have <a href="CONTRIBUTING.md">contributed</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>: Provide the xmake <a href="https://github.com/TitanSnow/ts-xmake-logo">logo</a> and install scripts</li>
- <li><a href="https://github.com/uael">uael</a>: Provide the semantic versioning library <a href="https://github.com/uael/sv">sv</a></li>
- <li><a href="https://github.com/OpportunityLiu">OpportunityLiu</a>: Improve cuda, tests and ci</li>
- <li><a href="https://github.com/xq114">xq144</a>: Improve <code>xrepo env shell</code>, and contribute a lot of packages to the <a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a> repository.</li>
- <li><code>enderger</code>: Helped smooth out the edges on the English translation of the README</li>
- </ul>
- </article>
- </body>
- </html>
|