1 Star 0 Fork 126

jevno / xmake

forked from tboox / xmake 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

##A make-like build utility based on Lua

Build Status Join the chat at https://gitter.im/waruqi/tboox donate

Introduction

xmake is a make-like build utility based on lua.

The project focuses on making development and building easier and provides many features (.e.g package, install, plugin, macro, action, option, task ...), so that any developer can quickly pick it up and enjoy the productivity boost when developing and building project.

####Features

  • Create projects and supports many project templates
  • Support c/c++, objc/c++, swift and assembly language
  • Automatically probe the host environment and configure project
  • Provide some built-in actions (config, build, package, clean, install, uninstall and run)
  • Provide some built-in plugins (doxygen, macro, project)
  • Provide some built-in macros (batch packaging)
  • Describe the project file using lua script, more flexible and simple
  • Custom packages, platforms, plugins, templates, tasks, macros, options and actions
  • Do not generate makefile and build project directly
  • Support multitasking with argument: -j
  • Check includes dependence automatically

####Actions

  • config: Configure project before building.
  • global: Configure the global options for xmake.
  • build: Build project.
  • clean: Remove all binary and temporary files.
  • create: Create a new project using template.
  • package: Package the given target
  • install: Install the project binary files.
  • uninstall: Uninstall the project binary files.
  • run: Run the project target.

####Plugins

  • The doxygen plugin: Make doxygen document from source codes
  • The macro plugin: Record and playback commands
  • The hello plugin: A simple plugin demo to show 'hello xmake!'
  • The project plugin: Create the project file for IDE (.e.g makefile and vs, xcode in the feature ...)

####Languages

  • C/C++
  • Objc/Objc++
  • Swift
  • Assembly

####Platforms

  • Windows (x86, x64, amd64, x86_amd64)
  • Macosx (i386, x86_64)
  • Linux (i386, x86_64, cross-toolchains ...)
  • Android (armv5te, armv6, armv7-a, armv8-a, arm64-v8a)
  • iPhoneos (armv7, armv7s, arm64, i386, x86_64)
  • Watchos (armv7k, i386)
  • Mingw (i386, x86_64)

####Todolist

  • Manage package and dependencies
  • Download package automatically
  • Create package repository for porting other third-party source codes, it's goal is that one people port it and many people shared.
  • Implement more plugins(.e.g generate .deb, .rpm package)
  • Create more project file for IDE (.e.g vs, xcode ..)
  • Add debugger integration to xmake run -d

####Examples

Create a c++ console project:

    xmake create -l c++ -t 1 console
 or xmake create --language=c++ --template=1 console

Project xmakefile: xmake.lua

target("console")
    set_kind("binary")
    add_files("src/*.c") 

Configure project:

This is optional, if you compile the targets only for linux, macosx and windows and the default compilation mode is release.

   xmake f -p iphoneos -m debug
or xmake f --plat=macosx --arch=x86_64
or xmake f -p windows
or xmake config --plat=iphoneos --mode=debug
or xmake config --plat=android --arch=armv7-a --ndk=xxxxx
or xmake config -p linux -a i386
or xmake config -p mingw --cross=i386-mingw32- --toolchains=/xxx/bin
or xmake config -p mingw --sdk=/mingwsdk
or xmake config --help

Compile project:

   xmake
or xmake -r
or xmake --rebuild

Run target:

   xmake r console
or xmake run console

Package all:

   xmake p
or xmake package
or xmake package console
or xmake package -o /tmp
or xmake package --output=/tmp

Package all archs using macro:

   xmake m package 
or xmake m package -p iphoneos
or xmake m package -p macosx -f "-m debug" -o /tmp/
or xmake m package --help

Install targets:

   xmake i
or xmake install
or xmake install console
or xmake install -o /tmp
or xmake install --output=/tmp

If you need known more detailed usage,please refer to documents or run:

   xmake -h
or xmake --help
or xmake config --help
or xmake package --help
or xmake macro --help
...

The simple xmake.lua file:

-- the debug mode
if is_mode("debug") then
    
    -- enable the debug symbols
    set_symbols("debug")

    -- disable optimization
    set_optimize("none")
end

-- the release mode
if is_mode("release") then

    -- set the symbols visibility: hidden
    set_symbols("hidden")

    -- enable fastest optimization
    set_optimize("fastest")

    -- strip all symbols
    set_strip("all")
end

-- add target
target("test")

    -- set kind
    set_kind("static")

    -- add files
    add_files("src/*.c") 

If you want to know more, please refer to:

####Documents

####Projects

Some projects using xmake:

Contacts

简介

XMake是一个基于Lua的轻量级跨平台自动构建工具,支持在各种主流平台上构建项目

xmake的目标是开发者更加关注于项目本身开发,简化项目的描述和构建,并且提供平台无关性,使得一次编写,随处构建

它跟cmake、automake、premake有点类似,但是机制不同,它默认不会去生成IDE相关的工程文件,采用直接编译,并且更加的方便易用 采用lua的工程描述语法更简洁直观,支持在大部分常用平台上进行构建,以及交叉编译

并且xmake提供了创建、配置、编译、打包、安装、卸载、运行等一些actions,使得开发和构建更加的方便和流程化。

不仅如此,它还提供了许多更加高级的特性,例如插件扩展、脚本宏记录、批量打包、自动文档生成等等。。

如果你想要了解更多,请参考:

支持特性

  • 支持windows、mac、linux、ios、android等平台,自动检测不同平台上的编译工具链(也可手动配置) 编译windows项目采用原生vs的工具链,不需要使用cygwin、mingw(当然这些也支持)

  • 支持自定义平台编译配置,可以很方便的扩展第三方平台支持

  • 采用lua脚本语法描述项目,描述规则简单高效,逻辑规则可灵活修改,并且不会生成相关平台的工程文件,是工程更加简单明了

  • 支持创建模板工程、配置项目、编译项目、运行、打包、安装和卸载等常用功能(后续还会增加:自动生成文档、调试等模块)

  • 支持编译c/c++/objc/swift成静态库、动态库、命令行可执行程序

  • 提供丰富的工程描述api,使用简单灵活,例如添加编译文件只需(还支持过滤排除):

    add_files("src/*.c", "src/asm/**.S", "src/*.m")

  • 支持头文件、接口、链接库依赖、类型的自动检测,并可自动生成配置头文件config.h

  • 支持自定义编译配置开关,例如如果在工程描述文件中增加了enable_xxx的开关,那么配置编译的时候就可以手动进行配置来启用它:

    xmake config --enable_xxx=y

  • 提供一键打包功能,不管在哪个平台上进行打包,都只需要执行一条相同的命令,非常的方便

  • 支持全局配置,一些常用的项目配置,例如工具链、规则描述等等,都可以进行全局配置,这样就不需要每次编译不同工程,都去配置一遍

  • 除了可以自动检测依赖模块,也支持手动强制配置模块,还有各种编译flags。

  • 支持插件扩展、平台扩展、模板扩展、选项自定义等高级功能

  • 提供一些内置的常用插件(例如:自动生成doxygen文档插件,宏脚本记录和运行插件)

  • 宏记录插件里面提供了一些内置的宏脚本(例如:批量打包一个平台的所有archs等),也可以在命令行中手动记录宏并回放执行

  • 提供强大的task任务机制

  • 不依赖makefile和make,实现直接编译,内置自动多任务加速编译, xmake是一个真正的构架工具,而不仅仅是一个工程文件生成器

  • 自动检测ccache,进行自动缓存提升构建速度

  • 自动检测头文件依赖,并且快速自动构建修改的文件

####常用Actions

  • config: 构建之前的编译参数配置
  • global: 配置一些全局参数
  • build: 构建项目
  • clean: 清理一些二进制文件、临时文件
  • create: 使用模板创建新工程
  • package: 打包指定目标
  • install: 安装编译后的目标文件
  • uninstall: 卸载安装的所有文件
  • run: 运行可执行的项目目标

####一些内置插件

  • doxygen文档生成插件: 从指定源码目录生成doxygen文档
  • 宏记录脚本插件: 记录和回放宏脚本,简化重复的命令操作(例如:批量打包。。)
  • hello插件: 插件开发demo
  • 工程文件生成插件: 创建IDE的工程文件 (目前支持:makefile,后续支持:vs, xcode等等)

####支持编译语言

  • C/C++
  • Objc/Objc++
  • Swift
  • Assembly

####支持的构建平台

  • Windows (x86, x64, amd64, x86_amd64)
  • Macosx (i386, x86_64)
  • Linux (i386, x86_64, cross-toolchains ...)
  • Android (armv5te, armv6, armv7-a, armv8-a, arm64-v8a)
  • iPhoneos (armv7, armv7s, arm64, i386, x86_64)
  • Watchos (armv7k, i386)
  • Mingw (i386, x86_64)

####后续任务

  • 自动包依赖管理和下载
  • 创建移植仓库,实现一人移植,多人共享
  • 更多的插件开发(例如:生成.deb, .rpm的安装包)
  • 自动生成vs,xcode等工程文件
  • 添加调试器集成到xmake run -d

####简单例子

创建一个c++ console项目:

    xmake create -l c++ -t 1 console
 or xmake create --language=c++ --template=1 console

工程描述文件:xmake.lua

target("console")
    set_kind("binary")
    add_files("src/*.c") 

配置工程:

这个是可选的步骤,如果只想编译当前主机平台的项目,是可以不用配置的,默认编译release版本。

   xmake f -p iphoneos -m debug
or xmake f --plat=macosx --arch=x86_64
or xmake f -p windows
or xmake config --plat=iphoneos --mode=debug
or xmake config --plat=android --arch=armv7-a --ndk=xxxxx
or xmake config -p linux -a i386
or xmake config -p mingw --cross=i386-mingw32- --toolchains=/xxx/bin
or xmake config -p mingw --sdk=/mingwsdk
or xmake config --help

编译工程:

   xmake
or xmake -r
or xmake --rebuild

运行目标:

   xmake r console
or xmake run console

打包所有:

   xmake p
or xmake package
or xmake package console
or xmake package -o /tmp
or xmake package --output=/tmp

通过宏脚本打包所有架构:

   xmake m package 
or xmake m package -p iphoneos
or xmake m package -p macosx -f "-m debug" -o /tmp/
or xmake m package --help

安装目标:

   xmake i
or xmake install
or xmake install console
or xmake install -o /tmp
or xmake install --output=/tmp

详细使用方式和参数说明,请参考文档 或者运行:

   xmake -h
or xmake --help
or xmake config --help
or xmake package --help
or xmake macro --help
...

一些使用xmake的项目:

####简单例子

-- the debug mode
if is_mode("debug") then
    
    -- enable the debug symbols
    set_symbols("debug")

    -- disable optimization
    set_optimize("none")
end

-- the release mode
if is_mode("release") then

    -- set the symbols visibility: hidden
    set_symbols("hidden")

    -- enable fastest optimization
    set_optimize("fastest")

    -- strip all symbols
    set_strip("all")
end

-- add target
target("test")

    -- set kind
    set_kind("static")

    -- add files
    add_files("src/*.c") 

联系方式

空文件

简介

轻量级跨平台自动构建工具,采用lua语法接口API描述项目,提供自动检测、编译、打包、安装、运行一条龙服务。。 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/rucky2013/xmake.git
git@gitee.com:rucky2013/xmake.git
rucky2013
xmake
xmake
master

搜索帮助