🔥 A cross-platform build utility based on Lua



A cross-platform build utility based on Lua
Modern C/C++ build tools, Simple, Fast, Powerful dependency package integration

Supporting the project

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. 🙏

Introduction (中文)

Xmake is a lightweight cross-platform build utility based on Lua.

It is very lightweight and has no dependencies because it has a built-in Lua runtime.

It uses xmake.lua to maintain project builds and its configuration syntax is very simple and readable.

We can use it to build project directly like Make/Ninja, or generate project files like CMake/Meson, and it also has a built-in package management system to help users solve the integrated use of C/C++ dependent libraries.

Xmake = Build backend + Project Generator + Package Manager

If you want to know more, please refer to: Documents, Github and Gitee and also welcome to join our community.


via curl

bash <(curl -fsSL https://xmake.io/shget.text)

via wget

bash <(wget https://xmake.io/shget.text -O -)

via powershell

Invoke-Expression (Invoke-Webrequest 'https://xmake.io/psget.text' -UseBasicParsing).Content

Simple description

Package dependences

An official xmake package repository: xmake-repo

Build project

$ xmake

Run target

$ xmake run console

Debug target

$ xmake run -d console

Configure platform

$ xmake f -p [windows|linux|macosx|android|iphoneos ..] -a [x86|arm64 ..] -m [debug|release]
$ xmake

Menu configuration

$ xmake f --menu

Build as fast as ninja

The test project: xmake-core

Multi-task parallel compilation

buildsystem Termux (8core/-j12) buildsystem MacOS (8core/-j12)
xmake 24.890s xmake 12.264s
ninja 25.682s ninja 11.327s
cmake(gen+make) 5.416s+28.473s cmake(gen+make) 1.203s+14.030s
cmake(gen+ninja) 4.458s+24.842s cmake(gen+ninja) 0.988s+11.644s

Single task compilation

buildsystem Termux (-j1) buildsystem MacOS (-j1)
xmake 1m57.707s xmake 39.937s
ninja 1m52.845s ninja 38.995s
cmake(gen+make) 5.416s+2m10.539s cmake(gen+make) 1.203s+41.737s
cmake(gen+ninja) 4.458s+1m54.868s cmake(gen+ninja) 0.988s+38.022s

Package management

Download and build

Processing architecture

Supported package repositories

  • Official package repository xmake-repo (tbox >1.6.1)
  • Official package manager Xrepo
  • User-built repositories
  • Conan (conan::openssl/1.1.1g)
  • Conda (conda::libpng 1.3.67)
  • Vcpkg (vcpkg:ffmpeg)
  • Homebrew/Linuxbrew (brew::pcre2/libpcre2-8)
  • Pacman on archlinux/msys2 (pacman::libcurl)
  • Apt on ubuntu/debian (apt::zlib1g-dev)
  • Clib (clib::clibs/[email protected])
  • Dub (dub::log 0.4.3)
  • Portage on Gentoo/Linux (portage::libhandy)
  • Nimble for nimlang (nimble::zip >1.3)
  • Cargo for rust (cargo::base64 0.13.0)

Package management features

  • The official repository provides nearly 500+ packages, one-click compilation on all platforms
  • Full platform package support, support for cross-compiled dependent package integration
  • Support package virtual environment, xrepo env shell
  • Precompiled package acceleration for windows
  • Support self-built package repositories, private repository deployment
  • Third-party package repository support, such as: vcpkg, conan, conda, etc.
  • Support to pull using remote toolchain automatically
  • Support to lock package dependency

Supported platforms

  • Windows (x86, x64)
  • macOS (i386, x86_64, arm64)
  • Linux (i386, x86_64, cross-toolchains ..)
  • *BSD (i386, x86_64)
  • Android (x86, x86_64, armeabi, armeabi-v7a, arm64-v8a)
  • iOS (armv7, armv7s, arm64, i386, x86_64)
  • WatchOS (armv7k, i386)
  • AppleTVOS (armv7, arm64, i386, x86_64)
  • MSYS (i386, x86_64)
  • MinGW (i386, x86_64, arm, arm64)
  • Cygwin (i386, x86_64)
  • Wasm (wasm32)
  • Cross (cross-toolchains ..)

Supported toolchains

$ 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
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
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

Supported Languages

  • C
  • C++
  • Objective-C and Objective-C++
  • Swift
  • Assembly
  • Golang
  • Rust
  • Dlang
  • Fortran
  • Cuda
  • Zig
  • Vala
  • Pascal
  • Nim

Supported Features

  • The configuration grammar is simple and easy to use
  • Quick installation, without any dependencies
  • One-click compilation for all platforms
  • Support cross compilation, intelligent analysis of cross tool chain information
  • Extremely fast, multi-task parallel compilation support
  • C++20 Module support
  • Support cross-platform C/C++ dependency package quick integration, built-in package manager
  • Multi-language mixed compilation support
  • Rich plug-in support, providing various project generators, such as: vs/makefile/cmakelists/compile_commands to generate plugins
  • REPL interactive execution support
  • Incremental compilation support, automatic analysis of header files
  • Quick switching and customization support of tool chain
  • A large number of expansion modules support

Supported Projects

  • Static Library
  • Shared Library
  • Console
  • Cuda Program
  • Qt Application
  • WDK Driver (umdf/kmdf/wdm)
  • WinSDK Application
  • MFC Application
  • iOS/MacOS Application (Support .metal)
  • Framework and Bundle Program (iOS/MacOS)
  • SWIG Modules (Lua, python, ...)
  • Luarocks Modules
  • Protobuf Program
  • Lex/yacc program
  • C++20 Modules
  • Linux Kernel Driver Modules

More Examples

Debug and release modes

add_rules("mode.debug", "mode.release")

    if is_mode("debug") then

Custom scripts

    after_build(function (target)
        print("hello: %s", target:name())
        os.exec("echo %s", target:targetfile())

Automatic integration of dependent packages

Download and use packages in xmake-repo or third-party repositories:

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})
    add_packages("tbox", "libuv", "vcpkg::ffmpeg", "brew::pcre2/libpcre2-8", "openssl")

In addition, we can also use the xrepo command to quickly install dependent packages.

Qt QuickApp Program


Cuda Program


WDK/UMDF Driver Program

    add_rules("wdk.driver", "wdk.env.umdf")

    add_rules("wdk.binary", "wdk.env.umdf")

More wdk driver program examples (umdf/kmdf/wdm), please see WDK Program Examples

iOS/MacOS Application

    add_files("src/*.m", "src/**.storyboard", "src/*.xcassets")

Framework and Bundle Program (iOS/MacOS)

    add_rules("xcode.framework") -- or xcode.bundle

OpenMP Program

add_requires("libomp", {optional = true})

Zig Program


Automatically fetch remote toolchain

fetch the special version of llvm

We use clang in llvm-10 to compile the project.

add_requires("llvm 10.x", {alias = "llvm-10"})
    set_toolchains("[email protected]-10")

Fetch cross-compilation toolchain

We can also pull the specified cross-compilation tool chain to compile the project.


Fetch toolchain and packages

We can also use the specified muslcc cross-compilation toolchain to compile and integrate all dependent packages

add_requires("zlib", "libogg", {system = false})


    add_packages("zlib", "libogg")


Generate IDE project file plugin(makefile, vs2002 - vs2022 .. )

$ 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

Run the custom lua script plugin

$ 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}
< {

More builtin plugins, please see: Builtin plugins

Please download and install more other plugins from the plugins repository xmake-plugins.

IDE/Editor Integration

XMake Gradle Plugin (JNI)

We can uses xmake-gradle plugin to compile JNI library in gradle.

plugins {
  id 'org.tboox.gradle-xmake-plugin' version '1.1.5'

android {
    externalNativeBuild {
        xmake {
            path "jni/xmake.lua"

The xmakeBuild will be injected to assemble task automatically if the gradle-xmake-plugin has been applied.

$ ./gradlew app:assembleDebug
> Task :nativelib:xmakeConfigureForArm64
> Task :nativelib:xmakeBuildForArm64
>> xmake build
[ 50%]: ccache 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%]: ccache 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

Technical Support

We also provide paid technical support to help users quickly solve related problems. For details, please click the image link below:

Or you can also consider sponsoring us to get technical support services, [Become a sponsor]

Who is using Xmake?

Please click User List to view the complete user list.

If you are using xmake, welcome to submit the information to the above list through PR, so that let more users can known how many users are using xmake.

Ihis also let users to use xmake more confidently, and we will also have more motivation to maintain it continuously, so that the xmake project and the community will grow stronger.



This project exists thanks to all the people who have contributed:

  • TitanSnow: provide the xmake logo and install scripts
  • uael: provide the semantic versioning library sv
  • OpportunityLiu: improve cuda, tests and ci
  • xq144: Improve xrepo env shell, and contribute a lot of packages to the xmake-repo repository.
  • quickapp_qt 模板產生出來的專案,編譯成功後,執行失敗

    quickapp_qt 模板產生出來的專案,編譯成功後,執行失敗


    $ xmake create -l c++ -t quickapp_qt qt5_app
    $ xmake f --qt=D:\Qt5\5.9.3
    $ xmake project -k vs2015


    QQmlApplicationEngine failed to load component
    qrc:/main.qml:-1 No such file or directory

    後來嘗試把自動生成的 .qt\qrc\qt5_app\qml.cpp 強制加入專案一起編譯,才可以正常運作。

    • 請問沒有自動把qml.cpp加入編譯是否為預期中的行為? 使用者得自行加入?
    discussion feature request 
    opened by orzuk-lmj 118
  • 增加头目录及库目录提供出错


    add_rules("mode.debug", "mode.release") target("native-lib") set_kind("shared") add_option_includedirs("libs\x86\include") add_option_linkdirs("libs") add_files("native-lib.cpp")


    .\xmake.lua:4: attempt to call global 'add_option_includedirs' (a nil value)

    opened by hsav20 102
  • Remote package management

    Remote package management

    A package manager or package management system is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer's operating system in a consistent manner.

    A package manager deals with packages, distributions of software and data in archive files. Packages contain metadata, such as the software's name, description of its purpose, version number, vendor, checksum, and a list of dependencies necessary for the software to run properly. Upon installation, metadata is stored in a local package database. Package managers typically maintain a database of software dependencies and version information to prevent software mismatches and missing prerequisites. They work closely with software repositories, binary repository managers, and app stores.

    Source: package manager

    Remote package management roadmap:

    • [x] detect tools and environment and wrap them
      • [x] git
      • [x] curl
      • [x] wget
      • [x] unzip/tar/7z/gzip
      • [x] ping (test speed)
    • [x] Extractor wrapper
      • [x] tar
      • [x] unzip
      • [x] gzip
      • [x] 7z
    • [x] Cache management
    • [x] semver
      • [x] parse
      • [x] satisfies
      • [x] select
    • [ ] Multi language
      • [x] asm/c/c++
      • [x] objc/c++
      • [x] swift
      • [x] rust
      • [x] dlang
    • [x] Multi platform
      • [x] linux
      • [x] macOS
      • [x] windows
        • [x] git
        • [x] downloader (http[s], ftp ..)
        • [x] extractor (zip, tar.gz, 7z .. )
    • [x] Command line tools
      • [x] require task
        • [x] install
          • [x] parse require info
          • [x] parse and load packages from repositories
          • [x] download package
            • [x] optimization: select the fastest url if exists multiple urls
          • [x] extract package
          • [x] build package
            • [x] xmake.lua
              • [x] linux/macos
              • [x] windows
            • [x] makefile
              • [x] linux/macos
              • [x] windows
            • [x] configure/make
              • [x] linux/macos
            • [x] cmakelists.txt
              • [x] linux/macos
              • [x] windows (in progress ..)
            • [x] *.vcproj
              • [x] windows
          • [x] install package
          • [x] install basic dependent tools (git, curl, unzip ...)
        • [x] search
        • [x] clear
        • [x] remove
        • [x] list
      • [x] repo task
        • [x] add repository
        • [x] remove repository
        • [x] list all repositories
        • [x] clear all repositories and cache
        • [x] global or local repositories
    • [x] xmake lua api
      • [x] add_requires: add package require info
      • [x] add_repositories: add repository url
      • [x] add_packages: add package dependencies to target
      • [x] package: package definition
        • [x] set_urls
        • [x] add_versions
        • [x] set_homepage
        • [x] set_description
        • [x] add_deps
        • [x] [on|before|after]_load: custom load script
        • [x] [on|before|after]_install: custom install script
        • [x] [on|before|after]_test: custom test script
        • [x] add_patches
        • [x] add_links
        • [x] add_defines
        • [x] add_includedirs
    discussion feature request 
    opened by uael 85
  • vs2015编译报错缺少qt的ui_***Lib.h文件


    Describe the bug

    • 正常编译生成vs2015项目
    D:\GitLab\sd-cpp\sdSocketKey_win_http>xmake project -k vs2015 -m "debug,release"
    checking for the debug.x86 ...
    checking for the debug.x64 ...
    checking for the release.x86 ...
    checking for the release.x64 ...
    create ok!
    • sdUi是qt编译生成的界面dll文件 image
    • 这里链接进来.qt的少了build-qt-ui的 如何添加?感觉可以解决报错 image


    错误	C1083	无法打开包括文件: “ui_sdUiLib.h”: No such file or directory	sdUi	D:\GitLab\sd-cpp\sdSocketKey_win_http\sdUi\sdUiLib.cpp	2	
    • 直接命令行编译是正常的,用vs编译就出现这个报错
    opened by jiagushuai 71
  • Support call xmake from msbuild

    Support call xmake from msbuild

    Ref: #257 #174

    │  xmake.lua
    │  │  
    │  ├─demo
    │  │  │  xmake.lua
    │  │  └─ ...
    │  ├─lcurses    
    │  │  │  xmake.lua
    │  │  └─ ...
    │  ├─luajit
    │  │  │  xmake.lua
    │  │  └─ ...
    │  ├─pdcurses
    │  │  │  xmake.lua
    │  │  └─ ...
    │  ├─tbox
    │  │  │  xmake.lua
    │  │  └─ ...           
    │  └─xmake
    │     │  xmake.lua
    │     └─ ...    
        │  vsxmake.sln
        │  Xmake.Custom.props
        │  Xmake.Custom.targets
        │      demo.vcxproj
        │      demo.vcxproj.filters
        │      demo.vcxproj.user
        │      Xmake.Custom.props
        │      Xmake.Custom.targets
        │      lcurses.vcxproj
        │      lcurses.vcxproj.filters
        │      lcurses.vcxproj.user
        │      Xmake.Custom.props
        │      Xmake.Custom.targets
        │      luajit.vcxproj
        │      luajit.vcxproj.filters
        │      luajit.vcxproj.user
        │      Xmake.Custom.props
        │      Xmake.Custom.targets
        │      pdcurses.vcxproj
        │      pdcurses.vcxproj.filters
        │      pdcurses.vcxproj.user
        │      Xmake.Custom.props
        │      Xmake.Custom.targets
        │      sv.vcxproj
        │      sv.vcxproj.filters
        │      sv.vcxproj.user
        │      Xmake.Custom.props
        │      Xmake.Custom.targets
        │      tbox.vcxproj
        │      tbox.vcxproj.filters
        │      tbox.vcxproj.user
        │      Xmake.Custom.props
        │      Xmake.Custom.targets
    feature request 
    opened by OpportunityLiu 70
  • 设置工具链为clang遇到的问题


    使用命令行配置: xmake f -v --cc=clang --cxx=clang++ --ld=clang++ -m debug 可以正确保存工具链为clang,正确编译代码

    但是我希望能在xmake.lua里直接设置工具链,不用再执行配置指令,这么写的: set_tools("cc", "/usr/bin/clang") set_tools("cxx", "/usr/bin/clang++") set_tools("ld", "/usr/bin/clang++")

    add_rules("mode.debug", "mode.release")

    -- add target target("hello") -- 之前set_tools放在这里,也不能生效

    -- set kind
    -- add files


    请问是不是我设置错了,要如何设置才能在不用调用xmake f配置的情况下,直接可以编译呢?

    输出结果: checking for the architecture ... x86_64 configure { plat = linux arch = x86_64 ccache = true kind = static buildir = build host = linux mode = release ndk_stdcxx = true } checking for the gcc ... /usr/bin/gcc checking for the c++ compiler (cxx) ... gcc checking for the /usr/bin/gcc ... ok checking for the flags (-O3) ... ok checking for the ccache ... no [ 0%]: compiling.release src/main.cpp /usr/bin/gcc -c -fvisibility=hidden -O3 -m64 -I/usr/local/include -I/usr/include -o build/.objs/hello/linux/x86_64/release/src/main.cpp.o src/main.cpp checking for the flags (-MMD -MF) ... ok [100%]: linking.release hello clang++ -o build/linux/x86_64/release/hello build/.objs/hello/linux/x86_64/release/src/main.cpp.o -s -fvisibility=hidden -m64 -L/usr/local/lib -L/usr/lib

    opened by owllyi 64
  • Automatic Inference of `MinGW` SDK Directory

    Automatic Inference of `MinGW` SDK Directory

    The code in:


    Supports only macOS and Linux. On top of this, it doesn't check for existence, it only sets directories (Which might not exist).

    I suggest the following assuming MinGW platform was defined (-p mingw):

    1. If on Windows, Look for Environment Variables GCC_BIN_PATH or GCC_LIB_PATH.
    2. In case they exist define minGwSdk = GCC_BIN_PATH/.. or minGwSdk = GCC_LIB_PATH/.. with priority for the BIN folder.
    3. If not on Windows, do as the code above deines.
    4. Check for existence of minGwSdk. If it doesn't exist return an error.

    Step (4) is in case the existence isn't in a later step in the program.

    feature request improvement 
    opened by RoyiAvital 58
  • android 平台集成 jpeg-turbo 库问题

    android 平台集成 jpeg-turbo 库问题

    xmake f -p android --ndk=E:\Android\sdk\ndk\21.0.6113669 -a x86 --ndk_sdkver=21 --ndk_cxxstl=c++_static 在.xmake下面生成安卓对应平台的内容。

    checking for Android SDK directory ... E:\Android\sdk checking for Build Tools Version of Android SDK ... 30.0.3 checking for NDK directory ... E:\Android\sdk\ndk\21.0.6113669 checking for SDK version of NDK ... 21 checking for toolchains version of NDK ... 4.9****


    opened by dsp2000 52
  • xmake turbojpeg 安卓armeabi-v7a不正常

    xmake turbojpeg 安卓armeabi-v7a不正常

    Note: If it is a 'bug report' or 'feature request', please select the corresponding issue template, otherwise this issue will be not replied.

    Describe the problem details

    Please describe your problem details here.

    xmake turbojpeg 编译到x86可以使用,但在 安卓armeabi-v7a不正常,生成的so加载不成功。去掉 add_packages("libjpeg-turbo")后可以的



    opened by dsp2000 45
  • Utf8 support

    Utf8 support


    • Rewrite whole io API with stdio/winapi (for std files) and tbox (for disk files)
      • Do not support file:read("n") for disk files
      • For windows, io.read(num) will not ensure returns num of chars since it reads num of utf-16 chars and convert it to utf-8
      • Add opt param for most api
        opt = { continuation = "\\", encoding = "utf16le" }
        • encoding will be detected if not specified, use "binary" to disable this feature and read as a binary file
        • continuation is not supported for binary files, for other files, char sequence continuation .. "\r\n" or continuation .. "\n" will be replaced to an empty char sequence in read apis, this option does not affect writing
      • Add file:path() and file:size() API
    • Add a .clang-format file for ./core
    • Add some codepage related api for winos
      • winos.ansi_cp() get ansi codepage
      • winos.oem_cp() get oem codepage
      • winos.cp_info(cp) get info of a codepage
      • winos.console_cp(cp) set console cp, if cp not provided, get current console cp
      • winos.console_output_cp(cp) set console output cp, if cp not provided, get current console output cp
      • winos.mbstoutf8(cp, data) convert data of cp to utf8 string
    • Add table.to_array method
      table.to_array(ipairs({"a", "b"})) -- {{1,"a",n=2},{2,"b",n=2}},2
      table.to_array(io.lines("file")) -- {"line 1","line 2", ... , "line n"},n
    • Add raw* method and global method to debug
    • Fix a bug that circular reference will cause stackoverflow on utils.dump

    For xmake developers:

    • ~~temp file named "null" and "nullin" will be used as os.nuldev() for windows~~
    • print is not available in ./xmake/core domain, you should use io.write here
    opened by OpportunityLiu 45
  • xmake安卓llvm编译--ndk_sdkver=16时出现没有找到 no member named 'log2f' in the global namespace

    xmake安卓llvm编译--ndk_sdkver=16时出现没有找到 no member named 'log2f' in the global namespace




    xmake安卓llvm编译--ndk_sdkver=21编译是正常的,但使用一些低版本的手机加载so出错。 当将--ndk_sdkver=16编译时提示出错 **error: E:\Android\sdk\ndk\21.0.6113669\sources\cxx-stl\llvm-libc++/include\math. h:1373:93: error: no member named 'log2f' in the global namespace inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}

    在xmake.lua里面链接是这样的: add_syslinks("log", "z", "m") add_shflags("-Wl,--no-undefined")

    找到一篇文章,想试试加入stl Android源码中的c++ STL_田海立@CSDN-CSDN博客 https://blog.csdn.net/thl789/article/details/109864831


    或者如果stl不行,有什么方法可以处理掉 log2f 这个问题?

    opened by dsp2000 44
  • Use -gsource-map on wasm targets in debug

    Use -gsource-map on wasm targets in debug

    Is your feature request related to a problem? Please describe.

    When building wasm with symbols, -gsource-map should be added along with -g to be able to debug original file easily.

    See https://emscripten.org/docs/tools_reference/emcc.html#emcc-gsource-map

    Describe the solution you'd like

    Adding -gsource-map when -g is added and wasm is used.

    Describe alternatives you've considered

    Adding it myself

    Additional context

    No response

    feature request 
    opened by SirLynix 1
  • wasm install doesn't copy all files

    wasm install doesn't copy all files

    Xmake Version


    Operating System Version and Architecture

    Ubuntu 10

    Describe Bug

    When running xmake install on a wasm project, only the .html file is copied, however emscripten generates more file: https://emscripten.org/docs/tools_reference/emcc.html#emcc-o-target

    Expected Behavior

    xmake should copy .js, .mjs and .wasm files to the bin folder if they exist.

    Project Configuration

    No response

    Additional Information and Error Logs

    No response

    opened by SirLynix 1
  • Package components

    Package components

    Is your feature request related to a problem? Please describe.

    One issue I regularly have with xmake package is the fact there's no good way to handle libraries spanning over multiple modules (multiple components).

    For example, the SFML has five libraries: sfml-system, sfml-window, sfml-graphics, sfml-audio, sfml-network. Other libraries like Qt, Boost and my own engine have a similar issue.

    Let's take the case where we want to have a SFML client and a SFML server, depending on a common library.

    xmake currently offers three ways to handle this:

    Using add_packages links

        add_packages("sfml", { links = { "sfml-system", "sfml-network" }, public = true })


    • Package is only installed once


    • Links and syslinks have to be manually handled, which can break easily (for example, link order matters on Linux, libraries can have another name depending on debug/static, etc.)
    • The package has no way to handle this itself

    Using package configs

    add_requires("sfml~server", { configs = { audio = false, graphics = false, window = false } })
        add_packages("sfml~server", public = true })
        add_packages("sfml~client") -- Duplicate links?
    -- Client links both sfml~server and sfml~client!


    • Package can handle syslinks and stuff that changes depending on which components are enabled


    • SFML is compiled twice and takes up more space
    • client depends on sfml~server and sfml~client

    Using multiple packages

    Imagine now there was a package for each sfml component ("sfml-system", "sfml-window", etc.).

    add_requires("sfml-network", "sfml-graphics", "sfml-audio")
        add_packages("sfml-network", { public = true })
        add_packages("sfml-graphics", "sfml-audio")


    • All targets are well built, dependencies like sfml-system and sfml-window are well handled


    • Requires a package (like qt5base) to build SFML once and metapackages (like qt5core, qt5gui, and more) to fetch only what's needed.
    • From my experience with the qt5 package, this isn't straightforward and can easily break.
    • Would require to make a lot of packages

    Describe the solution you'd like

    I think we should be able to handle multiple components in the same package, installing the lib only once but allowing to select which components we want, without having to rebuild it multiple times.

    First solution: handle subpackages

            -- also supports on_load
            add_deps("system") -- depends on system component


        add_packages("sfml/network", { public = true }) -- Use component network of package sfml
        add_packages("sfml/graphics", "sfml/audio") -- Use components graphics, audio, and their dependencies (along with sfml/network from library)


    • Fixes the issue, the package is built only once and can handle all syslinks and more.
    • Makes it very straightforward to handle libs with multiple components
    • If we keep add_packages("sfml") to include all components, this doesn't break any code.


    • Probably a bit complicated to implement.

    Second solution: allows some configs to not change package key

        -- Note pkg_key
        add_configs("graphics",   {pkg_key = false, description = "Use the graphics module", default = true, type = "boolean"})
        add_configs("window",     {pkg_key = false, description = "Use the window module", default = true, type = "boolean"})
        add_configs("audio",      {pkg_key = false, description = "Use the audio module", default = true, type = "boolean"})
        add_configs("network",    {pkg_key = false, description = "Use the network module", default = true, type = "boolean"})
        on_load(function (package)
            -- select links and syslinks depending on configs
        on_install(function (package)
            -- compiles everything


    add_requires("sfml~server", { configs = { audio = false, graphics = false, window = false } })
    -- Both are the same package
        add_packages("sfml~server", public = true })
        add_packages("sfml~client") -- Duplicate links?
    -- Client links both sfml~server and sfml~client!


    • Doesn't install the SFML twice.
    • A lot simpler to implement.


    • Doesn't fully fix the issue

    This feature would make xmake way more awesome compared to conan/vcpkg (which I don't think can handle components) and could be used with libraries such as Qt, Boost and more.

    I understand it may be complicated to implemented (especially the first solution), but I think it's worth it. Also the second solution can be implemented quickly to help a bit for now.

    It wouldn't break compatibility if we make add_packages("xxx") select all components by default.

    Describe alternatives you've considered

    Described at the top.

    Additional context

    No response

    feature request 
    opened by SirLynix 19
  • Let find_tool find binaries from `add_requires`

    Let find_tool find binaries from `add_requires`



    add_requires("python 3.x")
        add_rules("python.library", {soabi=true})
        add_packages("python 3.x")

    如果系统上未安装python,则此程序无法通过xmake f (rule python.library 调用了find_tool去查找python),从xrepo下载的python就没有意义了(即使使用xrepo env shell也无法进入虚拟环境,过不了xmake f这一关)




    No response


    No response

    feature request 
    opened by xq114 1
🔥 Xmake is a cross-platform build utility based on Lua
A cross-platform,lightweight,scalable game server framework written in C++, and support Lua Script

Current building status Moon Moon is a lightweight online game server framework implement with multithread and multi-luaVM. One thread may have 1-N lu

Bruce 431 Aug 2, 2022
A cross-platform,lightweight,scalable game server framework written in C++, and support Lua Script

hive Distributed game server framework based on CPP 17 && LUA 5.4 框架(hive)+逻辑(server) 支持跨平台开发(windows,linux,mac) oop模式的lua开发,支持lua热更新 protobuf协议 pbc修改

toney 60 Jul 30, 2022
A dependency free, embeddable debugger for Lua in a single file (.lua or .c)

debugger.lua A simple, embedabble debugger for Lua 5.x, and LuaJIT 2.x. debugger.lua is a simple, single file, pure Lua debugger that is easy to integ

Scott Lembcke 576 Jul 23, 2022
The Lua development repository, as seen by the Lua team. Mirrored irregularly

The Lua development repository, as seen by the Lua team. Mirrored irregularly

Lua 5.9k Aug 7, 2022
The Leap Motion cross-format, cross-platform declarative serialization library

Introduction to LeapSerial LeapSerial is a cross-format, declarative, serialization and deserialization library written and maintained by Leap Motion.

Leap Motion (Ultraleap) 15 Jan 17, 2022
FFF is a decentralized blockchain based on IPFS/RIPPLE, which integrates lua virtual machine-based smart contracts.

FFF is a decentralized blockchain based on IPFS/RIPPLE, which integrates lua virtual machine-based smart contracts. It is also a software platform designed to help coordinate voluntary free market operations amongst a set of social actors.

gen2600 5 May 31, 2022
A cross platform shader language with multi-threaded offline compilation or platform shader source code generation

A cross platform shader language with multi-threaded offline compilation or platform shader source code generation. Output json reflection info and c++ header with your shaders structs, fx-like techniques and compile time branch evaluation via (uber-shader) "permutations".

Alex Dixon 275 Jul 18, 2022
A modern port of Turbo Vision 2.0, the classical framework for text-based user interfaces. Now cross-platform and with Unicode support.

Turbo Vision A modern port of Turbo Vision 2.0, the classical framework for text-based user interfaces. Now cross-platform and with Unicode support. I

null 1.3k Aug 7, 2022
🎮 Cross platform development kit for Z80 and SM83 based consoles.

cdk ?? Cross platform development kit for Z80 and SM83 based consoles. Platform We planned to support the following consoles: Nintendo Game Boy Ninten

Micro Console 4 Jan 10, 2022
Wgeo, or "wi-fi geolocator", is a cross-platform C/C++ library for wifi-based device geolocation, utilising public wireless access point location databases

wgeo Wgeo, or "wi-fi geolocator", is a cross-platform C/C++ library for wifi-based device geolocation, utilising public wireless access point location

Xavier Maruff 2 Jan 30, 2022

PnPAssist Description The PnPAssist is an open source innovative CNC table that position the next SMT component with a proper orientation for you to m

MakerStorage 36 Jul 27, 2022
Lua Client based on C++ for Polaris

Polaris Lua 中文文档 1. Project Introduction Based on the existing C++ sdk polaris-cpp project of Polaris, this project implements the Lua layer encapsula

Polarismesh 2 Apr 2, 2022
Signed - a 3D modeling and construction language based on Lua and SDFs. Signed will be available for macOS and iOS and is heavily optimized for Metal.

Signed - A 3D modeling language Abstract Signed is a Lua based 3D modeling language, it provides a unique way to create high quality 3D content for yo

Markus Moenig 89 Jul 4, 2022
My build of dwm based on dwm-flexipatch.

This dwm 6.2 (67d76bd, 2021-03-29) side project has a different take on dwm patching. It uses preprocessor directives to decide whether or not to incl

Utkarsh Verma 2 Jul 8, 2022
LEDE build for NanoPi R4S.Based on Lean’s LEDE.

NanoPi-R4S-LEDE English FAQ 基于Lean的源码编译,适用于Friendly Elec. NanoPi R4S 使用说明: images内为镜像,下载后使用gzip解压就可刷入了。文件系统一般推荐ext4 默认登录地址为192.168.2.1,密码为password 特性:

IFV 1 Jan 1, 2022
CMake-based build system for node.js native modules

Node CMake A CMake-based build system for Node.js native modules, for CMake >= v3.1. Newly rewritten for 2.0! New Features Drop-in execution compatibi

Colin Taylor 75 Aug 1, 2022
A custom distribution of FreeImage, with a CMake-based build system. Used by the Athena Game Framework.

This is a custom distribution of FreeImage, version 3.13.1, with a XMake-based build system. License ------- FreeImage's license is unchanged: this

Philip Abbet 51 Apr 6, 2022
Cross-platform C++11 header-only library for memory mapped file IO

mio An easy to use header-only cross-platform C++11 memory mapping library with an MIT license. mio has been created with the goal to be easily includ

null 1.3k Jul 29, 2022
Cross-platform, Serial Port library written in C++

Serial Communication Library (Linux and OS X) (Windows) This is a cross-platform library for interfacing with rs-232 serial like ports written in C++.

William Woodall 1.6k Aug 7, 2022