Unnamed: 0
int64 0
0
| repo_id
stringlengths 5
186
| file_path
stringlengths 15
223
| content
stringlengths 1
32.8M
⌀ |
---|---|---|---|
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_dynamic_programming/climbing_stairs_constraint_dp.zig | // File: climbing_stairs_constraint_dp.zig
// Created Time: 2023-07-15
// Author: sjinzh ([email protected])
const std = @import("std");
// 带约束爬楼梯:动态规划
fn climbingStairsConstraintDP(comptime n: usize) i32 {
if (n == 1 or n == 2) {
return @intCast(n);
}
// 初始化 dp 表,用于存储子问题的解
var dp = [_][3]i32{ [_]i32{ -1, -1, -1 } } ** (n + 1);
// 初始状态:预设最小子问题的解
dp[1][1] = 1;
dp[1][2] = 0;
dp[2][1] = 0;
dp[2][2] = 1;
// 状态转移:从较小子问题逐步求解较大子问题
for (3..n + 1) |i| {
dp[i][1] = dp[i - 1][2];
dp[i][2] = dp[i - 2][1] + dp[i - 2][2];
}
return dp[n][1] + dp[n][2];
}
// Driver Code
pub fn main() !void {
comptime var n: usize = 9;
var res = climbingStairsConstraintDP(n);
std.debug.print("爬 {} 阶楼梯共有 {} 种方案\n", .{ n, res });
_ = try std.io.getStdIn().reader().readByte();
}
|
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_sorting/quick_sort.zig | // File: quick_sort.zig
// Created Time: 2023-01-15
// Author: sjinzh ([email protected])
const std = @import("std");
const inc = @import("include");
// 快速排序类
const QuickSort = struct {
// 元素交换
pub fn swap(nums: []i32, i: usize, j: usize) void {
var tmp = nums[i];
nums[i] = nums[j];
nums[j] = tmp;
}
// 哨兵划分
pub fn partition(nums: []i32, left: usize, right: usize) usize {
// 以 nums[left] 作为基准数
var i = left;
var j = right;
while (i < j) {
while (i < j and nums[j] >= nums[left]) j -= 1; // 从右向左找首个小于基准数的元素
while (i < j and nums[i] <= nums[left]) i += 1; // 从左向右找首个大于基准数的元素
swap(nums, i, j); // 交换这两个元素
}
swap(nums, i, left); // 将基准数交换至两子数组的分界线
return i; // 返回基准数的索引
}
// 快速排序
pub fn quickSort(nums: []i32, left: usize, right: usize) void {
// 子数组长度为 1 时终止递归
if (left >= right) return;
// 哨兵划分
var pivot = partition(nums, left, right);
// 递归左子数组、右子数组
quickSort(nums, left, pivot - 1);
quickSort(nums, pivot + 1, right);
}
};
// 快速排序类(中位基准数优化)
const QuickSortMedian = struct {
// 元素交换
pub fn swap(nums: []i32, i: usize, j: usize) void {
var tmp = nums[i];
nums[i] = nums[j];
nums[j] = tmp;
}
// 选取三个元素的中位数
pub fn medianThree(nums: []i32, left: usize, mid: usize, right: usize) usize {
// 使用了异或操作来简化代码
// 异或规则为 0 ^ 0 = 1 ^ 1 = 0, 0 ^ 1 = 1 ^ 0 = 1
if ((nums[left] < nums[mid]) != (nums[left] < nums[right])) {
return left;
} else if ((nums[mid] < nums[left]) != (nums[mid] < nums[right])) {
return mid;
} else {
return right;
}
}
// 哨兵划分(三数取中值)
pub fn partition(nums: []i32, left: usize, right: usize) usize {
// 选取三个候选元素的中位数
var med = medianThree(nums, left, (left + right) / 2, right);
// 将中位数交换至数组最左端
swap(nums, left, med);
// 以 nums[left] 作为基准数
var i = left;
var j = right;
while (i < j) {
while (i < j and nums[j] >= nums[left]) j -= 1; // 从右向左找首个小于基准数的元素
while (i < j and nums[i] <= nums[left]) i += 1; // 从左向右找首个大于基准数的元素
swap(nums, i, j); // 交换这两个元素
}
swap(nums, i, left); // 将基准数交换至两子数组的分界线
return i; // 返回基准数的索引
}
// 快速排序
pub fn quickSort(nums: []i32, left: usize, right: usize) void {
// 子数组长度为 1 时终止递归
if (left >= right) return;
// 哨兵划分
var pivot = partition(nums, left, right);
if (pivot == 0) return;
// 递归左子数组、右子数组
quickSort(nums, left, pivot - 1);
quickSort(nums, pivot + 1, right);
}
};
// 快速排序类(尾递归优化)
const QuickSortTailCall = struct {
// 元素交换
pub fn swap(nums: []i32, i: usize, j: usize) void {
var tmp = nums[i];
nums[i] = nums[j];
nums[j] = tmp;
}
// 哨兵划分
pub fn partition(nums: []i32, left: usize, right: usize) usize {
// 以 nums[left] 作为基准数
var i = left;
var j = right;
while (i < j) {
while (i < j and nums[j] >= nums[left]) j -= 1; // 从右向左找首个小于基准数的元素
while (i < j and nums[i] <= nums[left]) i += 1; // 从左向右找首个大于基准数的元素
swap(nums, i, j); // 交换这两个元素
}
swap(nums, i, left); // 将基准数交换至两子数组的分界线
return i; // 返回基准数的索引
}
// 快速排序(尾递归优化)
pub fn quickSort(nums: []i32, left_: usize, right_: usize) void {
var left = left_;
var right = right_;
// 子数组长度为 1 时终止递归
while (left < right) {
// 哨兵划分操作
var pivot = partition(nums, left, right);
// 对两个子数组中较短的那个执行快排
if (pivot - left < right - pivot) {
quickSort(nums, left, pivot - 1); // 递归排序左子数组
left = pivot + 1; // 剩余待排序区间为 [pivot + 1, right]
} else {
quickSort(nums, pivot + 1, right); // 递归排序右子数组
right = pivot - 1; // 剩余待排序区间为 [left, pivot - 1]
}
}
}
};
// Driver Code
pub fn main() !void {
// 快速排序
var nums = [_]i32{ 2, 4, 1, 0, 3, 5 };
QuickSort.quickSort(&nums, 0, nums.len - 1);
std.debug.print("快速排序完成后 nums = ", .{});
inc.PrintUtil.printArray(i32, &nums);
// 快速排序(中位基准数优化)
var nums1 = [_]i32{ 2, 4, 1, 0, 3, 5 };
QuickSortMedian.quickSort(&nums1, 0, nums1.len - 1);
std.debug.print("\n快速排序(中位基准数优化)完成后 nums = ", .{});
inc.PrintUtil.printArray(i32, &nums1);
// 快速排序(尾递归优化)
var nums2 = [_]i32{ 2, 4, 1, 0, 3, 5 };
QuickSortTailCall.quickSort(&nums2, 0, nums2.len - 1);
std.debug.print("\n快速排序(尾递归优化)完成后 nums = ", .{});
inc.PrintUtil.printArray(i32, &nums2);
_ = try std.io.getStdIn().reader().readByte();
} |
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_sorting/radix_sort.zig | // File: radix_sort.zig
// Created Time: 2023-01-15
// Author: sjinzh ([email protected])
const std = @import("std");
const inc = @import("include");
// 获取元素 num 的第 k 位,其中 exp = 10^(k-1)
fn digit(num: i32, exp: i32) i32 {
// 传入 exp 而非 k 可以避免在此重复执行昂贵的次方计算
return @mod(@divFloor(num, exp), 10);
}
// 计数排序(根据 nums 第 k 位排序)
fn countingSortDigit(nums: []i32, exp: i32) !void {
// 十进制的各位数字范围为 0~9 ,因此需要长度为 10 的桶
var mem_arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
// defer mem_arena.deinit();
const mem_allocator = mem_arena.allocator();
var counter = try mem_allocator.alloc(usize, 10);
@memset(counter, 0);
var n = nums.len;
// 借助桶来统计 0~9 各数字的出现次数
for (nums) |num| {
var d: u32 = @bitCast(digit(num, exp)); // 获取 nums[i] 第 k 位,记为 d
counter[d] += 1; // 统计数字 d 的出现次数
}
// 求前缀和,将“出现个数”转换为“数组索引”
var i: usize = 1;
while (i < 10) : (i += 1) {
counter[i] += counter[i - 1];
}
// 倒序遍历,根据桶内统计结果,将各元素填入 res
var res = try mem_allocator.alloc(i32, n);
i = n - 1;
while (i >= 0) : (i -= 1) {
var d: u32 = @bitCast(digit(nums[i], exp));
var j = counter[d] - 1; // 获取 d 在数组中的索引 j
res[j] = nums[i]; // 将当前元素填入索引 j
counter[d] -= 1; // 将 d 的数量减 1
if (i == 0) break;
}
// 使用结果覆盖原数组 nums
i = 0;
while (i < n) : (i += 1) {
nums[i] = res[i];
}
}
// 基数排序
fn radixSort(nums: []i32) !void {
// 获取数组的最大元素,用于判断最大位数
var m: i32 = std.math.minInt(i32);
for (nums) |num| {
if (num > m) m = num;
}
// 按照从低位到高位的顺序遍历
var exp: i32 = 1;
while (exp <= m) : (exp *= 10) {
// 对数组元素的第 k 位执行计数排序
// k = 1 -> exp = 1
// k = 2 -> exp = 10
// 即 exp = 10^(k-1)
try countingSortDigit(nums, exp);
}
}
// Driver Code
pub fn main() !void {
// 基数排序
var nums = [_]i32{ 23, 12, 3, 4, 788, 192 };
try radixSort(&nums);
std.debug.print("基数排序完成后 nums = ", .{});
inc.PrintUtil.printArray(i32, &nums);
_ = try std.io.getStdIn().reader().readByte();
} |
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_sorting/insertion_sort.zig | // File: insertion_sort.zig
// Created Time: 2023-01-08
// Author: sjinzh ([email protected])
const std = @import("std");
const inc = @import("include");
// 插入排序
fn insertionSort(nums: []i32) void {
// 外循环:已排序元素数量为 1, 2, ..., n
var i: usize = 1;
while (i < nums.len) : (i += 1) {
var base = nums[i];
var j: usize = i;
// 内循环:将 base 插入到已排序部分的正确位置
while (j >= 1 and nums[j - 1] > base) : (j -= 1) {
nums[j] = nums[j - 1]; // 将 nums[j] 向右移动一位
}
nums[j] = base; // 将 base 赋值到正确位置
}
}
// Driver Code
pub fn main() !void {
var nums = [_]i32{ 4, 1, 3, 1, 5, 2 };
insertionSort(&nums);
std.debug.print("插入排序完成后 nums = ", .{});
inc.PrintUtil.printArray(i32, &nums);
_ = try std.io.getStdIn().reader().readByte();
} |
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_sorting/bubble_sort.zig | // File: bubble_sort.zig
// Created Time: 2023-01-08
// Author: sjinzh ([email protected])
const std = @import("std");
const inc = @import("include");
// 冒泡排序
fn bubbleSort(nums: []i32) void {
// 外循环:未排序区间为 [0, i]
var i: usize = nums.len - 1;
while (i > 0) : (i -= 1) {
var j: usize = 0;
// 内循环:将未排序区间 [0, i] 中的最大元素交换至该区间的最右端
while (j < i) : (j += 1) {
if (nums[j] > nums[j + 1]) {
// 交换 nums[j] 与 nums[j + 1]
var tmp = nums[j];
nums[j] = nums[j + 1];
nums[j + 1] = tmp;
}
}
}
}
// 冒泡排序(标志优化)
fn bubbleSortWithFlag(nums: []i32) void {
// 外循环:未排序区间为 [0, i]
var i: usize = nums.len - 1;
while (i > 0) : (i -= 1) {
var flag = false; // 初始化标志位
var j: usize = 0;
// 内循环:将未排序区间 [0, i] 中的最大元素交换至该区间的最右端
while (j < i) : (j += 1) {
if (nums[j] > nums[j + 1]) {
// 交换 nums[j] 与 nums[j + 1]
var tmp = nums[j];
nums[j] = nums[j + 1];
nums[j + 1] = tmp;
flag = true;
}
}
if (!flag) break; // 此轮冒泡未交换任何元素,直接跳出
}
}
// Driver Code
pub fn main() !void {
var nums = [_]i32{ 4, 1, 3, 1, 5, 2 };
bubbleSort(&nums);
std.debug.print("冒泡排序完成后 nums = ", .{});
inc.PrintUtil.printArray(i32, &nums);
var nums1 = [_]i32{ 4, 1, 3, 1, 5, 2 };
bubbleSortWithFlag(&nums1);
std.debug.print("\n冒泡排序完成后 nums1 = ", .{});
inc.PrintUtil.printArray(i32, &nums1);
_ = try std.io.getStdIn().reader().readByte();
} |
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_sorting/merge_sort.zig | // File: merge_sort.zig
// Created Time: 2023-01-15
// Author: sjinzh ([email protected])
const std = @import("std");
const inc = @import("include");
// 合并左子数组和右子数组
// 左子数组区间 [left, mid]
// 右子数组区间 [mid + 1, right]
fn merge(nums: []i32, left: usize, mid: usize, right: usize) !void {
// 初始化辅助数组
var mem_arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer mem_arena.deinit();
const mem_allocator = mem_arena.allocator();
var tmp = try mem_allocator.alloc(i32, right + 1 - left);
std.mem.copy(i32, tmp, nums[left..right+1]);
// 左子数组的起始索引和结束索引
var leftStart = left - left;
var leftEnd = mid - left;
// 右子数组的起始索引和结束索引
var rightStart = mid + 1 - left;
var rightEnd = right - left;
// i, j 分别指向左子数组、右子数组的首元素
var i = leftStart;
var j = rightStart;
// 通过覆盖原数组 nums 来合并左子数组和右子数组
var k = left;
while (k <= right) : (k += 1) {
// 若“左子数组已全部合并完”,则选取右子数组元素,并且 j++
if (i > leftEnd) {
nums[k] = tmp[j];
j += 1;
// 否则,若“右子数组已全部合并完”或“左子数组元素 <= 右子数组元素”,则选取左子数组元素,并且 i++
} else if (j > rightEnd or tmp[i] <= tmp[j]) {
nums[k] = tmp[i];
i += 1;
// 否则,若“左右子数组都未全部合并完”且“左子数组元素 > 右子数组元素”,则选取右子数组元素,并且 j++
} else {
nums[k] = tmp[j];
j += 1;
}
}
}
// 归并排序
fn mergeSort(nums: []i32, left: usize, right: usize) !void {
// 终止条件
if (left >= right) return; // 当子数组长度为 1 时终止递归
// 划分阶段
var mid = (left + right) / 2; // 计算中点
try mergeSort(nums, left, mid); // 递归左子数组
try mergeSort(nums, mid + 1, right); // 递归右子数组
// 合并阶段
try merge(nums, left, mid, right);
}
// Driver Code
pub fn main() !void {
// 归并排序
var nums = [_]i32{ 7, 3, 2, 6, 0, 1, 5, 4 };
try mergeSort(&nums, 0, nums.len - 1);
std.debug.print("归并排序完成后 nums = ", .{});
inc.PrintUtil.printArray(i32, &nums);
_ = try std.io.getStdIn().reader().readByte();
} |
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_stack_and_queue/stack.zig | // File: stack.zig
// Created Time: 2023-01-08
// Author: sjinzh ([email protected])
const std = @import("std");
const inc = @import("include");
// Driver Code
pub fn main() !void {
// 初始化栈
// 在 zig 中,推荐将 ArrayList 当作栈来使用
var stack = std.ArrayList(i32).init(std.heap.page_allocator);
// 延迟释放内存
defer stack.deinit();
// 元素入栈
try stack.append(1);
try stack.append(3);
try stack.append(2);
try stack.append(5);
try stack.append(4);
std.debug.print("栈 stack = ", .{});
inc.PrintUtil.printList(i32, stack);
// 访问栈顶元素
var peek = stack.items[stack.items.len - 1];
std.debug.print("\n栈顶元素 peek = {}", .{peek});
// 元素出栈
var pop = stack.pop();
std.debug.print("\n出栈元素 pop = {},出栈后 stack = ", .{pop});
inc.PrintUtil.printList(i32, stack);
// 获取栈的长度
var size = stack.items.len;
std.debug.print("\n栈的长度 size = {}", .{size});
// 判断栈是否为空
var is_empty = if (stack.items.len == 0) true else false;
std.debug.print("\n栈是否为空 = {}", .{is_empty});
_ = try std.io.getStdIn().reader().readByte();
}
|
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_stack_and_queue/linkedlist_queue.zig | // File: linkedlist_queue.zig
// Created Time: 2023-01-15
// Author: sjinzh ([email protected])
const std = @import("std");
const inc = @import("include");
// 基于链表实现的队列
pub fn LinkedListQueue(comptime T: type) type {
return struct {
const Self = @This();
front: ?*inc.ListNode(T) = null, // 头节点 front
rear: ?*inc.ListNode(T) = null, // 尾节点 rear
que_size: usize = 0, // 队列的长度
mem_arena: ?std.heap.ArenaAllocator = null,
mem_allocator: std.mem.Allocator = undefined, // 内存分配器
// 构造函数(分配内存+初始化队列)
pub fn init(self: *Self, allocator: std.mem.Allocator) !void {
if (self.mem_arena == null) {
self.mem_arena = std.heap.ArenaAllocator.init(allocator);
self.mem_allocator = self.mem_arena.?.allocator();
}
self.front = null;
self.rear = null;
self.que_size = 0;
}
// 析构函数(释放内存)
pub fn deinit(self: *Self) void {
if (self.mem_arena == null) return;
self.mem_arena.?.deinit();
}
// 获取队列的长度
pub fn size(self: *Self) usize {
return self.que_size;
}
// 判断队列是否为空
pub fn isEmpty(self: *Self) bool {
return self.size() == 0;
}
// 访问队首元素
pub fn peek(self: *Self) T {
if (self.size() == 0) @panic("队列为空");
return self.front.?.val;
}
// 入队
pub fn push(self: *Self, num: T) !void {
// 尾节点后添加 num
var node = try self.mem_allocator.create(inc.ListNode(T));
node.init(num);
// 如果队列为空,则令头、尾节点都指向该节点
if (self.front == null) {
self.front = node;
self.rear = node;
// 如果队列不为空,则将该节点添加到尾节点后
} else {
self.rear.?.next = node;
self.rear = node;
}
self.que_size += 1;
}
// 出队
pub fn pop(self: *Self) T {
var num = self.peek();
// 删除头节点
self.front = self.front.?.next;
self.que_size -= 1;
return num;
}
// 将链表转换为数组
pub fn toArray(self: *Self) ![]T {
var node = self.front;
var res = try self.mem_allocator.alloc(T, self.size());
@memset(res, @as(T, 0));
var i: usize = 0;
while (i < res.len) : (i += 1) {
res[i] = node.?.val;
node = node.?.next;
}
return res;
}
};
}
// Driver Code
pub fn main() !void {
// 初始化队列
var queue = LinkedListQueue(i32){};
try queue.init(std.heap.page_allocator);
defer queue.deinit();
// 元素入队
try queue.push(1);
try queue.push(3);
try queue.push(2);
try queue.push(5);
try queue.push(4);
std.debug.print("队列 queue = ", .{});
inc.PrintUtil.printArray(i32, try queue.toArray());
// 访问队首元素
var peek = queue.peek();
std.debug.print("\n队首元素 peek = {}", .{peek});
// 元素出队
var pop = queue.pop();
std.debug.print("\n出队元素 pop = {},出队后 queue = ", .{pop});
inc.PrintUtil.printArray(i32, try queue.toArray());
// 获取队列的长度
var size = queue.size();
std.debug.print("\n队列长度 size = {}", .{size});
// 判断队列是否为空
var is_empty = queue.isEmpty();
std.debug.print("\n队列是否为空 = {}", .{is_empty});
_ = try std.io.getStdIn().reader().readByte();
}
|
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_stack_and_queue/deque.zig | // File: deque.zig
// Created Time: 2023-01-15
// Author: sjinzh ([email protected])
const std = @import("std");
const inc = @import("include");
// Driver Code
pub fn main() !void {
// 初始化双向队列
const L = std.TailQueue(i32);
var deque = L{};
// 元素入队
var node1 = L.Node{ .data = 2 };
var node2 = L.Node{ .data = 5 };
var node3 = L.Node{ .data = 4 };
var node4 = L.Node{ .data = 3 };
var node5 = L.Node{ .data = 1 };
deque.append(&node1); // 添加至队尾
deque.append(&node2);
deque.append(&node3);
deque.prepend(&node4); // 添加至队首
deque.prepend(&node5);
std.debug.print("双向队列 deque = ", .{});
inc.PrintUtil.printQueue(i32, deque);
// 访问元素
var peek_first = deque.first.?.data; // 队首元素
std.debug.print("\n队首元素 peek_first = {}", .{peek_first});
var peek_last = deque.last.?.data; // 队尾元素
std.debug.print("\n队尾元素 peek_last = {}", .{peek_last});
// 元素出队
var pop_first = deque.popFirst().?.data; // 队首元素出队
std.debug.print("\n队首出队元素 pop_first = {},队首出队后 deque = ", .{pop_first});
inc.PrintUtil.printQueue(i32, deque);
var pop_last = deque.pop().?.data; // 队尾元素出队
std.debug.print("\n队尾出队元素 pop_last = {},队尾出队后 deque = ", .{pop_last});
inc.PrintUtil.printQueue(i32, deque);
// 获取双向队列的长度
var size = deque.len;
std.debug.print("\n双向队列长度 size = {}", .{size});
// 判断双向队列是否为空
var is_empty = if (deque.len == 0) true else false;
std.debug.print("\n双向队列是否为空 = {}", .{is_empty});
_ = try std.io.getStdIn().reader().readByte();
}
|
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_stack_and_queue/linkedlist_deque.zig | // File: linkedlist_deque.zig
// Created Time: 2023-01-15
// Author: sjinzh ([email protected])
const std = @import("std");
const inc = @import("include");
// 双向链表节点
pub fn ListNode(comptime T: type) type {
return struct {
const Self = @This();
val: T = undefined, // 节点值
next: ?*Self = null, // 后继节点引用(指针)
prev: ?*Self = null, // 前驱节点引用(指针)
// Initialize a list node with specific value
pub fn init(self: *Self, x: i32) void {
self.val = x;
self.next = null;
self.prev = null;
}
};
}
// 基于双向链表实现的双向队列
pub fn LinkedListDeque(comptime T: type) type {
return struct {
const Self = @This();
front: ?*ListNode(T) = null, // 头节点 front
rear: ?*ListNode(T) = null, // 尾节点 rear
que_size: usize = 0, // 双向队列的长度
mem_arena: ?std.heap.ArenaAllocator = null,
mem_allocator: std.mem.Allocator = undefined, // 内存分配器
// 构造函数(分配内存+初始化队列)
pub fn init(self: *Self, allocator: std.mem.Allocator) !void {
if (self.mem_arena == null) {
self.mem_arena = std.heap.ArenaAllocator.init(allocator);
self.mem_allocator = self.mem_arena.?.allocator();
}
self.front = null;
self.rear = null;
self.que_size = 0;
}
// 析构函数(释放内存)
pub fn deinit(self: *Self) void {
if (self.mem_arena == null) return;
self.mem_arena.?.deinit();
}
// 获取双向队列的长度
pub fn size(self: *Self) usize {
return self.que_size;
}
// 判断双向队列是否为空
pub fn isEmpty(self: *Self) bool {
return self.size() == 0;
}
// 入队操作
pub fn push(self: *Self, num: T, is_front: bool) !void {
var node = try self.mem_allocator.create(ListNode(T));
node.init(num);
// 若链表为空,则令 front, rear 都指向 node
if (self.isEmpty()) {
self.front = node;
self.rear = node;
// 队首入队操作
} else if (is_front) {
// 将 node 添加至链表头部
self.front.?.prev = node;
node.next = self.front;
self.front = node; // 更新头节点
// 队尾入队操作
} else {
// 将 node 添加至链表尾部
self.rear.?.next = node;
node.prev = self.rear;
self.rear = node; // 更新尾节点
}
self.que_size += 1; // 更新队列长度
}
// 队首入队
pub fn pushFirst(self: *Self, num: T) !void {
try self.push(num, true);
}
// 队尾入队
pub fn pushLast(self: *Self, num: T) !void {
try self.push(num, false);
}
// 出队操作
pub fn pop(self: *Self, is_front: bool) T {
if (self.isEmpty()) @panic("双向队列为空");
var val: T = undefined;
// 队首出队操作
if (is_front) {
val = self.front.?.val; // 暂存头节点值
// 删除头节点
var fNext = self.front.?.next;
if (fNext != null) {
fNext.?.prev = null;
self.front.?.next = null;
}
self.front = fNext; // 更新头节点
// 队尾出队操作
} else {
val = self.rear.?.val; // 暂存尾节点值
// 删除尾节点
var rPrev = self.rear.?.prev;
if (rPrev != null) {
rPrev.?.next = null;
self.rear.?.prev = null;
}
self.rear = rPrev; // 更新尾节点
}
self.que_size -= 1; // 更新队列长度
return val;
}
// 队首出队
pub fn popFirst(self: *Self) T {
return self.pop(true);
}
// 队尾出队
pub fn popLast(self: *Self) T {
return self.pop(false);
}
// 访问队首元素
pub fn peekFirst(self: *Self) T {
if (self.isEmpty()) @panic("双向队列为空");
return self.front.?.val;
}
// 访问队尾元素
pub fn peekLast(self: *Self) T {
if (self.isEmpty()) @panic("双向队列为空");
return self.rear.?.val;
}
// 返回数组用于打印
pub fn toArray(self: *Self) ![]T {
var node = self.front;
var res = try self.mem_allocator.alloc(T, self.size());
@memset(res, @as(T, 0));
var i: usize = 0;
while (i < res.len) : (i += 1) {
res[i] = node.?.val;
node = node.?.next;
}
return res;
}
};
}
// Driver Code
pub fn main() !void {
// 初始化双向队列
var deque = LinkedListDeque(i32){};
try deque.init(std.heap.page_allocator);
defer deque.deinit();
try deque.pushLast(3);
try deque.pushLast(2);
try deque.pushLast(5);
std.debug.print("双向队列 deque = ", .{});
inc.PrintUtil.printArray(i32, try deque.toArray());
// 访问元素
var peek_first = deque.peekFirst();
std.debug.print("\n队首元素 peek_first = {}", .{peek_first});
var peek_last = deque.peekLast();
std.debug.print("\n队尾元素 peek_last = {}", .{peek_last});
// 元素入队
try deque.pushLast(4);
std.debug.print("\n元素 4 队尾入队后 deque = ", .{});
inc.PrintUtil.printArray(i32, try deque.toArray());
try deque.pushFirst(1);
std.debug.print("\n元素 1 队首入队后 deque = ", .{});
inc.PrintUtil.printArray(i32, try deque.toArray());
// 元素出队
var pop_last = deque.popLast();
std.debug.print("\n队尾出队元素 = {},队尾出队后 deque = ", .{pop_last});
inc.PrintUtil.printArray(i32, try deque.toArray());
var pop_first = deque.popFirst();
std.debug.print("\n队首出队元素 = {},队首出队后 deque = ", .{pop_first});
inc.PrintUtil.printArray(i32, try deque.toArray());
// 获取双向队列的长度
var size = deque.size();
std.debug.print("\n双向队列长度 size = {}", .{size});
// 判断双向队列是否为空
var is_empty = deque.isEmpty();
std.debug.print("\n双向队列是否为空 = {}", .{is_empty});
_ = try std.io.getStdIn().reader().readByte();
}
|
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_stack_and_queue/linkedlist_stack.zig | // File: linkedlist_stack.zig
// Created Time: 2023-01-08
// Author: sjinzh ([email protected])
const std = @import("std");
const inc = @import("include");
// 基于链表实现的栈
pub fn LinkedListStack(comptime T: type) type {
return struct {
const Self = @This();
stack_top: ?*inc.ListNode(T) = null, // 将头节点作为栈顶
stk_size: usize = 0, // 栈的长度
mem_arena: ?std.heap.ArenaAllocator = null,
mem_allocator: std.mem.Allocator = undefined, // 内存分配器
// 构造函数(分配内存+初始化栈)
pub fn init(self: *Self, allocator: std.mem.Allocator) !void {
if (self.mem_arena == null) {
self.mem_arena = std.heap.ArenaAllocator.init(allocator);
self.mem_allocator = self.mem_arena.?.allocator();
}
self.stack_top = null;
self.stk_size = 0;
}
// 析构函数(释放内存)
pub fn deinit(self: *Self) void {
if (self.mem_arena == null) return;
self.mem_arena.?.deinit();
}
// 获取栈的长度
pub fn size(self: *Self) usize {
return self.stk_size;
}
// 判断栈是否为空
pub fn isEmpty(self: *Self) bool {
return self.size() == 0;
}
// 访问栈顶元素
pub fn peek(self: *Self) T {
if (self.size() == 0) @panic("栈为空");
return self.stack_top.?.val;
}
// 入栈
pub fn push(self: *Self, num: T) !void {
var node = try self.mem_allocator.create(inc.ListNode(T));
node.init(num);
node.next = self.stack_top;
self.stack_top = node;
self.stk_size += 1;
}
// 出栈
pub fn pop(self: *Self) T {
var num = self.peek();
self.stack_top = self.stack_top.?.next;
self.stk_size -= 1;
return num;
}
// 将栈转换为数组
pub fn toArray(self: *Self) ![]T {
var node = self.stack_top;
var res = try self.mem_allocator.alloc(T, self.size());
@memset(res, @as(T, 0));
var i: usize = 0;
while (i < res.len) : (i += 1) {
res[res.len - i - 1] = node.?.val;
node = node.?.next;
}
return res;
}
};
}
// Driver Code
pub fn main() !void {
// 初始化栈
var stack = LinkedListStack(i32){};
try stack.init(std.heap.page_allocator);
// 延迟释放内存
defer stack.deinit();
// 元素入栈
try stack.push(1);
try stack.push(3);
try stack.push(2);
try stack.push(5);
try stack.push(4);
std.debug.print("栈 stack = ", .{});
inc.PrintUtil.printArray(i32, try stack.toArray());
// 访问栈顶元素
var peek = stack.peek();
std.debug.print("\n栈顶元素 peek = {}", .{peek});
// 元素出栈
var pop = stack.pop();
std.debug.print("\n出栈元素 pop = {},出栈后 stack = ", .{pop});
inc.PrintUtil.printArray(i32, try stack.toArray());
// 获取栈的长度
var size = stack.size();
std.debug.print("\n栈的长度 size = {}", .{size});
// 判断栈是否为空
var is_empty = stack.isEmpty();
std.debug.print("\n栈是否为空 = {}", .{is_empty});
_ = try std.io.getStdIn().reader().readByte();
}
|
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_stack_and_queue/array_stack.zig | // File: array_stack.zig
// Created Time: 2023-01-08
// Author: sjinzh ([email protected])
const std = @import("std");
const inc = @import("include");
// 基于数组实现的栈
pub fn ArrayStack(comptime T: type) type {
return struct {
const Self = @This();
stack: ?std.ArrayList(T) = null,
// 构造函数(分配内存+初始化栈)
pub fn init(self: *Self, allocator: std.mem.Allocator) void {
if (self.stack == null) {
self.stack = std.ArrayList(T).init(allocator);
}
}
// 析构函数(释放内存)
pub fn deinit(self: *Self) void {
if (self.stack == null) return;
self.stack.?.deinit();
}
// 获取栈的长度
pub fn size(self: *Self) usize {
return self.stack.?.items.len;
}
// 判断栈是否为空
pub fn isEmpty(self: *Self) bool {
return self.size() == 0;
}
// 访问栈顶元素
pub fn peek(self: *Self) T {
if (self.isEmpty()) @panic("栈为空");
return self.stack.?.items[self.size() - 1];
}
// 入栈
pub fn push(self: *Self, num: T) !void {
try self.stack.?.append(num);
}
// 出栈
pub fn pop(self: *Self) T {
var num = self.stack.?.pop();
return num;
}
// 返回 ArrayList
pub fn toList(self: *Self) std.ArrayList(T) {
return self.stack.?;
}
};
}
// Driver Code
pub fn main() !void {
// 初始化栈
var stack = ArrayStack(i32){};
stack.init(std.heap.page_allocator);
// 延迟释放内存
defer stack.deinit();
// 元素入栈
try stack.push(1);
try stack.push(3);
try stack.push(2);
try stack.push(5);
try stack.push(4);
std.debug.print("栈 stack = ", .{});
inc.PrintUtil.printList(i32, stack.toList());
// 访问栈顶元素
var peek = stack.peek();
std.debug.print("\n栈顶元素 peek = {}", .{peek});
// 元素出栈
var top = stack.pop();
std.debug.print("\n出栈元素 pop = {},出栈后 stack = ", .{top});
inc.PrintUtil.printList(i32, stack.toList());
// 获取栈的长度
var size = stack.size();
std.debug.print("\n栈的长度 size = {}", .{size});
// 判断栈是否为空
var is_empty = stack.isEmpty();
std.debug.print("\n栈是否为空 = {}", .{is_empty});
_ = try std.io.getStdIn().reader().readByte();
} |
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_stack_and_queue/queue.zig | // File: queue.zig
// Created Time: 2023-01-15
// Author: sjinzh ([email protected])
const std = @import("std");
const inc = @import("include");
// Driver Code
pub fn main() !void {
// 初始化队列
const L = std.TailQueue(i32);
var queue = L{};
// 元素入队
var node1 = L.Node{ .data = 1 };
var node2 = L.Node{ .data = 3 };
var node3 = L.Node{ .data = 2 };
var node4 = L.Node{ .data = 5 };
var node5 = L.Node{ .data = 4 };
queue.append(&node1);
queue.append(&node2);
queue.append(&node3);
queue.append(&node4);
queue.append(&node5);
std.debug.print("队列 queue = ", .{});
inc.PrintUtil.printQueue(i32, queue);
// 访问队首元素
var peek = queue.first.?.data;
std.debug.print("\n队首元素 peek = {}", .{peek});
// 元素出队
var pop = queue.popFirst().?.data;
std.debug.print("\n出队元素 pop = {},出队后 queue = ", .{pop});
inc.PrintUtil.printQueue(i32, queue);
// 获取队列的长度
var size = queue.len;
std.debug.print("\n队列长度 size = {}", .{size});
// 判断队列是否为空
var is_empty = if (queue.len == 0) true else false;
std.debug.print("\n队列是否为空 = {}", .{is_empty});
_ = try std.io.getStdIn().reader().readByte();
}
|
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_stack_and_queue/array_queue.zig | // File: array_queue.zig
// Created Time: 2023-01-15
// Author: sjinzh ([email protected])
const std = @import("std");
const inc = @import("include");
// 基于环形数组实现的队列
pub fn ArrayQueue(comptime T: type) type {
return struct {
const Self = @This();
nums: []T = undefined, // 用于存储队列元素的数组
cap: usize = 0, // 队列容量
front: usize = 0, // 队首指针,指向队首元素
queSize: usize = 0, // 尾指针,指向队尾 + 1
mem_arena: ?std.heap.ArenaAllocator = null,
mem_allocator: std.mem.Allocator = undefined, // 内存分配器
// 构造函数(分配内存+初始化数组)
pub fn init(self: *Self, allocator: std.mem.Allocator, cap: usize) !void {
if (self.mem_arena == null) {
self.mem_arena = std.heap.ArenaAllocator.init(allocator);
self.mem_allocator = self.mem_arena.?.allocator();
}
self.cap = cap;
self.nums = try self.mem_allocator.alloc(T, self.cap);
@memset(self.nums, @as(T, 0));
}
// 析构函数(释放内存)
pub fn deinit(self: *Self) void {
if (self.mem_arena == null) return;
self.mem_arena.?.deinit();
}
// 获取队列的容量
pub fn capacity(self: *Self) usize {
return self.cap;
}
// 获取队列的长度
pub fn size(self: *Self) usize {
return self.queSize;
}
// 判断队列是否为空
pub fn isEmpty(self: *Self) bool {
return self.queSize == 0;
}
// 入队
pub fn push(self: *Self, num: T) !void {
if (self.size() == self.capacity()) {
std.debug.print("队列已满\n", .{});
return;
}
// 计算尾指针,指向队尾索引 + 1
// 通过取余操作,实现 rear 越过数组尾部后回到头部
var rear = (self.front + self.queSize) % self.capacity();
// 尾节点后添加 num
self.nums[rear] = num;
self.queSize += 1;
}
// 出队
pub fn pop(self: *Self) T {
var num = self.peek();
// 队首指针向后移动一位,若越过尾部则返回到数组头部
self.front = (self.front + 1) % self.capacity();
self.queSize -= 1;
return num;
}
// 访问队首元素
pub fn peek(self: *Self) T {
if (self.isEmpty()) @panic("队列为空");
return self.nums[self.front];
}
// 返回数组
pub fn toArray(self: *Self) ![]T {
// 仅转换有效长度范围内的列表元素
var res = try self.mem_allocator.alloc(T, self.size());
@memset(res, @as(T, 0));
var i: usize = 0;
var j: usize = self.front;
while (i < self.size()) : ({ i += 1; j += 1; }) {
res[i] = self.nums[j % self.capacity()];
}
return res;
}
};
}
// Driver Code
pub fn main() !void {
// 初始化队列
var capacity: usize = 10;
var queue = ArrayQueue(i32){};
try queue.init(std.heap.page_allocator, capacity);
defer queue.deinit();
// 元素入队
try queue.push(1);
try queue.push(3);
try queue.push(2);
try queue.push(5);
try queue.push(4);
std.debug.print("队列 queue = ", .{});
inc.PrintUtil.printArray(i32, try queue.toArray());
// 访问队首元素
var peek = queue.peek();
std.debug.print("\n队首元素 peek = {}", .{peek});
// 元素出队
var pop = queue.pop();
std.debug.print("\n出队元素 pop = {},出队后 queue = ", .{pop});
inc.PrintUtil.printArray(i32, try queue.toArray());
// 获取队列的长度
var size = queue.size();
std.debug.print("\n队列长度 size = {}", .{size});
// 判断队列是否为空
var is_empty = queue.isEmpty();
std.debug.print("\n队列是否为空 = {}", .{is_empty});
// 测试环形数组
var i: i32 = 0;
while (i < 10) : (i += 1) {
try queue.push(i);
_ = queue.pop();
std.debug.print("\n第 {} 轮入队 + 出队后 queue = ", .{i});
inc.PrintUtil.printArray(i32, try queue.toArray());
}
_ = try std.io.getStdIn().reader().readByte();
} |
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_computational_complexity/worst_best_time_complexity.zig | // File: worst_best_time_complexity.zig
// Created Time: 2022-12-28
// Author: sjinzh ([email protected])
const std = @import("std");
const inc = @import("include");
// 生成一个数组,元素为 { 1, 2, ..., n },顺序被打乱
pub fn randomNumbers(comptime n: usize) [n]i32 {
var nums: [n]i32 = undefined;
// 生成数组 nums = { 1, 2, 3, ..., n }
for (&nums, 0..) |*num, i| {
num.* = @as(i32, @intCast(i)) + 1;
}
// 随机打乱数组元素
const rand = std.crypto.random;
rand.shuffle(i32, &nums);
return nums;
}
// 查找数组 nums 中数字 1 所在索引
pub fn findOne(nums: []i32) i32 {
for (nums, 0..) |num, i| {
// 当元素 1 在数组头部时,达到最佳时间复杂度 O(1)
// 当元素 1 在数组尾部时,达到最差时间复杂度 O(n)
if (num == 1) return @intCast(i);
}
return -1;
}
// Driver Code
pub fn main() !void {
var i: i32 = 0;
while (i < 10) : (i += 1) {
const n: usize = 100;
var nums = randomNumbers(n);
var index = findOne(&nums);
std.debug.print("\n数组 [ 1, 2, ..., n ] 被打乱后 = ", .{});
inc.PrintUtil.printArray(i32, &nums);
std.debug.print("\n数字 1 的索引为 {}\n", .{index});
}
_ = try std.io.getStdIn().reader().readByte();
}
|
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_computational_complexity/time_complexity.zig | // File: time_complexity.zig
// Created Time: 2022-12-28
// Author: sjinzh ([email protected])
const std = @import("std");
// 常数阶
fn constant(n: i32) i32 {
_ = n;
var count: i32 = 0;
const size: i32 = 100_000;
var i: i32 = 0;
while(i < size) : (i += 1) {
count += 1;
}
return count;
}
// 线性阶
fn linear(n: i32) i32 {
var count: i32 = 0;
var i: i32 = 0;
while (i < n) : (i += 1) {
count += 1;
}
return count;
}
// 线性阶(遍历数组)
fn arrayTraversal(nums: []i32) i32 {
var count: i32 = 0;
// 循环次数与数组长度成正比
for (nums) |_| {
count += 1;
}
return count;
}
// 平方阶
fn quadratic(n: i32) i32 {
var count: i32 = 0;
var i: i32 = 0;
// 循环次数与数组长度成平方关系
while (i < n) : (i += 1) {
var j: i32 = 0;
while (j < n) : (j += 1) {
count += 1;
}
}
return count;
}
// 平方阶(冒泡排序)
fn bubbleSort(nums: []i32) i32 {
var count: i32 = 0; // 计数器
// 外循环:待排序元素数量为 n-1, n-2, ..., 1
var i: i32 = @as(i32, @intCast(nums.len)) - 1;
while (i > 0) : (i -= 1) {
var j: usize = 0;
// 内循环:冒泡操作
while (j < i) : (j += 1) {
if (nums[j] > nums[j + 1]) {
// 交换 nums[j] 与 nums[j + 1]
var tmp = nums[j];
nums[j] = nums[j + 1];
nums[j + 1] = tmp;
count += 3; // 元素交换包含 3 个单元操作
}
}
}
return count;
}
// 指数阶(循环实现)
fn exponential(n: i32) i32 {
var count: i32 = 0;
var base: i32 = 1;
var i: i32 = 0;
// cell 每轮一分为二,形成数列 1, 2, 4, 8, ..., 2^(n-1)
while (i < n) : (i += 1) {
var j: i32 = 0;
while (j < base) : (j += 1) {
count += 1;
}
base *= 2;
}
// count = 1 + 2 + 4 + 8 + .. + 2^(n-1) = 2^n - 1
return count;
}
// 指数阶(递归实现)
fn expRecur(n: i32) i32 {
if (n == 1) return 1;
return expRecur(n - 1) + expRecur(n - 1) + 1;
}
// 对数阶(循环实现)
fn logarithmic(n: f32) i32 {
var count: i32 = 0;
var n_var = n;
while (n_var > 1)
{
n_var = n_var / 2;
count +=1;
}
return count;
}
// 对数阶(递归实现)
fn logRecur(n: f32) i32 {
if (n <= 1) return 0;
return logRecur(n / 2) + 1;
}
// 线性对数阶
fn linearLogRecur(n: f32) i32 {
if (n <= 1) return 1;
var count: i32 = linearLogRecur(n / 2) +
linearLogRecur(n / 2);
var i: f32 = 0;
while (i < n) : (i += 1) {
count += 1;
}
return count;
}
// 阶乘阶(递归实现)
fn factorialRecur(n: i32) i32 {
if (n == 0) return 1;
var count: i32 = 0;
var i: i32 = 0;
// 从 1 个分裂出 n 个
while (i < n) : (i += 1) {
count += factorialRecur(n - 1);
}
return count;
}
// Driver Code
pub fn main() !void {
// 可以修改 n 运行,体会一下各种复杂度的操作数量变化趋势
const n: i32 = 8;
std.debug.print("输入数据大小 n = {}\n", .{n});
var count = constant(n);
std.debug.print("常数阶的计算操作数量 = {}\n", .{count});
count = linear(n);
std.debug.print("线性阶的计算操作数量 = {}\n", .{count});
var nums = [_]i32{0}**n;
count = arrayTraversal(&nums);
std.debug.print("线性阶(遍历数组)的计算操作数量 = {}\n", .{count});
count = quadratic(n);
std.debug.print("平方阶的计算操作数量 = {}\n", .{count});
for (&nums, 0..) |*num, i| {
num.* = n - @as(i32, @intCast(i)); // [n,n-1,...,2,1]
}
count = bubbleSort(&nums);
std.debug.print("平方阶(冒泡排序)的计算操作数量 = {}\n", .{count});
count = exponential(n);
std.debug.print("指数阶(循环实现)的计算操作数量 = {}\n", .{count});
count = expRecur(n);
std.debug.print("指数阶(递归实现)的计算操作数量 = {}\n", .{count});
count = logarithmic(@as(f32, n));
std.debug.print("对数阶(循环实现)的计算操作数量 = {}\n", .{count});
count = logRecur(@as(f32, n));
std.debug.print("对数阶(递归实现)的计算操作数量 = {}\n", .{count});
count = linearLogRecur(@as(f32, n));
std.debug.print("线性对数阶(递归实现)的计算操作数量 = {}\n", .{count});
count = factorialRecur(n);
std.debug.print("阶乘阶(递归实现)的计算操作数量 = {}\n", .{count});
_ = try std.io.getStdIn().reader().readByte();
}
|
0 | repos/hello-algo-zig | repos/hello-algo-zig/chapter_computational_complexity/space_complexity.zig | // File: space_complexity.zig
// Created Time: 2023-01-07
// Author: sjinzh ([email protected])
const std = @import("std");
const inc = @import("include");
// 函数
fn function() i32 {
// do something
return 0;
}
// 常数阶
fn constant(n: i32) void {
// 常量、变量、对象占用 O(1) 空间
const a: i32 = 0;
var b: i32 = 0;
var nums = [_]i32{0}**10000;
var node = inc.ListNode(i32){.val = 0};
var i: i32 = 0;
// 循环中的变量占用 O(1) 空间
while (i < n) : (i += 1) {
var c: i32 = 0;
_ = c;
}
// 循环中的函数占用 O(1) 空间
i = 0;
while (i < n) : (i += 1) {
_ = function();
}
_ = a;
_ = b;
_ = nums;
_ = node;
}
// 线性阶
fn linear(comptime n: i32) !void {
// 长度为 n 的数组占用 O(n) 空间
var nums = [_]i32{0}**n;
// 长度为 n 的列表占用 O(n) 空间
var nodes = std.ArrayList(i32).init(std.heap.page_allocator);
defer nodes.deinit();
var i: i32 = 0;
while (i < n) : (i += 1) {
try nodes.append(i);
}
// 长度为 n 的哈希表占用 O(n) 空间
var map = std.AutoArrayHashMap(i32, []const u8).init(std.heap.page_allocator);
defer map.deinit();
var j: i32 = 0;
while (j < n) : (j += 1) {
const string = try std.fmt.allocPrint(std.heap.page_allocator, "{d}", .{j});
defer std.heap.page_allocator.free(string);
try map.put(i, string);
}
_ = nums;
}
// 线性阶(递归实现)
fn linearRecur(comptime n: i32) void {
std.debug.print("递归 n = {}\n", .{n});
if (n == 1) return;
linearRecur(n - 1);
}
// 平方阶
fn quadratic(n: i32) !void {
// 二维列表占用 O(n^2) 空间
var nodes = std.ArrayList(std.ArrayList(i32)).init(std.heap.page_allocator);
defer nodes.deinit();
var i: i32 = 0;
while (i < n) : (i += 1) {
var tmp = std.ArrayList(i32).init(std.heap.page_allocator);
defer tmp.deinit();
var j: i32 = 0;
while (j < n) : (j += 1) {
try tmp.append(0);
}
try nodes.append(tmp);
}
}
// 平方阶(递归实现)
fn quadraticRecur(comptime n: i32) i32 {
if (n <= 0) return 0;
var nums = [_]i32{0}**n;
std.debug.print("递归 n = {} 中的 nums 长度 = {}\n", .{n, nums.len});
return quadraticRecur(n - 1);
}
// 指数阶(建立满二叉树)
fn buildTree(mem_allocator: std.mem.Allocator, n: i32) !?*inc.TreeNode(i32) {
if (n == 0) return null;
const root = try mem_allocator.create(inc.TreeNode(i32));
root.init(0);
root.left = try buildTree(mem_allocator, n - 1);
root.right = try buildTree(mem_allocator, n - 1);
return root;
}
// Driver Code
pub fn main() !void {
const n: i32 = 5;
// 常数阶
constant(n);
// 线性阶
try linear(n);
linearRecur(n);
// 平方阶
try quadratic(n);
_ = quadraticRecur(n);
// 指数阶
var mem_arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer mem_arena.deinit();
var root = blk_root: {
const mem_allocator = mem_arena.allocator();
break :blk_root try buildTree(mem_allocator, n);
};
try inc.PrintUtil.printTree(root, null, false);
_ = try std.io.getStdIn().reader().readByte();
} |
0 | repos | repos/xmake/CHANGELOG.md | # Changelog ([中文](#中文))
## master (unreleased)
### New features
* [#5462](https://github.com/xmake-io/xmake/pull/5462): Add `xmake l cli.bisect`
* [#5488](https://github.com/xmake-io/xmake/pull/5488): Support for using cosmocc to build xmake binary
* [#5491](https://github.com/xmake-io/xmake/pull/5491): Provide single xmake binary with embeded lua files
### Changes
* [#5507](https://github.com/xmake-io/xmake/issues/5507): Use treeless to improve git.clone
### Bugs fixed
* [#4750](https://github.com/xmake-io/xmake/issues/4750): Fix compile_commands generator for `xmake tests`
* [#5465](https://github.com/xmake-io/xmake/pull/5465): Fix lock package requires
## v2.9.4
### New features
* [#5278](https://github.com/xmake-io/xmake/issues/5278): Add `build.intermediate_directory` policy to disable and custom intermediate directory
* [#5313](https://github.com/xmake-io/xmake/issues/5313): Add windows arm/arm64ec support
* [#5296](https://github.com/xmake-io/xmake/issues/5296): Add Intel LLVM Fortran Compiler support
* [#5384](https://github.com/xmake-io/xmake/issues/5384): Add `add_bindirs` for package
### Changes
* [#5280](https://github.com/xmake-io/xmake/issues/5280): Add missing C++20 Modules file extension
* [#5251](https://github.com/xmake-io/xmake/issues/5251): Update 7z/curl for windows installer
* [#5286](https://github.com/xmake-io/xmake/issues/5286): Improve json to parse hex string
* [#5302](https://github.com/xmake-io/xmake/pull/5302): Improve Vala support
* [#5335](https://github.com/xmake-io/xmake/pull/5335): Improve `xmake install` and `xpack`, Add `set_prefixdir` api for target
* [#5387](https://github.com/xmake-io/xmake/pull/5387): Improve `xmake test`
* [#5376](https://github.com/xmake-io/xmake/pull/5376): Improve module objectfiles handling and moduleonly package
### Bugs Fixed
* [#5288](https://github.com/xmake-io/xmake/issues/5288): Fix `xmake test` for unity build
* [#5270](https://github.com/xmake-io/xmake/issues/5270): Fix pch/include for gcc/clang
* [#5276](https://github.com/xmake-io/xmake/issues/5276): Fix find vc6
* [#5259](https://github.com/xmake-io/xmake/issues/5259): Fix the failure of the command line completion function
## v2.9.3
### New features
* [#4637](https://github.com/xmake-io/xmake/issues/4637): Add mix generator for xpack
* [#5107](https://github.com/xmake-io/xmake/issues/5107): Add deb generator for xpack
* [#5148](https://github.com/xmake-io/xmake/issues/5148): Add on_source in package
### Changes
* [#5156](https://github.com/xmake-io/xmake/issues/5156): Improve to install cargo packages for rust
### Bugs fixed
* [#5176](https://github.com/xmake-io/xmake/pull/5176): Fix VS toolset v144
## v2.9.2
### New features
* [#5005](https://github.com/xmake-io/xmake/pull/5005): Show all apis
* [#5003](https://github.com/xmake-io/xmake/issues/5003): Add build.fence policy
* [#5060](https://github.com/xmake-io/xmake/issues/5060): Support Verilator target build to static library
* [#5074](https://github.com/xmake-io/xmake/pull/5074): Add `xrepo download` command to download package source
* [#5086](https://github.com/xmake-io/xmake/issues/5986): Add check support for package
* [#5103](https://github.com/xmake-io/xmake/pull/5103): Add qt ts files building
* [#5104](https://github.com/xmake-io/xmake/pull/5104): Call where in find_program
### Changes
* [#5077](https://github.com/xmake-io/xmake/issues/5077): Use x64 host compiler for msvc when building x86 target
* [#5109](https://github.com/xmake-io/xmake/issues/5109): Support runpath/rpath for add_rpathdirs
* [#5132](https://github.com/xmake-io/xmake/pull/5132): Improve ifort/icc/icx support on windows
### Bugs Fixed
* [#5059](https://github.com/xmake-io/xmake/issues/5059): Fix load huge targets stuck
* [#5029](https://github.com/xmake-io/xmake/issues/5029): Fix crash on termux
## v2.9.1
### New features
* [#4874](https://github.com/xmake-io/xmake/pull/4874): Add Harmony SDK support
* [#4889](https://github.com/xmake-io/xmake/issues/4889): Add signal module to register signal handler in lua
* [#4925](https://github.com/xmake-io/xmake/issues/4925): Add native modules support
* [#4938](https://github.com/xmake-io/xmake/issues/4938): Support for cppfront/h2
### Changes
* Improve packages to support for clang-cl
* [#4893](https://github.com/xmake-io/xmake/issues/4893): Improve rc includes deps
* [#4928](https://github.com/xmake-io/xmake/issues/4928): Improve to build and link speed
* [#4931](https://github.com/xmake-io/xmake/pull/4931): Update pdcurses
* [#4973](https://github.com/xmake-io/xmake/issues/4973): Improve to select script
### Bugs fixed
* [#4882](https://github.com/xmake-io/xmake/issues/4882): Fix install deps with --group
* [#4877](https://github.com/xmake-io/xmake/issues/4877): Fix compile error for xpack with unity build
* [#4887](https://github.com/xmake-io/xmake/issues/4887): Fix object deps
## v2.8.9
### New features
* [#4843](https://github.com/xmake-io/xmake/issues/4843): Endianness/Byte-order detection on build machine
### Changes
* [#4798](https://github.com/xmake-io/xmake/issues/4798): Improve wasi sdk detect
* [#4772](https://github.com/xmake-io/xmake/issues/4772): Improve tools.cmake to support vs2022 preview (v144)
* [#4813](https://github.com/xmake-io/xmake/issues/4813): Add gb2312 encoding
* [#4864](https://github.com/xmake-io/xmake/issues/4864): Improve to extract symbols for gdb
* [#4831](https://github.com/xmake-io/xmake/issues/4831): Allow target:fileconfig() for headerfiles
* [#4846](https://github.com/xmake-io/xmake/issues/4846): Improve to show progress
### Bugs Fixed
* Fix select_script match pattern
* [#4763](https://github.com/xmake-io/xmake/issues/4763): Fix {force = true}
* [#4807](https://github.com/xmake-io/xmake/issues/4807): Fix nimble::find_package
* [#4857](https://github.com/xmake-io/xmake/issues/4857): Fix parse basic options
## v2.8.8
### Changes
* Add `package:check_sizeof()`
### Bugs Fixed
* [#4774](https://github.com/xmake-io/xmake/issues/4774): Fix android symbol strip
* [#4769](https://github.com/xmake-io/xmake/issues/4769): Fix cross toolchain and format
* [#4776](https://github.com/xmake-io/xmake/issues/4776): Fix soname for linux
* [#4638](https://github.com/xmake-io/xmake/issues/4638): Fix vsxmake with --menu config
## v2.8.7
### New features
* [#4544](https://github.com/xmake-io/xmake/issues/4544): Support to wait process timeout for `xmake test`
* [#4606](https://github.com/xmake-io/xmake/pull/4606): Add `add_versionfiles` api in package
* [#4709](https://github.com/xmake-io/xmake/issues/4709): Add cosmocc toolchain support
* [#4715](https://github.com/xmake-io/xmake/issues/4715): Add is_cross() api in description scope
* [#4747](https://github.com/xmake-io/xmake/issues/4747): Add `build.always_update_configfiles` policy
### Changes
* [#4575](https://github.com/xmake-io/xmake/issues/4575): Check invalid scope name
* Add more loong64 support
* Improve dlang/dmd support for frameworks
* [#4571](https://github.com/xmake-io/xmake/issues/4571): Improve `xmake test` output
* [#4609](https://github.com/xmake-io/xmake/issues/4609): Improve to detect vs build tool envirnoments
* [#4614](https://github.com/xmake-io/xmake/issues/4614): Support android ndk 26b
* [#4473](https://github.com/xmake-io/xmake/issues/4473): Enable warning output by default
* [#4477](https://github.com/xmake-io/xmake/issues/4477): Improve runtimes to support libc++/libstdc++
* [#4657](https://github.com/xmake-io/xmake/issues/4657): Improve to select script pattern
* [#4673](https://github.com/xmake-io/xmake/pull/4673): Refactor modules support
* [#4746](https://github.com/xmake-io/xmake/pull/4746): Add native modules support for cmake generator
### Bugs Fixed
* [#4596](https://github.com/xmake-io/xmake/issues/4596): Fix remote build cache
* [#4689](https://github.com/xmake-io/xmake/issues/4689): Fix deps inherit
## v2.8.6
### New features
* Add `network.mode` policy
* [#1433](https://github.com/xmake-io/xmake/issues/1433): Add `xmake pack` command to generate NSIS/zip/tar.gz/rpm/srpm/runself packages like cmake/cpack
* [#4435](https://github.com/xmake-io/xmake/issues/4435): Support batchsize for UnityBuild in Group Mode
* [#4485](https://github.com/xmake-io/xmake/pull/4485): Support package.install_locally
* Support NetBSD
### Changes
* [#4484](https://github.com/xmake-io/xmake/pull/4484): Improve swig rule
* Improve Haiku support
### Bugs fixed
* [#4372](https://github.com/xmake-io/xmake/issues/4372): Fix protobuf rules
* [#4439](https://github.com/xmake-io/xmake/issues/4439): Fix asn1c rules
## v2.8.5
### New features
* [#1452](https://github.com/xmake-io/xmake/issues/1452): Improve link mechanism and order
* [#1438](https://github.com/xmake-io/xmake/issues/1438): Support code amalgamation
* [#3381](https://github.com/xmake-io/xmake/issues/3381): Add `xmake test` support
* [#4276](https://github.com/xmake-io/xmake/issues/4276): Support custom scope api
* [#4286](https://github.com/xmake-io/xmake/pull/4286): Add Apple XROS support
* [#4345](https://github.com/xmake-io/xmake/issues/4345): Support check sizeof
* [#4369](https://github.com/xmake-io/xmake/pull/4369): Add windows.manifest.uac policy
### Changes
* [#4284](https://github.com/xmake-io/xmake/issues/4284): Improve builtin includes
### Bugs fixed
* [#4256](https://github.com/xmake-io/xmake/issues/4256): Fix intellisense for vsxmake/c++modules
## v2.8.3
### New features
* [#4122](https://github.com/xmake-io/xmake/issues/4122): Support Lua Debugger (EmmyLua)
* [#4132](https://github.com/xmake-io/xmake/pull/4132): Support cppfront
* [#4147](https://github.com/xmake-io/xmake/issues/4147): Add hlsl2spv rule
* [#4226](https://github.com/xmake-io/xmake/issues/4226): Support sanitizers for package and policy
* Add lib.lua.package module
* Add `run.autobuild` policy
* Add global policies `xmake g --policies=`
### Changes
* [#4119](https://github.com/xmake-io/xmake/issues/4119): Improve to support emcc toolchain and emscripten package
* [#4154](https://github.com/xmake-io/xmake/issues/4154): Add `xmake -r --shallow target` to rebuild target without deps
* Add global ccache storage directory
* [#4137](https://github.com/xmake-io/xmake/issues/4137): Support Qt6 for Wasm
* [#4173](https://github.com/xmake-io/xmake/issues/4173): Add recheck argument to on_config
* [#4200](https://github.com/xmake-io/xmake/pull/4200): Improve remote build to support debugging xmake source code.
* [#4209](https://github.com/xmake-io/xmake/issues/4209): Add extra and pedantic warnings
### Bugs fixed
* [#4110](https://github.com/xmake-io/xmake/issues/4110): Fix extrafiles
* [#4115](https://github.com/xmake-io/xmake/issues/4115): Fix compile_commands generator for clangd
* [#4199](https://github.com/xmake-io/xmake/pull/4199): Fix compile_commands generator for c++ modules
* Fix os.mv fail on window
* [#4214](https://github.com/xmake-io/xmake/issues/4214): Fix rust workspace build error
## v2.8.2
### New features
* [#4002](https://github.com/xmake-io/xmake/issues/4002): Add soname and version support
* [#1613](https://github.com/xmake-io/xmake/issues/1613): Add avx512 and sse4.2 for add_vectorexts
* [#2471](https://github.com/xmake-io/xmake/issues/2471): Add set_encodings to set source/target encodings
* [#4071](https://github.com/xmake-io/xmake/pull/4071): Support the stm8 assembler on the sdcc toolchain.
* [#4101](https://github.com/xmake-io/xmake/issues/4101): Add force includes for c/c++
* [#2384](https://github.com/xmake-io/xmake/issues/2384): Add extrafiles for vs/vsxmake generator
### Changes
* [#3960](https://github.com/xmake-io/xmake/issues/3960): Improve msys2/crt64 support
* [#4032](https://github.com/xmake-io/xmake/pull/4032): Remove some old deprecated apis
* Improve to upgrade vcproj files in tools.msbuild
* Support add_requires("xmake::xxx") package
* [#4049](https://github.com/xmake-io/xmake/issues/4049): Improve rust to support cross-compilation
* Improve clang modules support
### Bugs fixed
* Fix exit all child processes on macOS/Linux
## v2.8.1
### New features
* [#3821](https://github.com/xmake-io/xmake/pull/3821): Add longpath option for windows installer
* [#3828](https://github.com/xmake-io/xmake/pull/3828): Add support for zypper package manager
* [#3871](https://github.com/xmake-io/xmake/issues/3871): Improve tools.msbuild to support for upgrading vsproj
* [#3148](https://github.com/xmake-io/xmake/issues/3148): Support grpc for protobuf
* [#3889](https://github.com/xmake-io/xmake/issues/3889): Support to add library path for add_links
* [#3912](https://github.com/orgs/xmake-io/issues/3912): Add set_pmxxheader to support objc precompiled header
* add_links support library file path
### Changes
* [#3752](https://github.com/xmake-io/xmake/issues/3752): Improve os.getenvs for windows
* [#3371](https://github.com/xmake-io/xmake/issues/3371): Improve tools.cmake to support ninja generator for wasm
* [#3777](https://github.com/xmake-io/xmake/issues/3777): Improve to find package from pkg-config
* [#3815](https://github.com/xmake-io/xmake/pull/3815): Improve tools.xmake to pass toolchains for windows
* [#3857](https://github.com/xmake-io/xmake/issues/3857): Improve to generate compile_commands.json
* [#3892](https://github.com/xmake-io/xmake/issues/3892): Improve to search packages from description
* [#3916](https://github.com/xmake-io/xmake/issues/3916): Improve to build swift program, support for multiple modules
* Update lua runtime to 5.4.6
### Bugs fixed
* [#3755](https://github.com/xmake-io/xmake/pull/3755): Fix find_tool from xmake/packages
* [#3787](https://github.com/xmake-io/xmake/issues/3787): Fix packages from conan 2.x
* [#3839](https://github.com/orgs/xmake-io/discussions/3839): Fix vs_runtime for conan 2.x
## v2.7.9
### New features
* [#3613](https://github.com/xmake-io/xmake/issues/3613): Add `wasm.preloadfiles` configuration for wasm
* [#3703](https://github.com/xmake-io/xmake/pull/3703): Support for conan >=2.0.5
### Changes
* [#3669](https://github.com/xmake-io/xmake/issues/3669): Improve cmake generator to support add_cxflags with the given tool
* [#3679](https://github.com/xmake-io/xmake/issues/3679): Improve `xrepo clean`
* [#3662](https://github.com/xmake-io/xmake/issues/3662): Improve cmake/make generator for lex/yacc project
* [#3697](https://github.com/xmake-io/xmake/issues/3662): Improve trybuild/cmake
* [#3730](https://github.com/xmake-io/xmake/issues/3730): Improve c++modules package installation
### Bugs fixed
* [#3596](https://github.com/xmake-io/xmake/issues/3596): Fix check_cxxfuncs and check_cxxsnippets
* [#3603](https://github.com/xmake-io/xmake/issues/3603): Fix `xmake update`
* [#3614](https://github.com/xmake-io/xmake/issues/3614): Fix qt envirnoment when running target
* [#3628](https://github.com/xmake-io/xmake/issues/3628): Fix msys2/mingw setenv and os.exec issue
* Fix setenv for msys/mingw
## v2.7.8
### New features
* [#3518](https://github.com/xmake-io/xmake/issues/3518): Profile compile and link performance
* [#3522](https://github.com/xmake-io/xmake/issues/3522): Add has_cflags, has_xxx for target
* [#3537](https://github.com/xmake-io/xmake/issues/3537): Add --fix for clang.tidy checker
### Changes
* [#3433](https://github.com/xmake-io/xmake/issues/3433): Improve to build Qt project on msys2/mingw64 and wasm
* [#3419](https://github.com/xmake-io/xmake/issues/3419): Support fish shell envirnoment
* [#3455](https://github.com/xmake-io/xmake/issues/3455): Dlang incremental build support
* [#3498](https://github.com/xmake-io/xmake/issues/3498): Improve to bind package virtual envirnoments
* [#3504](https://github.com/xmake-io/xmake/pull/3504): Add swig java support
* [#3508](https://github.com/xmake-io/xmake/issues/3508): Improve trybuild/cmake to support for switching toolchain
* disable build cache for msvc, because msvc's preprocessor is too slow.
### Bugs fixed
* [#3436](https://github.com/xmake-io/xmake/issues/3436): Fix complete and menuconf
* [#3463](https://github.com/xmake-io/xmake/issues/3463): Fix c++modules cache issue
* [#3545](https://github.com/xmake-io/xmake/issues/3545): Fix parsedeps for armcc
## v2.7.7
### New features
* Add Haiku support
* [#3326](https://github.com/xmake-io/xmake/issues/3326): Add `xmake check` to check project code (clang-tidy) and configuration
* [#3332](https://github.com/xmake-io/xmake/pull/3332): add custom http headers when downloading packages
### Changes
* [#3318](https://github.com/xmake-io/xmake/pull/3318): Improve dlang toolchains
* [#2591](https://github.com/xmake-io/xmake/issues/2591): Improve target analysis
* [#3342](https://github.com/xmake-io/xmake/issues/3342): Improve to configure working and build directories
* [#3373](https://github.com/xmake-io/xmake/issues/3373): Improve std modules support for clang-17
* Improve to strip/optimization for dmd/ldc2
### Bugs fixed
* [#3317](https://github.com/xmake-io/xmake/pull/3317): Fix languages for qt project.
* [#3321](https://github.com/xmake-io/xmake/issues/3321): Fix dependfile when generating configiles
* [#3296](https://github.com/xmake-io/xmake/issues/3296): Fix build error on macOS arm64
## v2.7.6
### New features
* [#3228](https://github.com/xmake-io/xmake/pull/3228): Add support of importing modules from packages
* [#3257](https://github.com/xmake-io/xmake/issues/3257): Add support for iverilog and verilator
* Support for xp and vc6.0
* [#3214](https://github.com/xmake-io/xmake/pull/3214): Completion on xrepo install packages
### Changes
* [#3255](https://github.com/xmake-io/xmake/pull/3225): Improve clang libc++ module support
* Support for compiling xmake using mingw
* Improve compatibility issues with xmake running on win xp
* Add pure lua json implementation instead of lua-cjson if the external dependencies are enabled
### Bugs fixed
* [#3229](https://github.com/xmake-io/xmake/issues/3229): Fix find rc.exe for vs2015
* [#3271](https://github.com/xmake-io/xmake/issues/3271): Fix macro defines with spaces
* [#3273](https://github.com/xmake-io/xmake/issues/3273): Fix nim link error
* [#3286](https://github.com/xmake-io/xmake/issues/3286): Fix compile_commands for clangd
## v2.7.5
### New features
* [#3201](https://github.com/xmake-io/xmake/pull/3201): Add completer and xrepo complete
* [#3233](https://github.com/xmake-io/xmake/issues/3233): Add MASM32 sdk toolchain
### Changes
* [#3216](https://github.com/xmake-io/xmake/pull/3216): Add intel one api toolkits detection
* [#3020](https://github.com/xmake-io/xmake/issues/3020): Add `--lsp=clangd` to improve to generate compile_commands.json
* [#3215](https://github.com/xmake-io/xmake/issues/3215): Add includedirs and defines to c51
* [#3251](https://github.com/xmake-io/xmake/issues/3251): Improve to build zig and c program
### Bugs fixed
* [#3203](https://github.com/xmake-io/xmake/issues/3203): Fix compile_commands
* [#3222](https://github.com/xmake-io/xmake/issues/3222): Fix precompiled headers in ObjC
* [#3240](https://github.com/xmake-io/xmake/pull/3240): Fix target run with single arguments
* [#3238](https://github.com/xmake-io/xmake/pull/3238): Fix clang module mapper
## v2.7.4
### New features
* [#3049](https://github.com/xmake-io/xmake/pull/3049): Add `xmake format` plugin
* Add `plugin.compile_commands.autoupdate` rule
* [#3172](https://github.com/xmake-io/xmake/pull/3172): Add xmake.sh
* [#3168](https://github.com/xmake-io/xmake/pull/3168): add support of C++23 standard modules on msvc
### Changes
* [#3056](https://github.com/xmake-io/xmake/issues/3056): Improve zig support
* [#3060](https://github.com/xmake-io/xmake/issues/3060): Improve to detect msys2 for clang toolchains envirnoment
* [#3071](https://github.com/xmake-io/xmake/issues/3071): Support rc for llvm/clang toolchain
* [#3122](https://github.com/xmake-io/xmake/pull/3122): Generate dependencies of preprocessed modules to avoid importing #ifdef import
* [#3125](https://github.com/xmake-io/xmake/pull/3125): Compile private C++20 modules
* [#3133](https://github.com/xmake-io/xmake/pull/3133): Add support of internal partitions
* [#3146](https://github.com/xmake-io/xmake/issues/3146): Add default components for packages
* [#3192](https://github.com/xmake-io/xmake/issues/3192): JSON output for auto complete
### Bugs fixed
* Fix requires-lock bug
* [#3065](https://github.com/xmake-io/xmake/issues/3065): Fix missing package dependences
* [#3082](https://github.com/xmake-io/xmake/issues/3082): Fix build.ninja generator
* [#3092](https://github.com/xmake-io/xmake/issues/3092): Fix xrepo add-repo error handing
* [#3013](https://github.com/xmake-io/xmake/issues/3013): Fix and support windows UNC path
* [#2902](https://github.com/xmake-io/xmake/issues/2902): Fix file not access by another process occupied
* [#3074](https://github.com/xmake-io/xmake/issues/3074): Fix CMakelists generator
* [#3141](https://github.com/xmake-io/xmake/pull/3141): Fix import order on GCC and force it on clang and msvc #3141
* Fix tools/xmake package build directory
* [#3159](https://github.com/xmake-io/xmake/issues/3159): Fix compile_commands for CLion
## v2.7.3
### New features
* A new optional configuration syntax. It is LSP friendly, automatically calls target_end() to achieve scope isolation.
* [#2944](https://github.com/xmake-io/xmake/issues/2944): Add `gnu-rm.binary` and `gnu-rm.static` rules and tests for embed project
* [#2636](https://github.com/xmake-io/xmake/issues/2636): Support package components
* Support armasm/armasm64 for msvc
* [#3023](https://github.com/xmake-io/xmake/pull/3023): Add support for debugging with renderdoc
* [#3022](https://github.com/xmake-io/xmake/issues/3022): Add flags for specific compilers and linkers
* [#3025](https://github.com/xmake-io/xmake/pull/3025): C++ exception enabled/disabled switch method
* [#3017](https://github.com/xmake-io/xmake/pull/3017): Support ispc compiler
### Changes
* [#2925](https://github.com/xmake-io/xmake/issues/2925): Improve doxygen plugin
* [#2948](https://github.com/xmake-io/xmake/issues/2948): Support OpenBSD
* Add `xmake g --insecure-ssl=y` option to disable ssl certificate when downloading packages
* [#2971](https://github.com/xmake-io/xmake/pull/2971): Stabilize vs and vsxmake project generation
* [#3000](https://github.com/xmake-io/xmake/issues/3000): Incremental compilation support for modules
* [#3016](https://github.com/xmake-io/xmake/pull/3016): Improve clang/msvc to better support std modules
### Bugs fixed
* [#2949](https://github.com/xmake-io/xmake/issues/2949): Fix vs group
* [#2952](https://github.com/xmake-io/xmake/issues/2952): Fix armlink for long args
* [#2954](https://github.com/xmake-io/xmake/issues/2954): Fix c++ module partitions path issue
* [#3033](https://github.com/xmake-io/xmake/issues/3033): Detect circular modules dependency
## v2.7.2
### New features
* [#2140](https://github.com/xmake-io/xmake/issues/2140): Support Windows Arm64
* [#2719](https://github.com/xmake-io/xmake/issues/2719): Add `package.librarydeps.strict_compatibility` to strict compatibility for package linkdeps
* [#2810](https://github.com/xmake-io/xmake/pull/2810): Support os.execv to run shell script file
* [#2817](https://github.com/xmake-io/xmake/pull/2817): Improve rule to support dependence order
* [#2824](https://github.com/xmake-io/xmake/pull/2824): Pass cross-file to meson.install and trybuild
* [#2856](https://github.com/xmake-io/xmake/pull/2856): Improve to debug package using the debug source directory
* [#2859](https://github.com/xmake-io/xmake/issues/2859): Improve trybuild to build 3rd source library using xmake-repo scripts
* [#2879](https://github.com/xmake-io/xmake/issues/2879): Support for dynamic creation and injection of rules and targets in script scope
* [#2374](https://github.com/xmake-io/xmake/issues/2374): Allow xmake package to embed rules and scripts
* Add clang-cl toolchain
### Changes
* [#2745](https://github.com/xmake-io/xmake/pull/2745): Improve os.cp to support symlink
* [#2773](https://github.com/xmake-io/xmake/pull/2773): Improve vcpkg packages to support freebsd
* [#2778](https://github.com/xmake-io/xmake/pull/2778): Improve Improve xrepo.env for target
* [#2783](https://github.com/xmake-io/xmake/issues/2783): Add digest algorithm option for wdk signtool
* [#2787](https://github.com/xmake-io/xmake/pull/2787): Improve json to support empty array
* [#2782](https://github.com/xmake-io/xmake/pull/2782): Improve to find matlab and runtime
* [#2793](https://github.com/xmake-io/xmake/issues/2793): Improve mconfdialog
* [#2804](https://github.com/xmake-io/xmake/issues/2804): Support macOS arm64/x86_64 cross-compilation for installing packages
* [#2809](https://github.com/xmake-io/xmake/issues/2809): Improve cl optimization option
* Improve trybuild for meson/cmake/autoconf
* [#2846](https://github.com/xmake-io/xmake/discussions/2846): Improve to generate config files
* [#2866](https://github.com/xmake-io/xmake/issues/2866): Better control over the order of execution of rules
### Bugs fixed
* [#2740](https://github.com/xmake-io/xmake/issues/2740): Fix build c++ modules stuck and slower for msvc
* [#2875](https://github.com/xmake-io/xmake/issues/2875): Fix build linux driver error
* [#2885](https://github.com/xmake-io/xmake/issues/2885): Fix pch not found with msvc/ccache
## v2.7.1
### New features
* [#2555](https://github.com/xmake-io/xmake/issues/2555): Add fwatcher module and `xmake watch` plugin command
* Add `xmake service --pull 'build/**' outputdir` to pull the given files in remote server
* [#2641](https://github.com/xmake-io/xmake/pull/2641): Improve C++20 modules, support headerunits and project generators
* [#2679](https://github.com/xmake-io/xmake/issues/2679): Support Mac Catalyst
### Changes
* [#2576](https://github.com/xmake-io/xmake/issues/2576): More flexible package fetching from cmake
* [#2577](https://github.com/xmake-io/xmake/issues/2577): Improve add_headerfiles(), add `{install = false}` support
* [#2603](https://github.com/xmake-io/xmake/issues/2603): Disable `-fdirectives-only` for ccache by default
* [#2580](https://github.com/xmake-io/xmake/issues/2580): Set stdout to line buffering
* [#2571](https://github.com/xmake-io/xmake/issues/2571): Improve task scheduling for parallel and distributed compilation based on memory/cpu usage
* [#2410](https://github.com/xmake-io/xmake/issues/2410): Improve cmakelists generator
* [#2690](https://github.com/xmake-io/xmake/issues/2690): Improve to pass toolchains to packages
* [#2686](https://github.com/xmake-io/xmake/issues/2686): Support for incremental compilation and parse header file deps for keil/armcc/armclang
* [#2562](https://github.com/xmake-io/xmake/issues/2562): Improve include deps for rc.exe
* Improve the default parallel building jobs number
### Bugs fixed
* [#2614](https://github.com/xmake-io/xmake/issues/2614): Fix building submodules2 tests for msvc
* [#2620](https://github.com/xmake-io/xmake/issues/2620): Fix build cache for incremental compilation
* [#2177](https://github.com/xmake-io/xmake/issues/2177): Fix python.library segmentation fault for macosx
* [#2708](https://github.com/xmake-io/xmake/issues/2708): Fix link error for mode.coverage rule
* Fix rpath for macos/iphoneos frameworks and application
## v2.6.9
### New features
* [#2474](https://github.com/xmake-io/xmake/issues/2474): Add icx and dpcpp toolchains
* [#2523](https://github.com/xmake-io/xmake/issues/2523): Improve LTO support
* [#2527](https://github.com/xmake-io/xmake/issues/2527): Add set_runargs api
### Changes
* Improve tools.cmake to support wasm
* [#2491](https://github.com/xmake-io/xmake/issues/2491): Fallback to local compiler/cache from remote if server is unreachable
* [#2514](https://github.com/xmake-io/xmake/issues/2514): Disable Unity Build for project generator
* [#2473](https://github.com/xmake-io/xmake/issues/2473): Improve apt::find_package to find it from pc files
* [#2512](https://github.com/xmake-io/xmake/issues/2512): Improve remote service to support timeout configuration
### Bugs fixed
* [#2488](https://github.com/xmake-io/xmake/issues/2488): Fix remote compilation from windows to linux
* [#2504](https://github.com/xmake-io/xmake/issues/2504): Fix remote build bug on msys2/cygwin
* [#2525](https://github.com/xmake-io/xmake/issues/2525): Fix install package deps and stuck
* [#2557](https://github.com/xmake-io/xmake/issues/2557): Fix cmake.find_package links bug
* Fix cache-induced path conflicts in preprocessed files
## v2.6.8
### New features
* [#2447](https://github.com/xmake-io/xmake/pull/2447): Add qt.qmlplugin rule and support of qmltypesregistrar
* [#2446](https://github.com/xmake-io/xmake/issues/2446): Support target group for `xmake install`
* [#2469](https://github.com/xmake-io/xmake/issues/2469): Generate vcpkg-configuration.json
### Changes
* Add `preprocessor.linemarkers` policy to disable linemarkers to speed up ccache/distcc
* [#2389](https://github.com/xmake-io/xmake/issues/2389): Improve `xmake run` to parallel running of targets
* [#2417](https://github.com/xmake-io/xmake/issues/2417): Switch the default value of option/showmenu
* [#2440](https://github.com/xmake-io/xmake/pull/2440): Improve package installation error messages
* [#2438](https://github.com/xmake-io/xmake/pull/2438): Make sure the solution and project file unchanged by sorting those tables
* [#2434](https://github.com/xmake-io/xmake/issues/2434): Improve plugins manager, allow to handle multiples plugin repositories
* [#2421](https://github.com/xmake-io/xmake/issues/2421): Improve config option menu
* [#2425](https://github.com/xmake-io/xmake/issues/2425): Add `preprocessor.gcc.directives_only` policy
* [#2455](https://github.com/xmake-io/xmake/issues/2455): Improve optimize options for emcc
* [#2467](https://github.com/xmake-io/xmake/issues/2467): Add compile fallback for msvc/ccache
* [#2452](https://github.com/xmake-io/xmake/issues/2452): Add build.warning policy
### Bugs Fixed
* [#2435](https://github.com/xmake-io/xmake/pull/2435): fix the search bug when the package name has an extension name.
* [#2445](https://github.com/xmake-io/xmake/issues/2445): Fix ccache bug for msvc
* [#2452](https://github.com/xmake-io/xmake/issues/2452): Fix warnings output for ccache
## v2.6.7
### New features
* [#2318](https://github.com/xmake-io/xmake/issues/2318): Add `xmake f --policies=` config argument to modify project policies
### Changes
* fallback to source code build if the precompiled package is error
* [#2387](https://github.com/xmake-io/xmake/issues/2387): Improve pkgconfig and find_package
* Add `build.ccache` policy
### Bugs fixed
* [#2382](https://github.com/xmake-io/xmake/issues/2382): Fix headeronly package configs
* [#2388](https://github.com/xmake-io/xmake/issues/2388): Fix path bug
* [#2385](https://github.com/xmake-io/xmake/issues/2385): Fix cmake/find_package
* [#2395](https://github.com/xmake-io/xmake/issues/2395): Fix c++modules
* Fix find_qt bug
## v2.6.6
### New features
* [#2327](https://github.com/xmake-io/xmake/issues/2327): Support nvc/nvc++/nvfortran in nvidia-hpc-sdk
* Add path instance interfaces
* [#2344](https://github.com/xmake-io/xmake/pull/2344): Add lz4 compress module
* [#2349](https://github.com/xmake-io/xmake/pull/2349): Add keil/c51 project support
* [#274](https://github.com/xmake-io/xmake/issues/274): Distributed compilation support
* Use builtin local cache instead of ccache
### Changes
* [#2309](https://github.com/xmake-io/xmake/issues/2309): Support user authorization for remote compilation
* Improve remote compilation to support lz4 compression
### Bugs fixed
* Fix lua stack when select package versions
## v2.6.5
### New features
* [#2138](https://github.com/xmake-io/xmake/issues/2138): Support template package
* [#2185](https://github.com/xmake-io/xmake/issues/2185): Add `--appledev=simulator` to improve apple simulator support
* [#2227](https://github.com/xmake-io/xmake/issues/2227): Improve cargo package with Cargo.toml file
* Improve `add_requires` to support git commit as version
* [#622](https://github.com/xmake-io/xmake/issues/622): Support remote compilation
* [#2282](https://github.com/xmake-io/xmake/issues/2282): Add `add_filegroups` to support file group for vs/vsxmake/cmake generator
### Changes
* [#2137](https://github.com/xmake-io/xmake/pull/2137): Improve path module
* Reduce 50% xmake binary size on macOS
* Improve tools/autoconf,cmake to support toolchain switching.
* [#2221](https://github.com/xmake-io/xmake/pull/2221): Improve registry api to support unicode
* [#2225](https://github.com/xmake-io/xmake/issues/2225): Support to parse import dependencies for protobuf
* [#2265](https://github.com/xmake-io/xmake/issues/2265): Sort CMakeLists.txt
* Speed up `os.files`
### Bugs fixed
* [#2233](https://github.com/xmake-io/xmake/issues/2233): Fix c++ modules deps
## v2.6.4
### New features
* [#2011](https://github.com/xmake-io/xmake/issues/2011): Support to inherit base package
* Support to build and run xmake on sparc, alpha, powerpc, s390x and sh4
* Add on_download for package()
* [#2021](https://github.com/xmake-io/xmake/issues/2021): Support Swift for linux and windows
* [#2024](https://github.com/xmake-io/xmake/issues/2024): Add asn1c support
* [#2031](https://github.com/xmake-io/xmake/issues/2031): Support linker scripts and version scripts for add_files
* [#2033](https://github.com/xmake-io/xmake/issues/2033): Catch ctrl-c to get current backtrace for debugging stuck
* [#2059](https://github.com/xmake-io/xmake/pull/2059): Add `xmake update --integrate` to integrate for shell
* [#2070](https://github.com/xmake-io/xmake/issues/2070): Add built-in xrepo environments
* [#2117](https://github.com/xmake-io/xmake/pull/2117): Support to pass toolchains to package for other platforms
* [#2121](https://github.com/xmake-io/xmake/issues/2121): Support to export the given symbols list
### Changes
* [#2036](https://github.com/xmake-io/xmake/issues/2036): Improve xrepo to install packages from configuration file, e.g. `xrepo install xxx.lua`
* [#2039](https://github.com/xmake-io/xmake/issues/2039): Improve filter directory for vs generator
* [#2025](https://github.com/xmake-io/xmake/issues/2025): Support phony and headeronly target for vs generator
* Improve to find vstudio and codesign speed
* [#2077](https://github.com/xmake-io/xmake/issues/2077): Improve vs project generator to support cuda
### Bugs fixed
* [#2005](https://github.com/xmake-io/xmake/issues/2005): Fix path.extension
* [#2008](https://github.com/xmake-io/xmake/issues/2008): Fix windows manifest
* [#2016](https://github.com/xmake-io/xmake/issues/2016): Fix object filename confict for vs project generator
## v2.6.3
### New features
* [#1298](https://github.com/xmake-io/xmake/issues/1928): Support vcpkg manifest mode and select version for package/install
* [#1896](https://github.com/xmake-io/xmake/issues/1896): Add `python.library` rule to build pybind modules
* [#1939](https://github.com/xmake-io/xmake/issues/1939): Add `remove_files`, `remove_headerfiles` and mark `del_files` as deprecated
* Made on_config as the official api for rule/target
* Add riscv32/64 support
* [#1970](https://github.com/xmake-io/xmake/issues/1970): Add CMake wrapper for Xrepo C and C++ package manager.
* Add builtin github mirror pac files, `xmake g --proxy_pac=github_mirror.lua`
### Changes
* [#1923](https://github.com/xmake-io/xmake/issues/1923): Improve to build linux driver, support set custom linux-headers path
* [#1962](https://github.com/xmake-io/xmake/issues/1962): Improve armclang toolchain to support to build asm
* [#1959](https://github.com/xmake-io/xmake/pull/1959): Improve vstudio project generator
* [#1969](https://github.com/xmake-io/xmake/issues/1969): Add default option description
### Bugs fixed
* [#1875](https://github.com/xmake-io/xmake/issues/1875): Fix deploy android qt apk issue
* [#1973](https://github.com/xmake-io/xmake/issues/1973): Fix merge static archive
## v2.6.2
### New features
* [#1902](https://github.com/xmake-io/xmake/issues/1902): Support to build linux kernel driver modules
* [#1913](https://github.com/xmake-io/xmake/issues/1913): Build and run targets with given group pattern
* [#1982](https://github.com/xmake-io/xmake/pull/1982): Fix build c++20 submodules for clang
### Change
* [#1872](https://github.com/xmake-io/xmake/issues/1872): Escape characters for set_configvar
* [#1888](https://github.com/xmake-io/xmake/issues/1888): Improve windows installer to avoid remove other files
* [#1895](https://github.com/xmake-io/xmake/issues/1895): Improve `plugin.vsxmake.autoupdate` rule
* [#1893](https://github.com/xmake-io/xmake/issues/1893): Improve to detect icc and ifort toolchains
* [#1905](https://github.com/xmake-io/xmake/pull/1905): Add support of external headers without experimental for msvc
* [#1904](https://github.com/xmake-io/xmake/pull/1904): Improve vs201x generator
* Add `XMAKE_THEME` envirnoment variable to switch theme
* [#1907](https://github.com/xmake-io/xmake/issues/1907): Add `-f/--force` to force to create project in a non-empty directory
* [#1917](https://github.com/xmake-io/xmake/pull/1917): Improve to find_package and configurations
### Bugs fixed
* [#1885](https://github.com/xmake-io/xmake/issues/1885): Fix package:fetch_linkdeps
* [#1903](https://github.com/xmake-io/xmake/issues/1903): Fix package link order
## v2.6.1
### New features
* [#1799](https://github.com/xmake-io/xmake/issues/1799): Support mixed rust & c++ target and cargo dependences
* Add `utils.glsl2spv` rules to compile *.vert/*.frag shader files to spirv file and binary c header file
### Changes
* Switch to Lua5.4 runtime by default
* [#1776](https://github.com/xmake-io/xmake/issues/1776): Improve system::find_package, support to find package from envs
* [#1786](https://github.com/xmake-io/xmake/issues/1786): Improve apt:find_package, support to find alias package
* [#1819](https://github.com/xmake-io/xmake/issues/1819): Add precompiled header to cmake generator
* Improve C++20 module to support std libraries for msvc
* [#1792](https://github.com/xmake-io/xmake/issues/1792): Add custom command in vs project generator
* [#1835](https://github.com/xmake-io/xmake/issues/1835): Improve MDK program supports and add `set_runtimes("microlib")`
* [#1858](https://github.com/xmake-io/xmake/issues/1858): Improve to build c++20 modules with libraries
* Add $XMAKE_BINARY_REPO and $XMAKE_MAIN_REPO repositories envs
* [#1865](https://github.com/xmake-io/xmake/issues/1865): Improve openmp projects
* [#1845](https://github.com/xmake-io/xmake/issues/1845): Install pdb files for static library
### Bugs Fixed
* Fix semver to parse build string with zero prefix
* [#50](https://github.com/libbpf/libbpf-bootstrap/issues/50): Fix rule and build bpf program errors
* [#1610](https://github.com/xmake-io/xmake/issues/1610): Fix `xmake f --menu` not responding in vscode and support ConPTY terminal virtkeys
## v2.5.9
### New features
* [#1736](https://github.com/xmake-io/xmake/issues/1736): Support wasi-sdk toolchain
* Support Lua 5.4 runtime
* Add gcc-8, gcc-9, gcc-10, gcc-11 toolchains
* [#1623](https://github.com/xmake-io/xmake/issues/1632): Support find_package from cmake
* [#1747](https://github.com/xmake-io/xmake/issues/1747): Add `set_kind("headeronly")` for target to install files for headeronly library
* [#1019](https://github.com/xmake-io/xmake/issues/1019): Support Unity build
* [#1438](https://github.com/xmake-io/xmake/issues/1438): Support code amalgamation, `xmake l cli.amalgamate`
* [#1765](https://github.com/xmake-io/xmake/issues/1756): Support nim language
* [#1762](https://github.com/xmake-io/xmake/issues/1762): Manage and switch the given package envs for `xrepo env`
* [#1767](https://github.com/xmake-io/xmake/issues/1767): Support Circle compiler
* [#1753](https://github.com/xmake-io/xmake/issues/1753): Support armcc/armclang toolchains for Keil/MDK
* [#1774](https://github.com/xmake-io/xmake/issues/1774): Add table.contains api
* [#1735](https://github.com/xmake-io/xmake/issues/1735): Add custom command in cmake generator
### Changes
* [#1528](https://github.com/xmake-io/xmake/issues/1528): Check c++17/20 features
* [#1729](https://github.com/xmake-io/xmake/issues/1729): Improve C++20 modules for clang/gcc/msvc, support inter-module dependency compilation and parallel optimization
* [#1779](https://github.com/xmake-io/xmake/issues/1779): Remove builtin `-Gd` for ml.exe/x86
* [#1781](https://github.com/xmake-io/xmake/issues/1781): Improve get.sh installation script to support nixos
## v2.5.8
### New features
* [#388](https://github.com/xmake-io/xmake/issues/388): Pascal Language Support
* [#1682](https://github.com/xmake-io/xmake/issues/1682): Add optional lua5.3 backend instead of luajit to provide better compatibility
* [#1622](https://github.com/xmake-io/xmake/issues/1622): Support Swig
* [#1714](https://github.com/xmake-io/xmake/issues/1714): Support build local embed cmake projects
* [#1715](https://github.com/xmake-io/xmake/issues/1715): Support to detect compiler language standards as features and add `check_macros`
* Support Loongarch
### Change
* [#1618](https://github.com/xmake-io/xmake/issues/1618): Improve vala to support to generate libraries and bindings
* Improve Qt rules to support Qt 4.x
* Improve `set_symbols("debug")` to generate pdb file for clang on windows
* [#1638](https://github.com/xmake-io/xmake/issues/1638): Improve to merge static library
* Improve on_load/after_load to support to add target deps dynamically
* [#1675](https://github.com/xmake-io/xmake/pull/1675): Rename dynamic and import library suffix for mingw
* [#1694](https://github.com/xmake-io/xmake/issues/1694): Support to define a variable without quotes for configuration files
* Support Android NDK r23
* Add `c++latest` and `clatest` for `set_languages`
* [#1720](https://github.com/xmake-io/xmake/issues/1720): Add `save_scope` and `restore_scope` to fix `check_xxx` apis
* [#1726](https://github.com/xmake-io/xmake/issues/1726): Improve compile_commands generator to support nvcc
### Bugs fixed
* [#1671](https://github.com/xmake-io/xmake/issues/1671): Fix incorrect absolute path after installing precompiled packages
* [#1689](https://github.com/xmake-io/xmake/issues/1689): Fix unicode chars bug for vsxmake
## v2.5.7
### New features
* [#1534](https://github.com/xmake-io/xmake/issues/1534): Support to compile Vala lanuage project
* [#1544](https://github.com/xmake-io/xmake/issues/1544): Add utils.bin2c rule to generate header from binary file
* [#1547](https://github.com/xmake-io/xmake/issues/1547): Support to run and get output of c/c++ snippets in option
* [#1567](https://github.com/xmake-io/xmake/issues/1567): Package "lock file" support to freeze dependencies
* [#1597](https://github.com/xmake-io/xmake/issues/1597): Support to compile *.metal files to generate *.metalib and improve xcode.application rule
### Change
* [#1540](https://github.com/xmake-io/xmake/issues/1540): Better support for compilation of automatically generated code
* [#1578](https://github.com/xmake-io/xmake/issues/1578): Improve add_repositories to support relative path better
* [#1582](https://github.com/xmake-io/xmake/issues/1582): Improve installation and os.cp to reserve symlink
### Bugs fixed
* [#1531](https://github.com/xmake-io/xmake/issues/1531): Fix error info when loading targets failed
## v2.5.6
### New features
* [#1483](https://github.com/xmake-io/xmake/issues/1483): Add `os.joinenvs()` and improve package tools envirnoments
* [#1523](https://github.com/xmake-io/xmake/issues/1523): Add `set_allowedmodes`, `set_allowedplats` and `set_allowedarchs`
* [#1523](https://github.com/xmake-io/xmake/issues/1523): Add `set_defaultmode`, `set_defaultplat` and `set_defaultarch`
### Change
* Improve vs/vsxmake project generator to support vs2022
* [#1513](https://github.com/xmake-io/xmake/issues/1513): Improve precompiled binary package compatibility on windows/msvc
* Improve to find vcpkg root directory on windows
* Improve to support Qt6
### Bugs fixed
* [#489](https://github.com/xmake-io/xmake-repo/pull/489): Fix run os.execv with too long envirnoment value on windows
## v2.5.5
### New features
* [#1421](https://github.com/xmake-io/xmake/issues/1421): Add prefix, suffix and extension options for target names
* [#1422](https://github.com/xmake-io/xmake/issues/1422): Support search packages from vcpkg, conan
* [#1424](https://github.com/xmake-io/xmake/issues/1424): Set binary as default target kind
* [#1140](https://github.com/xmake-io/xmake/issues/1140): Add a way to ask xmake to try to download dependencies from a certain package manager
* [#1339](https://github.com/xmake-io/xmake/issues/1339): Improve `xmake package` to generate new local/remote packages
* Add `appletvos` platform support for AppleTV, `xmake f -p appletvos`
* [#1437](https://github.com/xmake-io/xmake/issues/1437): Add headeronly library type for package to ignore `vs_runtime`
* [#1351](https://github.com/xmake-io/xmake/issues/1351): Support export/import current configs
* [#1454](https://github.com/xmake-io/xmake/issues/1454): Support to download and install precompiled image packages from xmake-mirror
### Change
* [#1425](https://github.com/xmake-io/xmake/issues/1425): Improve tools/meson to load msvc envirnoments
* [#1442](https://github.com/xmake-io/xmake/issues/1442): Support to clone package resources from git url
* [#1389](https://github.com/xmake-io/xmake/issues/1389): Support to add toolchain envs to `xrepo env`
* [#1453](https://github.com/xmake-io/xmake/issues/1453): Support to export protobuf includedirs
* Support vs2022
### Bugs fixed
* [#1413](https://github.com/xmake-io/xmake/issues/1413): Fix hangs on fetching packages
* [#1420](https://github.com/xmake-io/xmake/issues/1420): Fix config and packages cache
* [#1445](https://github.com/xmake-io/xmake/issues/1445): Fix WDK driver sign error
* [#1465](https://github.com/xmake-io/xmake/issues/1465): Fix missing link directory
## v2.5.4
### New features
* [#1323](https://github.com/xmake-io/xmake/issues/1323): Support find and install package from `apt`, `add_requires("apt::zlib1g-dev")`
* [#1337](https://github.com/xmake-io/xmake/issues/1337): Add environment vars to change package directories
* [#1338](https://github.com/xmake-io/xmake/issues/1338): Support import and export installed packages
* [#1087](https://github.com/xmake-io/xmake/issues/1087): Add `xrepo env shell` and support load envs from `add_requires/xmake.lua`
* [#1313](https://github.com/xmake-io/xmake/issues/1313): Support private package for `add_requires/add_deps`
* [#1358](https://github.com/xmake-io/xmake/issues/1358): Support to set mirror url to speedup download package
* [#1369](https://github.com/xmake-io/xmake/pull/1369): Support arm/arm64 packages for vcpkg, thanks @fallending
* [#1405](https://github.com/xmake-io/xmake/pull/1405): Add portage package manager support, thanks @Phate6660
### Change
* Improve `find_package` and add `package:find_package` for xmake package
* Remove deprecated `set_config_h` and `set_config_h_prefix` apis
* [#1343](https://github.com/xmake-io/xmake/issues/1343): Improve to search local package files
* [#1347](https://github.com/xmake-io/xmake/issues/1347): Improve to vs_runtime configs for binary package
* [#1353](https://github.com/xmake-io/xmake/issues/1353): Improve del_files() to speedup matching files
* [#1349](https://github.com/xmake-io/xmake/issues/1349): Improve `xrepo env shell` to support powershell
### Bugs fixed
* [#1380](https://github.com/xmake-io/xmake/issues/1380): Fix add packages errors
* [#1381](https://github.com/xmake-io/xmake/issues/1381): Fix add local git source for package
* [#1391](https://github.com/xmake-io/xmake/issues/1391): Fix cuda/nvcc toolchain
### v2.5.3
### New features
* [#1259](https://github.com/xmake-io/xmake/issues/1259): Support `add_files("*.def")` to export symbols for windows/dll
* [#1267](https://github.com/xmake-io/xmake/issues/1267): add `find_package("nvtx")`
* [#1274](https://github.com/xmake-io/xmake/issues/1274): add `platform.linux.bpf` rule to build linux/bpf program
* [#1280](https://github.com/xmake-io/xmake/issues/1280): Support fetchonly package to improve find_package
* Support to fetch remote ndk toolchain package
* [#1268](https://github.com/xmake-io/xmake/issues/1268): Add `utils.install.pkgconfig_importfiles` rule to install `*.pc` import file
* [#1268](https://github.com/xmake-io/xmake/issues/1268): Add `utils.install.cmake_importfiles` rule to install `*.cmake` import files
* [#348](https://github.com/xmake-io/xmake-repo/pull/348): Add `platform.longpaths` policy to support git longpaths
* [#1314](https://github.com/xmake-io/xmake/issues/1314): Support to install and use conda packages
* [#1120](https://github.com/xmake-io/xmake/issues/1120): Add `core.base.cpu` module and improve `os.cpuinfo()`
* [#1325](https://github.com/xmake-io/xmake/issues/1325): Add builtin git variables for `add_configfiles`
### Change
* [#1275](https://github.com/xmake-io/xmake/issues/1275): Support conditionnal targets for vsxmake plugin
* [#1290](https://github.com/xmake-io/xmake/pull/1290): Improve android ndk to support >= r22
* [#1311](https://github.com/xmake-io/xmake/issues/1311): Add packages lib folder to PATH for vsxmake project
### Bugs fixed
* [#1266](https://github.com/xmake-io/xmake/issues/1266): Fix relative repo path in `add_repositories`
* [#1288](https://github.com/xmake-io/xmake/issues/1288): Fix vsxmake generator with option configs
## v2.5.2
### New features
* [#955](https://github.com/xmake-io/xmake/issues/955#issuecomment-766481512): Support `zig cc` and `zig c++` as c/c++ compiler
* [#955](https://github.com/xmake-io/xmake/issues/955#issuecomment-768193083): Support zig cross-compilation
* [#1177](https://github.com/xmake-io/xmake/issues/1177): Improve to detect terminal and color codes
* [#1216](https://github.com/xmake-io/xmake/issues/1216): Pass custom configuration scripts to xrepo
* Add linuxos builtin module to get linux system information
* [#1217](https://github.com/xmake-io/xmake/issues/1217): Support to fetch remote toolchain package when building project
* [#1123](https://github.com/xmake-io/xmake/issues/1123): Add `rule("utils.symbols.export_all")` to export all symbols for windows/dll
* [#1181](https://github.com/xmake-io/xmake/issues/1181): Add `utils.platform.gnu2mslib(mslib, gnulib)` module api to convert mingw/xxx.dll.a to msvc xxx.lib
* [#1246](https://github.com/xmake-io/xmake/issues/1246): Improve rules and generators to support commands list
* [#1239](https://github.com/xmake-io/xmake/issues/1239): Add `add_extsources` to improve find external packages
* [#1241](https://github.com/xmake-io/xmake/issues/1241): Support add .manifest files for windows program
* Support to use `xrepo remove --all` to remove all packages
* [#1254](https://github.com/xmake-io/xmake/issues/1254): Support to export packages to parent target
### Change
* [#1226](https://github.com/xmake-io/xmake/issues/1226): Add missing qt include directories
* [#1183](https://github.com/xmake-io/xmake/issues/1183): Improve c++ lanuages to support Qt6
* [#1237](https://github.com/xmake-io/xmake/issues/1237): Add qt.ui files for vsxmake plugin
* Improve vs/vsxmake plugins to support precompiled header and intellisense
* [#1090](https://github.com/xmake-io/xmake/issues/1090): Simplify integration of custom code generators
* [#1065](https://github.com/xmake-io/xmake/issues/1065): Improve protobuf rule to support compile_commands generators
* [#1249](https://github.com/xmake-io/xmake/issues/1249): Improve vs/vsxmake generator to support startproject
* [#605](https://github.com/xmake-io/xmake/issues/605): Improve to link orders for add_deps/add_packages
* Remove deprecated `add_defines_h_if_ok` and `add_defines_h` apis for option
### Bugs fixed
* [#1219](https://github.com/xmake-io/xmake/issues/1219): Fix version check and update
* [#1235](https://github.com/xmake-io/xmake/issues/1235): Fix include directories with spaces
## v2.5.1
### New features
* [#1035](https://github.com/xmake-io/xmake/issues/1035): The graphics configuration menu fully supports mouse events, and support scroll bar
* [#1098](https://github.com/xmake-io/xmake/issues/1098): Support stdin for os.execv
* [#1079](https://github.com/xmake-io/xmake/issues/1079): Add autoupdate plugin rule for vsxmake, `add_rules("plugin.vsxmake.autoupdate")`
* Add `xmake f --vs_runtime=MT` and `set_runtimes("MT")` to set vs runtime for targets and packages
* [#1032](https://github.com/xmake-io/xmake/issues/1032): Support to enum registry keys and values
* [#1026](https://github.com/xmake-io/xmake/issues/1026): Support group for vs/vsxmake project
* [#1178](https://github.com/xmake-io/xmake/issues/1178): Add `add_requireconfs()` api to rewrite configs of depend packages
* [#1043](https://github.com/xmake-io/xmake/issues/1043): Add `luarocks.module` rule for luarocks-build-xmake
* [#1190](https://github.com/xmake-io/xmake/issues/1190): Support for Apple Silicon (macOS ARM)
* [#1145](https://github.com/xmake-io/xmake/pull/1145): Support Qt deploy for Windows, thanks @SirLynix
### Change
* [#1072](https://github.com/xmake-io/xmake/issues/1072): Fix and improve to parse cl deps
* Support utf8 for ui modules and `xmake f --menu`
* Improve to support zig on macOS
* [#1135](https://github.com/xmake-io/xmake/issues/1135): Improve multi-toolchain and multi-platforms for targets
* [#1153](https://github.com/xmake-io/xmake/issues/1153): Improve llvm toolchain to support sysroot on macOS
* [#1071](https://github.com/xmake-io/xmake/issues/1071): Improve to generate vs/vsxmake project to support for remote packages
* Improve vs/vsxmake project plugin to support global `set_arch()` setting
* [#1164](https://github.com/xmake-io/xmake/issues/1164): Improve to launch console programs for vsxmake project
* [#1179](https://github.com/xmake-io/xmake/issues/1179): Improve llvm toolchain and add isysroot
### Bugs fixed
* [#1091](https://github.com/xmake-io/xmake/issues/1091): Fix incorrect ordering of inherited library dependencies
* [#1105](https://github.com/xmake-io/xmake/issues/1105): Fix c++ language intellisense for vsxmake
* [#1132](https://github.com/xmake-io/xmake/issues/1132): Fix TrimEnd bug for vsxmake
* [#1142](https://github.com/xmake-io/xmake/issues/1142): Fix git not found when installing packages
* Fix macos.version bug for macOS Big Sur
* [#1084](https://github.com/xmake-io/xmake/issues/1084): Fix `add_defines()` bug (contain spaces)
* [#1195](https://github.com/xmake-io/xmake/pull/1195): Fix unicode problem for vs and improve find_vstudio/os.exec
## v2.3.9
### New features
* Add new [xrepo](https://github.com/xmake-io/xrepo) command to manage C/C++ packages
* Support for installing packages of cross-compilation
* Add musl.cc toolchains
* [#1009](https://github.com/xmake-io/xmake/issues/1009): Support select and install any version package, e.g. `add_requires("libcurl 7.73.0", {verify = false})`
* [#1016](https://github.com/xmake-io/xmake/issues/1016): Add license checking for target/packages
* [#1017](https://github.com/xmake-io/xmake/issues/1017): Support external/system include directories `add_sysincludedirs` for package and toolchains
* [#1020](https://github.com/xmake-io/xmake/issues/1020): Support to find and install pacman package on archlinux and msys2
* Support mouse for `xmake f --menu`
### Change
* [#997](https://github.com/xmake-io/xmake/issues/997): Support to set std lanuages for `xmake project -k cmake`
* [#998](https://github.com/xmake-io/xmake/issues/998): Support to install vcpkg packages with windows-static-md
* [#996](https://github.com/xmake-io/xmake/issues/996): Improve to find vcpkg directory
* [#1008](https://github.com/xmake-io/xmake/issues/1008): Improve cross toolchains
* [#1030](https://github.com/xmake-io/xmake/issues/1030): Improve xcode.framework and xcode.application rules
* [#1051](https://github.com/xmake-io/xmake/issues/1051): Add `edit` and `embed` to `set_symbols()` only for msvc
* [#1062](https://github.com/xmake-io/xmake/issues/1062): Improve `xmake project -k vs` plugin.
## v2.3.8
### New features
* [#955](https://github.com/xmake-io/xmake/issues/955): Add zig project templates
* [#956](https://github.com/xmake-io/xmake/issues/956): Add wasm platform and support Qt/Wasm SDK
* Upgrade luajit vm and support for runing on mips64 device
* [#972](https://github.com/xmake-io/xmake/issues/972): Add `depend.on_changed()` api to simplify adding dependent files
* [#981](https://github.com/xmake-io/xmake/issues/981): Add `set_fpmodels()` for math optimization mode
* [#980](https://github.com/xmake-io/xmake/issues/980): Support Intel C/C++ and Fortran Compiler
* [#986](https://github.com/xmake-io/xmake/issues/986): Support for `c11` and `c17` for MSVC Version 16.8 and Above
* [#979](https://github.com/xmake-io/xmake/issues/979): Add Abstraction for OpenMP. `add_rules("c++.openmp")`
### Change
* [#958](https://github.com/xmake-io/xmake/issues/958): Improve mingw platform to support llvm-mingw toolchain
* Improve `add_requires("zlib~xxx")` to support for installing multi-packages at same time
* [#977](https://github.com/xmake-io/xmake/issues/977): Improve find_mingw for windows
* [#978](https://github.com/xmake-io/xmake/issues/978): Improve toolchain flags order
* Improve Xcode toolchain to support for macOS/arm64
### Bugs fixed
* [#951](https://github.com/xmake-io/xmake/issues/951): Fix emcc support for windows
* [#992](https://github.com/xmake-io/xmake/issues/992): Fix filelock bug
## v2.3.7
### New features
* [#2941](https://github.com/microsoft/winget-pkgs/pull/2941): Add support for winget
* Add xmake-tinyc installer without msvc compiler for windows
* Add tinyc compiler toolchain
* Add emcc compiler toolchain (emscripten) to compiling to asm.js and WebAssembly
* [#947](https://github.com/xmake-io/xmake/issues/947): Add `xmake g --network=private` to enable the private network
### Change
* [#907](https://github.com/xmake-io/xmake/issues/907): Improve to the linker optimization for msvc
* Improve to detect qt sdk environment
* [#918](https://github.com/xmake-io/xmake/pull/918): Improve to support cuda11 toolchains
* Improve Qt support for ubuntu/apt
* Improve CMake project generator
* [#931](https://github.com/xmake-io/xmake/issues/931): Support to export packages with all dependences
* [#930](https://github.com/xmake-io/xmake/issues/930): Support to download package without version list directly
* [#927](https://github.com/xmake-io/xmake/issues/927): Support to switch arm/thumb mode for android ndk
* Improve trybuild/cmake to support android/mingw/iphoneos/watchos toolchains
### Bugs fixed
* [#903](https://github.com/xmake-io/xmake/issues/903): Fix install vcpkg packages fails
* [#912](https://github.com/xmake-io/xmake/issues/912): Fix the custom toolchain
* [#914](https://github.com/xmake-io/xmake/issues/914): Fix bad light userdata pointer for lua on some aarch64 devices
## v2.3.6
### New features
* Add `xmake project -k xcode` generator (use cmake)
* [#870](https://github.com/xmake-io/xmake/issues/870): Support gfortran compiler
* [#887](https://github.com/xmake-io/xmake/pull/887): Support zig compiler
* [#893](https://github.com/xmake-io/xmake/issues/893): Add json module
* [#898](https://github.com/xmake-io/xmake/issues/898): Support cross-compilation for golang
* [#275](https://github.com/xmake-io/xmake/issues/275): Support go package manager to install go packages
* [#581](https://github.com/xmake-io/xmake/issues/581): Support dub package manager to install dlang packages
### Change
* [#868](https://github.com/xmake-io/xmake/issues/868): Support new cl.exe dependency report files, `/sourceDependencies xxx.json`
* [#902](https://github.com/xmake-io/xmake/issues/902): Improve to detect cross-compilation toolchain
## v2.3.5
### New features
* Add `xmake show -l envs` to show all builtin envirnoment variables
* [#861](https://github.com/xmake-io/xmake/issues/861): Support search local package file to install remote package
* [#854](https://github.com/xmake-io/xmake/issues/854): Support global proxy settings for curl, wget and git
### Change
* [#828](https://github.com/xmake-io/xmake/issues/828): Support to import sub-directory files for protobuf rules
* [#835](https://github.com/xmake-io/xmake/issues/835): Improve mode.minsizerel to add /GL flags for msvc
* [#828](https://github.com/xmake-io/xmake/issues/828): Support multi-level directories for protobuf/import
* [#838](https://github.com/xmake-io/xmake/issues/838#issuecomment-643570920): Support to override builtin-rules for `add_files("src/*.c", {rules = {"xx", override = true}})`
* [#847](https://github.com/xmake-io/xmake/issues/847): Support to parse include deps for rc file
* Improve msvc tool chain, remove the dependence of global environment variables
* [#857](https://github.com/xmake-io/xmake/pull/857): Improved `set_toolchains()` when cross-compilation is supported, specific target can be switched to host toolchain and compiled at the same time
### Bugs fixed
* Fix the progress bug for theme
* [#829](https://github.com/xmake-io/xmake/issues/829): Fix invalid sysroot path for macOS
* [#832](https://github.com/xmake-io/xmake/issues/832): Fix find_packages bug for the debug mode
## v2.3.4
### New features
* [#630](https://github.com/xmake-io/xmake/issues/630): Support *BSD system, e.g. FreeBSD, ..
* Add wprint builtin api to show warnings
* [#784](https://github.com/xmake-io/xmake/issues/784): Add `set_policy()` to set and modify some builtin policies
* [#780](https://github.com/xmake-io/xmake/issues/780): Add set_toolchains/set_toolsets for target and improve to detect cross-compilation toolchains
* [#798](https://github.com/xmake-io/xmake/issues/798): Add `xmake show` plugin to show some builtin configuration values and infos
* [#797](https://github.com/xmake-io/xmake/issues/797): Add ninja theme style, e.g. `xmake g --theme=ninja`
* [#816](https://github.com/xmake-io/xmake/issues/816): Add mode.releasedbg and mode.minsizerel rules
* [#819](https://github.com/xmake-io/xmake/issues/819): Support ansi/vt100 terminal control
### Change
* [#771](https://github.com/xmake-io/xmake/issues/771): Check includedirs, linkdirs and frameworkdirs
* [#774](https://github.com/xmake-io/xmake/issues/774): Support ltui windows resize for `xmake f --menu`
* [#782](https://github.com/xmake-io/xmake/issues/782): Add check flags failed tips for add_cxflags, ..
* [#808](https://github.com/xmake-io/xmake/issues/808): Support add_frameworks for cmakelists
* [#820](https://github.com/xmake-io/xmake/issues/820): Support independent working/build directory
### Bugs fixed
* [#786](https://github.com/xmake-io/xmake/issues/786): Fix check header file deps
* [#810](https://github.com/xmake-io/xmake/issues/810): Fix strip debug bug for linux
## v2.3.3
### New features
* [#727](https://github.com/xmake-io/xmake/issues/727): Strip and generate debug symbols file (.so/.dSYM) for android/ios program
* [#687](https://github.com/xmake-io/xmake/issues/687): Support to generate objc/bundle program.
* [#743](https://github.com/xmake-io/xmake/issues/743): Support to generate objc/framework program.
* Support to compile bundle, framework, mac application and ios application, and all some project templates
* Support generate ios *.ipa file and codesign
* Add xmake.cli rule to develop lua program with xmake core engine
### Change
* [#750](https://github.com/xmake-io/xmake/issues/750): Improve qt.widgetapp rule to support private slot
* Improve Qt/deploy for android and support Qt 5.14.0
## v2.3.2
### New features
* Add powershell theme for powershell terminal
* Add `xmake --dry-run -v` to dry run building target and only show verbose build command.
* [#712](https://github.com/xmake-io/xmake/issues/712): Add sdcc platform and support sdcc compiler
### Change
* [#589](https://github.com/xmake-io/xmake/issues/589): Improve and optimize build speed, supports parallel compilation and linking across targets
* Improve the ninja/cmake generator
* [#728](https://github.com/xmake-io/xmake/issues/728): Improve os.cp to support reserve source directory structure
* [#732](https://github.com/xmake-io/xmake/issues/732): Improve find_package to support `homebrew/cmake` pacakges
* [#695](https://github.com/xmake-io/xmake/issues/695): Improve android abi
### Bugs fixed
* Fix the link errors output issues for msvc
* [#718](https://github.com/xmake-io/xmake/issues/718): Fix download cache bug for package
* [#722](https://github.com/xmake-io/xmake/issues/722): Fix invalid package deps
* [#719](https://github.com/xmake-io/xmake/issues/719): Fix process exit bug
* [#720](https://github.com/xmake-io/xmake/issues/720): Fix compile_commands generator
## v2.3.1
### New features
* [#675](https://github.com/xmake-io/xmake/issues/675): Support to compile `*.c` as c++, `add_files("*.c", {sourcekind = "cxx"})`.
* [#681](https://github.com/xmake-io/xmake/issues/681): Support compile xmake on msys/cygwin and add msys/cygwin platform
* Add socket/pipe io modules and support to schedule socket/process/pipe in coroutine
* [#192](https://github.com/xmake-io/xmake/issues/192): Try building project with the third-party buildsystem
* Enable color diagnostics output for gcc/clang
* [#588](https://github.com/xmake-io/xmake/issues/588): Improve project generator, `xmake project -k ninja`, support for build.ninja
### Change
* [#665](https://github.com/xmake-io/xmake/issues/665): Support to parse *nix style command options, thanks [@OpportunityLiu](https://github.com/OpportunityLiu)
* [#673](https://github.com/xmake-io/xmake/pull/673): Improve tab complete to support argument values
* [#680](https://github.com/xmake-io/xmake/issues/680): Improve get.sh scripts and add download mirrors
* Improve process scheduler
* [#651](https://github.com/xmake-io/xmake/issues/651): Improve os/io module syserrors tips
### Bugs fixed
* Fix incremental compilation for checking the dependent file
* Fix log output for parsing xmake-vscode/problem info
* [#684](https://github.com/xmake-io/xmake/issues/684): Fix linker errors for android ndk on windows
## v2.2.9
### New features
* [#569](https://github.com/xmake-io/xmake/pull/569): Add c++ modules build rules
* Add `xmake project -k xmakefile` generator
* [620](https://github.com/xmake-io/xmake/issues/620): Add global `~/.xmakerc.lua` for all projects.
* [593](https://github.com/xmake-io/xmake/pull/593): Add `core.base.socket` module.
### Change
* [#563](https://github.com/xmake-io/xmake/pull/563): Separate build rules for specific language files from action/build
* [#570](https://github.com/xmake-io/xmake/issues/570): Add `qt.widgetapp` and `qt.quickapp` rules
* [#576](https://github.com/xmake-io/xmake/issues/576): Uses `set_toolchain` instead of `add_tools` and `set_tools`
* Improve `xmake create` action
* [#589](https://github.com/xmake-io/xmake/issues/589): Improve the default build jobs number to optimize build speed
* [#598](https://github.com/xmake-io/xmake/issues/598): Improve find_package to support .tbd libraries on macOS
* [#615](https://github.com/xmake-io/xmake/issues/615): Support to install and use other archs and ios conan packages
* [#629](https://github.com/xmake-io/xmake/issues/629): Improve hash.uuid and implement uuid v4
* [#639](https://github.com/xmake-io/xmake/issues/639): Improve to parse argument options to support -jN
### Bugs fixed
* [#567](https://github.com/xmake-io/xmake/issues/567): Fix out of memory for serialize
* [#566](https://github.com/xmake-io/xmake/issues/566): Fix link order problem with remote packages
* [#565](https://github.com/xmake-io/xmake/issues/565): Fix run path for vcpkg packages
* [#597](https://github.com/xmake-io/xmake/issues/597): Fix run `xmake require` command too slowly
* [#634](https://github.com/xmake-io/xmake/issues/634): Fix mode.coverage rule and check flags
## v2.2.8
### New features
* Add protobuf c/c++ rules
* [#468](https://github.com/xmake-io/xmake/pull/468): Add utf-8 support for io module on windows
* [#472](https://github.com/xmake-io/xmake/pull/472): Add `xmake project -k vsxmake` plugin to support call xmake from vs/msbuild
* [#487](https://github.com/xmake-io/xmake/issues/487): Support to build the selected files for the given target
* Add filelock for io
* [#513](https://github.com/xmake-io/xmake/issues/513): Support for android/termux
* [#517](https://github.com/xmake-io/xmake/issues/517): Add `add_cleanfiles` api for target
* [#537](https://github.com/xmake-io/xmake/pull/537): Add `set_runenv` api to override os/envs
### Changes
* [#257](https://github.com/xmake-io/xmake/issues/257): Lock the whole project to avoid other process to access.
* Attempt to enable /dev/shm for the os.tmpdir
* [#542](https://github.com/xmake-io/xmake/pull/542): Improve vs unicode output for link/cl
* Improve binary bitcode lua scripts in the program directory
### Bugs fixed
* [#549](https://github.com/xmake-io/xmake/issues/549): Fix error caused by the new vsDevCmd.bat of vs2019
## v2.2.7
### New features
* [#455](https://github.com/xmake-io/xmake/pull/455): support clang as cuda compiler, try `xmake f --cu=clang`
* [#440](https://github.com/xmake-io/xmake/issues/440): Add `set_rundir()` and `add_runenvs()` api for target/run
* [#443](https://github.com/xmake-io/xmake/pull/443): Add tab completion support
* Add `on_link`, `before_link` and `after_link` for rule and target
* [#190](https://github.com/xmake-io/xmake/issues/190): Add `add_rules("lex", "yacc")` rules to support lex/yacc projects
### Changes
* [#430](https://github.com/xmake-io/xmake/pull/430): Add `add_cugencodes()` api to improve set codegen for cuda
* [#432](https://github.com/xmake-io/xmake/pull/432): support deps analyze for cu file (for CUDA 10.1+)
* [#437](https://github.com/xmake-io/xmake/issues/437): Support explict git source for xmake update, `xmake update github:xmake-io/xmake#dev`
* [#438](https://github.com/xmake-io/xmake/pull/438): Support to only update scripts, `xmake update --scriptonly dev`
* [#433](https://github.com/xmake-io/xmake/issues/433): Improve cuda to support device-link
* [#442](https://github.com/xmake-io/xmake/issues/442): Improve test library
## v2.2.6
### New features
* [#380](https://github.com/xmake-io/xmake/pull/380): Add support to export compile_flags.txt
* [#382](https://github.com/xmake-io/xmake/issues/382): Simplify simple scope settings
* [#397](https://github.com/xmake-io/xmake/issues/397): Add clib package manager support
* [#404](https://github.com/xmake-io/xmake/issues/404): Support Qt for android and deploy android apk
* Add some qt empty project templates, e.g. `widgetapp_qt`, `quickapp_qt_static` and `widgetapp_qt_static`
* [#415](https://github.com/xmake-io/xmake/issues/415): Add `--cu-cxx` config arguments to `nvcc/-ccbin`
* Add `--ndk_stdcxx=y` and `--ndk_cxxstl=gnustl_static` argument options for android NDK
### Changes
* Improve remote package manager
* Improve `target:on_xxx` scripts to support to match `android|armv7-a@macosx,linux|x86_64` pattern
* Improve loadfile to optimize startup speed, decrease 98% time
### Bugs fixed
* [#400](https://github.com/xmake-io/xmake/issues/400): fix c++ languages bug for qt rules
## v2.2.5
### New features
* Add `string.serialize` and `string.deserialize` to serialize and deserialize object, function and others.
* Add `xmake g --menu`
* [#283](https://github.com/xmake-io/xmake/issues/283): Add `target:installdir()` and `set_installdir()` api for target
* [#260](https://github.com/xmake-io/xmake/issues/260): Add `add_platformdirs` api, we can define custom platforms
* [#310](https://github.com/xmake-io/xmake/issues/310): Add theme feature
* [#318](https://github.com/xmake-io/xmake/issues/318): Add `add_installfiles` api to target
* [#339](https://github.com/xmake-io/xmake/issues/339): Improve `add_requires` and `find_package` to integrate the 3rd package manager
* [#327](https://github.com/xmake-io/xmake/issues/327): Integrate with Conan package manager
* Add the builtin api `find_packages("pcre2", "zlib")` to find multiple packages
* [#320](https://github.com/xmake-io/xmake/issues/320): Add template configuration files and replace all variables before building
* [#179](https://github.com/xmake-io/xmake/issues/179): Generate CMakelist.txt file for `xmake project` plugin
* [#361](https://github.com/xmake-io/xmake/issues/361): Support vs2019 preview
* [#368](https://github.com/xmake-io/xmake/issues/368): Support `private, public, interface` to improve dependency inheritance like cmake
* [#284](https://github.com/xmake-io/xmake/issues/284): Add passing user configs description for `package()`
* [#319](https://github.com/xmake-io/xmake/issues/319): Add `add_headerfiles` to improve to set header files and directories
* [#342](https://github.com/xmake-io/xmake/issues/342): Add some builtin help functions for `includes()`, e.g. `check_cfuncs`
### Changes
* Improve to switch version and debug mode for the dependent packages
* [#264](https://github.com/xmake-io/xmake/issues/264): Support `xmake update dev` on windows
* [#293](https://github.com/xmake-io/xmake/issues/293): Add `xmake f/g --mingw=xxx` configuration option and improve to find_mingw
* [#301](https://github.com/xmake-io/xmake/issues/301): Improve precompiled header file
* [#322](https://github.com/xmake-io/xmake/issues/322): Add `option.add_features`, `option.add_cxxsnippets` and `option.add_csnippets`
* Remove some deprecated interfaces of xmake 1.x, e.g. `add_option_xxx`
* [#327](https://github.com/xmake-io/xmake/issues/327): Support conan package manager for `lib.detect.find_package`
* Improve `lib.detect.find_package` and add builtin `find_packages("zlib 1.x", "openssl", {xxx = ...})` api
* Mark `set_modes()` as deprecated, we use `add_rules("mode.debug", "mode.release")` instead of it
* [#353](https://github.com/xmake-io/xmake/issues/353): Improve `target:set`, `target:add` and add `target:del` to modify target configuration
* [#356](https://github.com/xmake-io/xmake/issues/356): Add `qt_add_static_plugins()` api to support static Qt sdk
* [#351](https://github.com/xmake-io/xmake/issues/351): Support yasm for generating vs201x project
* Improve the remote package manager.
### Bugs fixed
* Fix cannot call `set_optimize()` to set optimization flags when exists `add_rules("mode.release")`
* [#289](https://github.com/xmake-io/xmake/issues/289): Fix unarchive gzip file failed on windows
* [#296](https://github.com/xmake-io/xmake/issues/296): Fix `option.add_includedirs` for cuda
* [#321](https://github.com/xmake-io/xmake/issues/321): Fix find program bug with $PATH envirnoment
## v2.2.3
### New features
* [#233](https://github.com/xmake-io/xmake/issues/233): Support windres for mingw platform
* [#239](https://github.com/xmake-io/xmake/issues/239): Add cparser compiler support
* Add plugin manager `xmake plugin --help`
* Add `add_syslinks` api to add system libraries dependence
* Add `xmake l time xmake [--rebuild]` to record compilation time
* [#250](https://github.com/xmake-io/xmake/issues/250): Add `xmake f --vs_sdkver=10.0.15063.0` to change windows sdk version
* Add `lib.luajit.ffi` and `lib.luajit.jit` extension modules
* [#263](https://github.com/xmake-io/xmake/issues/263): Add new target kind: object to only compile object files
### Changes
* [#229](https://github.com/xmake-io/xmake/issues/229): Improve to select toolset for vcproj plugin
* Improve compilation dependences
* Support *.xz for extractor
* [#249](https://github.com/xmake-io/xmake/pull/249): revise progress formatting to space-leading three digit percentages
* [#247](https://github.com/xmake-io/xmake/pull/247): Add `-D` and `--diagnosis` instead of `--backtrace`
* [#259](https://github.com/xmake-io/xmake/issues/259): Improve on_build, on_build_file and on_xxx for target and rule
* [#269](https://github.com/xmake-io/xmake/issues/269): Clean up the temporary files at last 30 days
* Improve remote package manager
* Support to add packages with only header file
* Support to modify builtin package links, e.g. `add_packages("xxx", {links = {}})`
### Bugs fixed
* Fix state inconsistency after failed outage of installation dependency package
## v2.2.2
### New features
* Support fasm assembler
* Add `has_config`, `get_config`, and `is_config` apis
* Add `set_config` to set the default configuration
* Add `$xmake --try` to try building project using third-party buildsystem
* Add `set_enabled(false)` to disable target
* [#69](https://github.com/xmake-io/xmake/issues/69): Add remote package management, `add_requires("tbox ~1.6.1")`
* [#216](https://github.com/xmake-io/xmake/pull/216): Add windows mfc rules
### Changes
* Improve to detect Qt envirnoment and support mingw
* Add debug and release rules to the auto-generated xmake.lua
* [#178](https://github.com/xmake-io/xmake/issues/178): Modify the shared library name for mingw.
* Support case-insensitive path pattern-matching for `add_files()` on windows
* Improve to detect Qt sdk directory for `detect.sdks.find_qt`
* [#184](https://github.com/xmake-io/xmake/issues/184): Improve `lib.detect.find_package` to support vcpkg
* [#208](https://github.com/xmake-io/xmake/issues/208): Improve rpath for shared library
* [#225](https://github.com/xmake-io/xmake/issues/225): Improve to detect vs envirnoment
### Bug fixed
* [#177](https://github.com/xmake-io/xmake/issues/177): Fix the dependent target link bug
* Fix high cpu usage bug and Exit issues for `$ xmake f --menu`
* [#197](https://github.com/xmake-io/xmake/issues/197): Fix Chinese path for generating vs201x project
* Fix wdk rules bug
* [#205](https://github.com/xmake-io/xmake/pull/205): Fix targetdir,objectdir not used in vsproject
## v2.2.1
### New features
* [#158](https://github.com/xmake-io/xmake/issues/158): Support CUDA Toolkit and Compiler
* Add `set_tools` and `add_tools` apis to change the toolchains for special target
* Add builtin rules: `mode.debug`, `mode.release`, `mode.profile` and `mode.check`
* Add `is_mode`, `is_arch` and `is_plat` builtin apis in the custom scripts
* Add color256 codes
* [#160](https://github.com/xmake-io/xmake/issues/160): Support Qt compilation environment and add `qt.console`, `qt.application` rules
* Add some Qt project templates
* [#169](https://github.com/xmake-io/xmake/issues/169): Support yasm for linux, macosx and windows
* [#159](https://github.com/xmake-io/xmake/issues/159): Support WDK driver compilation environment
### Changes
* Add FAQ to the auto-generated xmake.lua
* Support android NDK >= r14
* Improve warning flags for swiftc
* [#167](https://github.com/xmake-io/xmake/issues/167): Improve custom rules
* Improve `os.files` and `os.dirs` api
* [#171](https://github.com/xmake-io/xmake/issues/171): Improve build dependence for qt rule
* Implement `make clean` for generating makefile plugin
### Bugs fixed
* Fix force to add flags bug
* [#157](https://github.com/xmake-io/xmake/issues/157): Fix generate pdb file error if it's output directory does not exists
* Fix strip all symbols bug for macho target file
* [#168](https://github.com/xmake-io/xmake/issues/168): Fix generate vs201x project bug with x86/x64 architectures
## v2.1.9
### New features
* Add `del_files()` api to delete files in the files list
* Add `rule()`, `add_rules()` api to implement the custom build rule and improve `add_files("src/*.md", {rule = "markdown"})`
* Add `os.filesize()` api
* Add `core.ui.xxx` cui components
* Add `xmake f --menu` to configure project with a menu configuration interface
* Add `set_values` api to `option()`
* Support to generate a menu configuration interface from user custom project options
* Add source file position to interpreter and search results in menu
### Changes
* Improve to configure cross-toolchains, add tool alias to support unknown tool name, e.g. `xmake f [email protected]`
* [#151](https://github.com/xmake-io/xmake/issues/151): Improve to build the share library for the mingw platform
* Improve to generate makefile plugin
* Improve the checking errors tips
* Improve `add_cxflags` .., force to set flags without auto checking: `add_cxflags("-DTEST", {force = true})`
* Improve `add_files`, add force block to force to set flags without auto checking: `add_files("src/*.c", {force = {cxflags = "-DTEST"}})`
* Improve to search the root project directory
* Improve to detect vs environment
* Upgrade luajit to 2.1.0-beta3
* Support to run xmake on linux (arm, arm64)
* Improve to generate vs201x project plugin
### Bugs fixed
* Fix complation dependence
* [#151](https://github.com/xmake-io/xmake/issues/151): Fix `os.nuldev()` for gcc on mingw
* [#150](https://github.com/xmake-io/xmake/issues/150): Fix the command line string limitation for `ar.exe`
* Fix `xmake f --cross` error
* Fix `os.cd` to the windows root path bug
## v2.1.8
### New features
* Add `XMAKE_LOGFILE` environment variable to dump the output info to file
* Support tinyc compiler
### Changes
* Improve support for IDE/editor plugins (e.g. vscode, sublime, intellij-idea)
* Add `.gitignore` file when creating new projects
* Improve to create template project
* Improve to detect toolchains on macosx without xcode
* Improve `set_config_header` to support `set_config_header("config", {version = "2.1.8", build = "%Y%m%d%H%M"})`
### Bugs fixed
* [#145](https://github.com/xmake-io/xmake/issues/145): Fix the current directory when running target
## v2.1.7
### New features
* Add `add_imports` to bulk import modules for the target, option and package script
* Add `xmake -y/--yes` to confirm the user input by default
* Add `xmake l package.manager.install xxx` to install software package
* Add xmake plugin for vscode editor, [xmake-vscode](https://marketplace.visualstudio.com/items?itemName=tboox.xmake-vscode#overview)
* Add `xmake macro ..` to run the last command
### Changes
* Support 24bits truecolors for `cprint()`
* Support `@loader_path` and `$ORIGIN` for `add_rpathdirs()`
* Improve `set_version("x.x.x", {build = "%Y%m%d%H%M"})` and add build version
* Move docs directory to xmake-docs repo
* Improve install and uninstall actions and support DESTDIR and PREFIX envirnoment variables
* Optimize to detect flags
* Add `COLORTERM=nocolor` to disable color output
* Remove `and_bindings` and `add_rbindings` api
* Disable to output colors code to file
* Update project templates with tbox
* Improve `lib.detect.find_program` interface
* Enable colors output for windows cmd
* Add `-w|--warning` arguments to enable the warnings output
### Bugs fixed
* Fix `set_pcxxheader` bug
* [#140](https://github.com/xmake-io/xmake/issues/140): Fix `os.tmpdir()` in fakeroot
* [#142](https://github.com/xmake-io/xmake/issues/142): Fix `os.getenv` charset bug on windows
* Fix compile error with spaces path
* Fix setenv empty value bug
## v2.1.6
### Changes
* Improve `add_files` to configure the compile option of the given files
* Inherit links and linkdirs from the dependent targets and options
* Improve `target.add_deps` and add inherit config, e.g. `add_deps("test", {inherit = false})`
* Remove the binary files of `tbox.pkg`
* Use `/Zi` instead of `/ZI` for msvc
### Bugs fixed
* Fix target deps
* Fix `target:add` and `option:add` bug
* Fix compilation and installation bug on archlinux
## v2.1.5
### New features
* [#83](https://github.com/xmake-io/xmake/issues/83): Add `add_csnippet` and `add_cxxsnippet` into `option` for detecting some compiler features.
* [#83](https://github.com/xmake-io/xmake/issues/83): Add user extension modules to detect program, libraries and files.
* Add `find_program`, `find_file`, `find_library`, `find_tool` and `find_package` module interfaces.
* Add `net.*` and `devel.*` extension modules
* Add `val()` api to get the value of builtin-variable, e.g. `val("host")`, `val("env PATH")`, `val("shell echo hello")` and `val("reg HKEY_LOCAL_MACHINE\\XX;Value")`
* Support to compile the microsoft resource file (.rc)
* Add `has_flags`, `features` and `has_features` for detect module interfaces.
* Add `option.on_check`, `option.after_check` and `option.before_check` api
* Add `target.on_load` api
* [#132](https://github.com/xmake-io/xmake/issues/132): Add `add_frameworkdirs` api
* Add `lib.detect.has_xxx` and `lib.detect.find_xxx` apis.
* Add `add_moduledirs` api
* Add `includes` api instead of `add_subdirs` and `add_subfiles`
* [#133](https://github.com/xmake-io/xmake/issues/133): Improve the project plugin to generate `compile_commands.json` by run `xmake project -k compile_commands`
* Add `set_pcheader` and `set_pcxxheader` to support the precompiled header, support gcc, clang, msvc
* Add `xmake f -p cross` platform and support the custom platform
### Changes
* [#87](https://github.com/xmake-io/xmake/issues/87): Add includes and links from target deps automatically
* Improve `import` to load user extension and global modules
* [#93](https://github.com/xmake-io/xmake/pull/93): Improve `xmake lua` to run a single line command
* Improve to print gcc error and warning info
* Improve `print` interface to dump table
* [#111](https://github.com/xmake-io/xmake/issues/111): Add `--root` common option to allow run xmake command as root
* [#113](https://github.com/xmake-io/xmake/pull/113): Privilege manage when running as root, store the root privilege and degrade.
* Improve `xxx_script` in `xmake.lua` to support pattern match, e.g. `on_build("iphoneos|arm*", function (target) end)`
* improve builtin-variables to support to get the value envirnoment and registry
* Improve to detect vstudio sdk and cross toolchains envirnoment
* [#71](https://github.com/xmake-io/xmake/issues/71): Improve to detect compiler and linker from env vars
* Improve the option detection (cache and multi-jobs) and increase 70% speed
* [#129](https://github.com/xmake-io/xmake/issues/129): Check link deps and cache the target file
* Support `*.asm` source files for vs201x project plugin
* Mark `add_bindings` and `add_rbindings` as deprecated
* Optimize `xmake rebuild` speed on windows
* Move `core.project.task` to `core.base.task`
* Move `echo` and `app2ipa` plugins to [xmake-plugins](https://github.com/xmake-io/xmake-plugins) repo.
* Add new api `set_config_header("config.h", {prefix = ""})` instead of `set_config_h` and `set_config_h_prefix`
### Bugs fixed
* Fix `try-catch-finally`
* Fix interpreter bug when parsing multi-level subdirs
* [#115](https://github.com/xmake-io/xmake/pull/115): Fix the path problem of the install script `get.sh`
* Fix cache bug for import()
## v2.1.4
### New features
* [#68](https://github.com/xmake-io/xmake/issues/68): Add `$(programdir)` and `$(xmake)` builtin variables
* add `is_host` api to get current host operating system
* [#79](https://github.com/xmake-io/xmake/issues/79): Improve `xmake lua` to run interactive commands, read-eval-print (REPL)
### Changes
* Modify option menu color.
* [#71](https://github.com/xmake-io/xmake/issues/71): Improve to map optimization flags for cl.exe
* [#73](https://github.com/xmake-io/xmake/issues/73): Attempt to get executable path as xmake's program directory
* Improve the scope of `xmake.lua` in `add_subdirs` and use independent sub-scope to avoid dirty scope
* [#78](https://github.com/xmake-io/xmake/pull/78): Get terminal size in runtime and soft-wrap the help printing
* Avoid generate `.xmake` directory if be not in project
### Bugs fixed
* [#67](https://github.com/xmake-io/xmake/issues/67): Fix `sudo make install` permission problem
* [#70](https://github.com/xmake-io/xmake/issues/70): Fix check android compiler error
* Fix temporary file path conflict
* Fix `os.host` and `os.arch` interfaces
* Fix interpreter bug for loading root api
* [#77](https://github.com/xmake-io/xmake/pull/77): fix `cprint` no color reset eol
## v2.1.3
### New features
* [#65](https://github.com/xmake-io/xmake/pull/65): Add `set_default` api for target to modify default build and install behavior
* Allows to run `xmake` command in project subdirectories, it will find the project root directory automatically
* Add `add_rpathdirs` for target and option
### Changes
* [#61](https://github.com/xmake-io/xmake/pull/61): Provide safer `xmake install` and `xmake uninstall` task with administrator permission
* Provide `rpm`, `deb` and `osxpkg` install package
* [#63](https://github.com/xmake-io/xmake/pull/63): More safer build and install xmake
* [#61](https://github.com/xmake-io/xmake/pull/61): Check run command as root
* Improve check toolchains and implement delay checking
* Add user tips when scanning and generating `xmake.lua` automatically
### Bugs fixed
* Fix error tips for checking xmake min version
* [#60](https://github.com/xmake-io/xmake/issues/60): Fix self-build for macosx and windows
* [#64](https://github.com/xmake-io/xmake/issues/64): Fix compile android `armv8-a` error
* [#50](https://github.com/xmake-io/xmake/issues/50): Fix only position independent executables issue for android program
## v2.1.2
### New features
* Add aur package script and support to install xmake from yaourt
* Add [set_basename](#http://xmake.io/#/manual?id=targetset_basename) api for target
### Changes
* Support vs2017
* Support compile rust for android
* Improve vs201x project plugin and support multi-modes compilation.
### Bugs fixed
* Fix cannot find android sdk header files
* Fix checking option bug
* [#57](https://github.com/xmake-io/xmake/issues/57): Fix code files mode to 0644
## v2.1.1
### New features
* Add `--links`, `--linkdirs` and `--includedirs` configure arguments
* Add app2ipa plugin
* Add dictionary syntax style for `xmake.lua`
* Provide smart scanning and building mode without `xmake.lua`
* Add `set_xmakever` api for `xmake.lua`
* Add `add_frameworks` api for `objc` and `swift`
* Support multi-languages extension and add `golang`, `dlang` and `rust` language
* Add optional `target_end`, `option_end`, `task_end` apis for scope
* Add `golang`, `dlang` and `rust` project templates
### Changes
* Support vs2017 for the project plugin
* Improve gcc error and warning tips
* Improve lanuage module
* Improve print interface, support lua print and format output
* Automatically scan project files and generate it for building if xmake.lua not exists
* Modify license to Apache License 2.0
* Remove some binary tools
* Remove install.bat script and provide nsis install package
* Rewrite [documents](http://www.xmake.io/#/home/) using [docute](https://github.com/egoist/docute)
* Improve `os.run`, `os.exec`, `os.cp`, `os.mv` and `os.rm` interfaces and support wildcard pattern
* Optimize the output info and add `-q|--quiet` option
* Improve makefile generator, uses $(XX) variables for tools and flags
### Bugs fixed
* [#41](https://github.com/waruqi/xmake/issues/41): Fix checker bug for windows
* [#43](https://github.com/waruqi/xmake/issues/43): Avoid generating unnecessary .xmake directory
* Add c++ stl search directories for android
* Fix compile error for rhel 5.10
* Fix `os.iorun` bug
## v2.0.5
### New features
* Add some interpreter builtin-modules
* Support ml64 assembler for windows x64
### Changes
* Improve ipairs and pairs interfaces and support filter
* Add filters for generating vs201x project
* Remove `core/tools` (msys toolchains) and uses xmake to compile core sources on windows
* Remove `xmake/packages` for templates
### Bugs fixed
* Fix `-def:xxx.def` flags failed for msvc
* Fix ml.exe assembler script
* Fix options linking order bug
## v2.0.4
### New features
* Add native shell support for `xmake.lua`. e.g. `add_ldflags("$(shell pkg-config --libs sqlite3)")`
* Enable pdb symbol files for windows
* Add debugger support on windows (vsjitdebugger, ollydbg, windbg ... )
* Add `getenv` interface for the global scope of `xmake.lua`
* Add plugin for generating vstudio project file (vs2002 - vs2015)
* Add `set_default` api for option
### Changes
* Improve builtin-variable format
* Support option for string type
### Bugs fixed
* Fix check ld failed without g++ on linux
* Fix compile `*.cxx` files failed
## v2.0.3
### New features
* Add check includes dependence automatically
* Add print colors
* Add debugger support, e.g. `xmake run -d program ...`
### Changes
* Improve the interfaces of run shell
* Upgrade luajit to v2.0.4
* Improve to generate makefile plugin
* Optimizate the multitasking compiling speed
### Bugs fixed
* Fix install directory bug
* Fix the root directory error for `import` interface
* Fix check visual stdio error on windows
## v2.0.2
### Changes
* Change install and uninstall actions
* Update templates
* Improve to check function
### Bugs fixed
* [#7](https://github.com/waruqi/xmake/issues/7): Fix create project bug with '[targetname]'
* [#9](https://github.com/waruqi/xmake/issues/9): Support clang with c++11
* Fix api scope leaks bug
* Fix path bug for windows
* Fix check function bug
* Fix check toolchains failed
* Fix compile failed for android on windows
## v2.0.1
### New features
* Add task api for running custom tasks
* Add plugin expansion and provide some builtin plugins
* Add export ide project plugin(e.g. makefile and will support to export other projects for vs, xcode in feature)
* Add demo plugin for printing 'hello xmake'
* Add make doxygen documents plugin
* Add macro script plugin
* Add more modules for developing plugin
* Add exception using try/catch and simplify grammar for plugin script
* Add option bindings
* Show progress when building
### Changes
* Rewrite interpreter for xmake.lua
* More strict syntax detection mechanism
* More strict api scope for xmake.lua
* Simplify template development
* Extend platforms, tools, templates and actions fastly
* Simplify api and support import modules
* Remove dependence for gnu make/nmake, no longer need makefile
* Optimize speed for building and faster x4 than v1.0.4
* Optimize automatic detection
* Modify some api name, but be compatible with the old version
* Optimize merging static library
* Simplify cross compilation using argument `--sdk=xxx`
* Simplify boolean option for command line, e.g. `xmake config --xxx=[y|n|yes|no|true|false]`
* Merge iphoneos and iphonesimulator platforms
* Merge watchos and watchsimulator platformss
### Bugs fixed
* [#3](https://github.com/waruqi/xmake/issues/3): ArchLinux compilation failed
* [#4](https://github.com/waruqi/xmake/issues/4): Install failed for windows
* Fix envirnoment variable bug for windows
## v1.0.4
### New features
* Support windows assembler
* Add some project templates
* Support swift codes
* Add -v argument for outputing more verbose info
* Add apple platforms:watchos, watchsimulator
* Add architecture x64, amd64, x86_amd64 for windows
* Support switch static and share library
* Add `-j/--jobs` argument for supporting multi-jobs
### Changes
* Improve `add_files` api and support to add `*.o/obj/a/lib` files for merging static library and object files
* Optimize installation and remove some binary files
### Bugs fixed
* [#1](https://github.com/waruqi/xmake/issues/4): Install failed for win7
* Fix checking toolchains bug
* Fix install script bug
* Fix install bug for linux x86_64
## v1.0.3
### New features
* Add `set_runscript` api and support custom action
* Add import api and support import modules in xmake.lua, e.g. os, path, utils ...
* Add new architecture: arm64-v8a for android
### Bugs fixed
* Fix api bug for `set_installscript`
* Fix install bug for windows `x86_64`
* Fix relative path bug
<h1 id="中文"></h1>
# 更新日志
## master (开发中)
### 新特性
* [#5462](https://github.com/xmake-io/xmake/pull/5462): 添加 `xmake l cli.bisect`
* [#5488](https://github.com/xmake-io/xmake/pull/5488): 支持使用 cosmocc 去构建 xmake 自身二进制
* [#5491](https://github.com/xmake-io/xmake/pull/5491): 支持提供内嵌 lua 文件的单个 xmake 二进制文件
### 改进
* [#5507](https://github.com/xmake-io/xmake/issues/5507): 改进 git clone 下载速度
### Bugs 修复
* [#4750](https://github.com/xmake-io/xmake/issues/4750): 修复 compile_commands 生成器,支持 `xmake tests`
* [#5465](https://github.com/xmake-io/xmake/pull/5465): 修复 package requires lock
## v2.9.4
### 新特性
* [#5278](https://github.com/xmake-io/xmake/issues/5278): 添加 `build.intermediate_directory` 策略去禁用中间目录生成
* [#5313](https://github.com/xmake-io/xmake/issues/5313): 添加 windows arm/arm64ec 支持
* [#5296](https://github.com/xmake-io/xmake/issues/5296): 添加 Intel LLVM Fortran 编译器支持
* [#5384](https://github.com/xmake-io/xmake/issues/5384): 为包添加 `add_bindirs` 配置支持
### 改进
* [#5280](https://github.com/xmake-io/xmake/issues/5280): 添加缺失的 C++20 Modules 文件扩展
* [#5251](https://github.com/xmake-io/xmake/issues/5251): 为 windows installer 更新内置的 7z/curl
* [#5286](https://github.com/xmake-io/xmake/issues/5286): 改进 json 支持16进制解析
* [#5302](https://github.com/xmake-io/xmake/pull/5302): 改进 Vala 支持
* [#5335](https://github.com/xmake-io/xmake/pull/5335): 改进 `xmake install` 和 `xpack`,添加 `set_prefixdir` 接口
* [#5387](https://github.com/xmake-io/xmake/pull/5387): 改进 `xmake test`
* [#5376](https://github.com/xmake-io/xmake/pull/5376): 改进 C++ module 对象列表处理和 moduleonly 包支持
### Bugs 修复
* [#5288](https://github.com/xmake-io/xmake/issues/5288): 修复 `xmake test` 对 Unity Build 的支持
* [#5270](https://github.com/xmake-io/xmake/issues/5270): 修复 gcc/clang 对 pch 的支持
* [#5276](https://github.com/xmake-io/xmake/issues/5276): 修复查找 vc6 环境
* [#5259](https://github.com/xmake-io/xmake/issues/5259): 修复命令补全失效问题
## v2.9.3
### 新特性
* [#4637](https://github.com/xmake-io/xmake/issues/4637): 为 xpack 添加 mix 支持
* [#5107](https://github.com/xmake-io/xmake/issues/5107): 为 xpack 添加 deb 支持
* [#5148](https://github.com/xmake-io/xmake/issues/5148): 为包添加 on_source 配置域
### 改进
* [#5156](https://github.com/xmake-io/xmake/issues/5156): 改进安装 cargo 包
### 问题修复
* [#5176](https://github.com/xmake-io/xmake/pull/5176): 修复 VS toolset v144 支持
## v2.9.2
### 新特性
* [#5005](https://github.com/xmake-io/xmake/pull/5005): 显示所有 API
* [#5003](https://github.com/xmake-io/xmake/issues/5003): 添加 build.fence 策略
* [#5060](https://github.com/xmake-io/xmake/issues/5060): 支持 Verilator 静态库目标构建
* [#5074](https://github.com/xmake-io/xmake/pull/5074): 添加 `xrepo download` 命令去快速下载包源码
* [#5086](https://github.com/xmake-io/xmake/issues/5986): 添加包检测支持
* [#5103](https://github.com/xmake-io/xmake/pull/5103): 添加 qt ts 构建支持
* [#5104](https://github.com/xmake-io/xmake/pull/5104): 改进 find_program,在 windows 上调用 where 改进查找
### 改进
* [#5077](https://github.com/xmake-io/xmake/issues/5077): 当构建 x86 目标时,使用 x64 的 msvc 编译工具
* [#5109](https://github.com/xmake-io/xmake/issues/5109): 改进 add_rpathdirs 支持 runpath/rpath 切换
* [#5132](https://github.com/xmake-io/xmake/pull/5132): 改进 ifort/icc/icx 在 windows 上的支持
### Bugs 修复
* [#5059](https://github.com/xmake-io/xmake/issues/5059): 修复加载大量 targets 时候卡住
* [#5029](https://github.com/xmake-io/xmake/issues/5029): 修复在 termux 上崩溃问题
## v2.9.1
### 新特性
* [#4874](https://github.com/xmake-io/xmake/pull/4874): 添加鸿蒙 SDK 支持
* [#4889](https://github.com/xmake-io/xmake/issues/4889): 添加 signal 模块 去注册信号处理
* [#4925](https://github.com/xmake-io/xmake/issues/4925): 添加 native 模块支持
* [#4938](https://github.com/xmake-io/xmake/issues/4938): 增加对 cppfront/h2 的支持
### 改进
* 改进包管理,支持切换 clang-cl
* [#4893](https://github.com/xmake-io/xmake/issues/4893): 改进 rc 头文件依赖检测
* [#4928](https://github.com/xmake-io/xmake/issues/4928): 改进构建和链接速度,增量编译时候效果更加明显
* [#4931](https://github.com/xmake-io/xmake/pull/4931): 更新 pdcurses
* [#4973](https://github.com/xmake-io/xmake/issues/4973): 改进选择脚本的匹配模式
### Bugs 修复
* [#4882](https://github.com/xmake-io/xmake/issues/4882): 修复安装组依赖问题
* [#4877](https://github.com/xmake-io/xmake/issues/4877): 修复 xpack 打包时,unit build 编译失败问题
* [#4887](https://github.com/xmake-io/xmake/issues/4887): 修复 object 依赖链接
## v2.8.9
### 新特性
* [#4843](https://github.com/xmake-io/xmake/issues/4843): 添加 check_bigendian 接口实现大小端探测
### 改进
* [#4798](https://github.com/xmake-io/xmake/issues/4798): 改进 wasi sdk 检测
* [#4772](https://github.com/xmake-io/xmake/issues/4772): 改进 tools.cmake 去兼容支持 vs2022 preview (v144)
* [#4813](https://github.com/xmake-io/xmake/issues/4813): 添加 gb2312 编码
* [#4864](https://github.com/xmake-io/xmake/issues/4864): 改进抽取符号,支持 gdb 断点调试
* [#4831](https://github.com/xmake-io/xmake/issues/4831): 改进 target:fileconfig() 支持 headerfiles
* [#4846](https://github.com/xmake-io/xmake/issues/4846): 改进进度显示,解决顺序错乱问题
### Bugs 修复
* 修复 select_script 的脚本模式匹配
* [#4763](https://github.com/xmake-io/xmake/issues/4763): 修复 {force = true}
* [#4807](https://github.com/xmake-io/xmake/issues/4807): 修复 nimble::find_package
* [#4857](https://github.com/xmake-io/xmake/issues/4857): 修复对 -P/-F 等基础选项的解析
## v2.8.8
### 改进
* 添加 `package:check_sizeof()`
### Bugs 修复
* [#4774](https://github.com/xmake-io/xmake/issues/4774): 修复 Android NDK r26b 上的 strip 支持
* [#4769](https://github.com/xmake-io/xmake/issues/4769): 修复交叉编译工具链问题
* [#4776](https://github.com/xmake-io/xmake/issues/4776): 修复 soname
* [#4638](https://github.com/xmake-io/xmake/issues/4638): 修复 vsxmake generator
## v2.8.7
### 新特性
* [#4544](https://github.com/xmake-io/xmake/issues/4544): 改进 `xmake test`,支持等待进程超时
* [#4606](https://github.com/xmake-io/xmake/pull/4606): 为 package 添加 `add_versionfiles` 接口
* [#4709](https://github.com/xmake-io/xmake/issues/4709): 添加 cosmocc 工具链支持
* [#4715](https://github.com/xmake-io/xmake/issues/4715): 在描述域添加 is_cross() 接口
* [#4747](https://github.com/xmake-io/xmake/issues/4747): 添加 `build.always_update_configfiles` 策略
### 改进
* [#4575](https://github.com/xmake-io/xmake/issues/4575): 检测无效的域参数
* 添加更多的 loong64 支持
* 改进 dlang/dmd 对 frameworks 的支持
* [#4571](https://github.com/xmake-io/xmake/issues/4571): 改进 `xmake test` 的输出支持
* [#4609](https://github.com/xmake-io/xmake/issues/4609): 改进探测 vs 构建工具环境
* [#4614](https://github.com/xmake-io/xmake/issues/4614): 改进支持 android ndk 26b
* [#4473](https://github.com/xmake-io/xmake/issues/4473): 默认启用警告输出
* [#4477](https://github.com/xmake-io/xmake/issues/4477): 改进 runtimes 去支持 libc++/libstdc++
* [#4657](https://github.com/xmake-io/xmake/issues/4657): 改进脚本的模式匹配
* [#4673](https://github.com/xmake-io/xmake/pull/4673): 重构模块支持
* [#4746](https://github.com/xmake-io/xmake/pull/4746): 为 cmake generator 添加原生 c++ modules 支持
### Bugs 修复
* [#4596](https://github.com/xmake-io/xmake/issues/4596): 修复远程构建缓存
* [#4689](https://github.com/xmake-io/xmake/issues/4689): 修复目标依赖继承
## v2.8.6
### 新特性
* 添加 `network.mode` 策略
* [#1433](https://github.com/xmake-io/xmake/issues/1433): 添加 `xmake pack` 命令去生成 NSIS/zip/tar.gz/rpm/srpm/runself 安装包
* [#4435](https://github.com/xmake-io/xmake/issues/4435): 为 UnityBuild 的组模式增加 batchsize 支持
* [#4485](https://github.com/xmake-io/xmake/pull/4485): 新增 package.install_locally 策略支持
* 新增 NetBSD 支持
### Changes
* [#4484](https://github.com/xmake-io/xmake/pull/4484): 改进 swig 规则
* 改进 Haiku 支持
### Bugs 修复
* [#4372](https://github.com/xmake-io/xmake/issues/4372): 修复 protobuf 规则
* [#4439](https://github.com/xmake-io/xmake/issues/4439): 修复 asn1c 规则
## v2.8.5
### 新特性
* [#1452](https://github.com/xmake-io/xmake/issues/1452): 支持链接顺序调整,链接组
* [#1438](https://github.com/xmake-io/xmake/issues/1438): 支持代码 amalgamation
* [#3381](https://github.com/xmake-io/xmake/issues/3381): 添加 `xmake test` 支持
* [#4276](https://github.com/xmake-io/xmake/issues/4276): 支持自定义域 API
* [#4286](https://github.com/xmake-io/xmake/pull/4286): 添加 Apple XROS 支持
* [#4345](https://github.com/xmake-io/xmake/issues/4345): 支持检测类型大小 sizeof
* [#4369](https://github.com/xmake-io/xmake/pull/4369): 添加 windows.manifest.uac 策略
### 改进
* [#4284](https://github.com/xmake-io/xmake/issues/4284): 改进内置 includes 模块
### Bugs 修复
* [#4256](https://github.com/xmake-io/xmake/issues/4256): 为 vsxmake 生成器修复 c++ modules intellisense
## v2.8.3
### 新特性
* [#4122](https://github.com/xmake-io/xmake/issues/4122): 支持 Lua 调试 (EmmyLua)
* [#4132](https://github.com/xmake-io/xmake/pull/4132): 支持 cppfront
* [#4147](https://github.com/xmake-io/xmake/issues/4147): 添加 hlsl2spv 规则
* 添加 lib.lua.package 模块
* [#4226](https://github.com/xmake-io/xmake/issues/4226): 新增 asan 相关策略和对包的支持
* 添加 `run.autobuild` 策略开启运行前自动构建
* 添加全局策略 `xmake g --policies=`
### 改进
* [#4119](https://github.com/xmake-io/xmake/issues/4119): 改进支持 emcc 工具链和 emscripten 包的整合
* [#4154](https://github.com/xmake-io/xmake/issues/4154): 添加 `xmake -r --shallow target` 去改进重建目标,避免重建所有依赖目标
* 添加全局 ccache 存储目录
* [#4137](https://github.com/xmake-io/xmake/issues/4137): 改进 Qt,支持 Qt6 for Wasm
* [#4173](https://github.com/xmake-io/xmake/issues/4173): 添加 recheck 参数到 on_config
* [#4200](https://github.com/xmake-io/xmake/pull/4200): 改进远程构建,支持调试本地 xmake 源码
* [#4209](https://github.com/xmake-io/xmake/issues/4209): 添加 extra 和 pedantic 警告
### Bugs 修复
* [#4110](https://github.com/xmake-io/xmake/issues/4110): 修复 extrafiles
* [#4115](https://github.com/xmake-io/xmake/issues/4115): 修复 compile_commands 生成器
* [#4199](https://github.com/xmake-io/xmake/pull/4199): 修复 compile_commands 生成器对 c++ modules 的支持
* 修复 os.mv 在 windows 上跨驱动盘失败问题
* [#4214](https://github.com/xmake-io/xmake/issues/4214): 修复 rust workspace 构建问题
## v2.8.2
### 新特性
* [#4002](https://github.com/xmake-io/xmake/issues/4002): 增加 soname 支持
* [#1613](https://github.com/xmake-io/xmake/issues/1613): 为 add_vectorexts 增加 avx512 和 sse4.2 支持
* [#2471](https://github.com/xmake-io/xmake/issues/2471): 添加 set_encodings API 去设置源文件和目标文件的编码
* [#4071](https://github.com/xmake-io/xmake/pull/4071): 支持 sdcc 的 stm8 汇编器
* [#4101](https://github.com/xmake-io/xmake/issues/4101): 为 c/c++ 添加 force includes
* [#2384](https://github.com/xmake-io/xmake/issues/2384): 为 vs/vsxmake 生成器添加 add_extrafiles 接口
### 改进
* [#3960](https://github.com/xmake-io/xmake/issues/3960): 改进 msys2/crt64 支持
* [#4032](https://github.com/xmake-io/xmake/pull/4032): 移除一些非常老的废弃接口
* 改进 tools.msbuild 升级 vcproj 文件
* 支持 add_requires("xmake::xxx") 包
* [#4049](https://github.com/xmake-io/xmake/issues/4049): 改进 Rust 支持交叉编译
* 改进 clang 下 c++ modules 支持
### Bugs 修复
* 修复 macOS/Linux 上子子进程无法快速退出问题
## v2.8.1
### 新特性
* [#3821](https://github.com/xmake-io/xmake/pull/3821): windows 安装器添加长路径支持选项
* [#3828](https://github.com/xmake-io/xmake/pull/3828): 添加 zypper 包管理器支持
* [#3871](https://github.com/xmake-io/xmake/issues/3871): 改进 tools.msbuild 支持对 vsproj 进行自动升级
* [#3148](https://github.com/xmake-io/xmake/issues/3148): 改进 protobuf 支持 grpc
* [#3889](https://github.com/xmake-io/xmake/issues/3889): add_links 支持库路径添加
* [#3912](https://github.com/orgs/xmake-io/issues/3912): 添加 set_pmxxheader 去支持 objc 预编译头
* add_links 支持库文件路径
### 改进
* [#3752](https://github.com/xmake-io/xmake/issues/3752): 改进 windows 上 os.getenvs 的获取
* [#3371](https://github.com/xmake-io/xmake/issues/3371): 改进 tools.cmake 支持使用 ninja 去构建 wasm 包
* [#3777](https://github.com/xmake-io/xmake/issues/3777): 改进从 pkg-config 中查找包
* [#3815](https://github.com/xmake-io/xmake/pull/3815): 改进 tools.xmake 支持为 windows 平台传递工具链
* [#3857](https://github.com/xmake-io/xmake/issues/3857): 改进生成 compile_commands.json
* [#3892](https://github.com/xmake-io/xmake/issues/3892): 改进包搜索,支持从描述中找包
* [#3916](https://github.com/xmake-io/xmake/issues/3916): 改进构建 swift 程序,支持模块间符号调用
* 更新 lua 运行时到 5.4.6
### Bugs 修复
* [#3755](https://github.com/xmake-io/xmake/pull/3755): 修复 find_tool 从 xmake/packages 中查找程序
* [#3787](https://github.com/xmake-io/xmake/issues/3787): 修复从 conan 2.x 中使用包
* [#3839](https://github.com/orgs/xmake-io/discussions/3839): 修复 conan 2.x 包的 vs_runtime 设置
## v2.7.9
### 新特性
* [#3613](https://github.com/xmake-io/xmake/issues/3613): 添加 `wasm.preloadfiles` 扩展配置
* [#3703](https://github.com/xmake-io/xmake/pull/3703): 支持 conan >=2.0.5
### 改进
* [#3669](https://github.com/xmake-io/xmake/issues/3669): 改进 cmake 生成器支持特定工具的 cxflags
* [#3679](https://github.com/xmake-io/xmake/issues/3679): 改进 `xrepo clean`
* [#3662](https://github.com/xmake-io/xmake/issues/3662): 改进 cmake/make 生成器去更好的支持 lex/yacc 工程
* [#3697](https://github.com/xmake-io/xmake/issues/3662): 改进 trybuild/cmake
* [#3730](https://github.com/xmake-io/xmake/issues/3730): 改进 c++modules 包安装,解决不同目录同名文件分发冲突问题
### Bugs 修复
* [#3596](https://github.com/xmake-io/xmake/issues/3596): 修复 check_cxxfuncs 和 check_cxxsnippets
* [#3603](https://github.com/xmake-io/xmake/issues/3603): 修复 xmake update 的无效 url
* [#3614](https://github.com/xmake-io/xmake/issues/3614): 修复 xmake run 对 Qt 环境的加载
* [#3628](https://github.com/xmake-io/xmake/issues/3628): 修复 msys2/mingw 下 os.exec 总是优先查找错误的可执行程序
* 修复 msys/mingw 下环境变量设置问题
## v2.7.8
### 新特性
* [#3518](https://github.com/xmake-io/xmake/issues/3518): 分析编译和链接性能
* [#3522](https://github.com/xmake-io/xmake/issues/3522): 为 target 添加 has_cflags, has_xxx 等辅助接口
* [#3537](https://github.com/xmake-io/xmake/issues/3537): 为 clang.tidy 检测器添加 `--fix` 自动修复
### 改进
* [#3433](https://github.com/xmake-io/xmake/issues/3433): 改进 QT 在 msys2/mingw64 和 wasm 上的构建支持
* [#3419](https://github.com/xmake-io/xmake/issues/3419): 支持 fish shell 环境
* [#3455](https://github.com/xmake-io/xmake/issues/3455): Dlang 增量编译支持
* [#3498](https://github.com/xmake-io/xmake/issues/3498): 改进绑定包虚拟环境
* [#3504](https://github.com/xmake-io/xmake/pull/3504): 添加 swig java 支持
* [#3508](https://github.com/xmake-io/xmake/issues/3508): 改进 trybuild/cmake 去支持工具链切换
* 为 msvc 禁用 build cache 加速,因为 msvc 的预处理器太慢,反而极大影响构建性能。
### Bugs 修复
* [#3436](https://github.com/xmake-io/xmake/issues/3436): 修复自动补全和 menuconf
* [#3463](https://github.com/xmake-io/xmake/issues/3463): 修复 c++modules 缓存问题
* [#3545](https://github.com/xmake-io/xmake/issues/3545): 修复 armcc 的头文件依赖解析
## v2.7.7
### 新特性
* 添加 Haiku 支持
* [#3326](https://github.com/xmake-io/xmake/issues/3326): 添加 `xmake check` 去检测工程代码 (clang-tidy) 和 API 参数配置
* [#3332](https://github.com/xmake-io/xmake/pull/3332): 在包中配置添加自定义 http headers
### 改进
* [#3318](https://github.com/xmake-io/xmake/pull/3318): 改进 dlang 工具链
* [#2591](https://github.com/xmake-io/xmake/issues/2591): 改进 target 配置来源分析
* 为 dmd/ldc2 改进 strip/optimization
* [#3342](https://github.com/xmake-io/xmake/issues/3342): 改进配置构建目录,支持外置目录构建,保持远吗目录更加干净
* [#3373](https://github.com/xmake-io/xmake/issues/3373): 为 clang-17 改进 std 模块支持
### Bugs 修复
* [#3317](https://github.com/xmake-io/xmake/pull/3317): 针对 Qt 工程,修复 lanuages 设置
* [#3321](https://github.com/xmake-io/xmake/issues/3321): 修复隔天 configfiles 重新生成导致重编问题
* [#3296](https://github.com/xmake-io/xmake/issues/3296): 修复 macOS arm64 上构建失败
## v2.7.6
### 新特性
* [#3228](https://github.com/xmake-io/xmake/pull/3228): C++ modules 的安装发布,以及从包中导入 C++ modules 支持
* [#3257](https://github.com/xmake-io/xmake/issues/3257): 增加对 iverilog 和 verilator 的支持
* 支持 xp 和 vc6.0
* [#3214](https://github.com/xmake-io/xmake/pull/3214): xrepo install 的自动补全支持
### 改进
* [#3255](https://github.com/xmake-io/xmake/pull/3225): 改进 clang libc++ 模块支持
* 支持使用 mingw 编译 xmake
* 改进 xmake 在 win xp 上的兼容性
* 如果外部依赖被启用,切换 json 模块到纯 lua 实现,移除对 lua-cjson 的依赖
### Bugs 修复
* [#3229](https://github.com/xmake-io/xmake/issues/3229): 修复 vs2015 下找不到 rc.exe 问题
* [#3271](https://github.com/xmake-io/xmake/issues/3271): 修复支持带有空格的宏定义
* [#3273](https://github.com/xmake-io/xmake/issues/3273): 修复 nim 链接错误
* [#3286](https://github.com/xmake-io/xmake/issues/3286): 修复 compile_commands 对 clangd 的支持
## v2.7.5
### 新特性
* [#3201](https://github.com/xmake-io/xmake/pull/3201): 为 xrepo 添加命令自动补全
* [#3233](https://github.com/xmake-io/xmake/issues/3233): 添加 MASM32 sdk 工具链
### 改进
* [#3216](https://github.com/xmake-io/xmake/pull/3216): 改进 intel one api toolkits 探测
* [#3020](https://github.com/xmake-io/xmake/issues/3020): 添加 `--lsp=clangd` 去改进 compile_commands.json 的生成
* [#3215](https://github.com/xmake-io/xmake/issues/3215): 添加 includedirs 和 defines 到 c51 编译器
* [#3251](https://github.com/xmake-io/xmake/issues/3251): 改进 zig and c 混合编译
### Bugs 修复
* [#3203](https://github.com/xmake-io/xmake/issues/3203): 修复 compile_commands
* [#3222](https://github.com/xmake-io/xmake/issues/3222): 修复 objc 的预编译头支持
* [#3240](https://github.com/xmake-io/xmake/pull/3240): 修复 `xmake run` 处理单个参数不正确问题
* [#3238](https://github.com/xmake-io/xmake/pull/3238): 修复 clang 构建 module 时候,并行写入 mapper 冲突问题
## v2.7.4
### 新特性
* [#3049](https://github.com/xmake-io/xmake/pull/3049): 添加 `xmake format` 插件
* 添加 `plugin.compile_commands.autoupdate` 规则
* [#3172](https://github.com/xmake-io/xmake/pull/3172): 添加 xmake.sh
* [#3168](https://github.com/xmake-io/xmake/pull/3168): 为 msvc 添加 C++23 标准模块支持
### 改进
* [#3056](https://github.com/xmake-io/xmake/issues/3056): 改进 Zig 支持
* [#3060](https://github.com/xmake-io/xmake/issues/3060): 改进支持 msys2 的环境探测
* [#3071](https://github.com/xmake-io/xmake/issues/3071): 为 llvm/clang 工具链支持 rc 编译
* [#3122](https://github.com/xmake-io/xmake/pull/3122): 改进 c++20 模块依赖图的源码分析,支持预处理
* [#3125](https://github.com/xmake-io/xmake/pull/3125): 增加私有 C++20 模块的编译支持
* [#3133](https://github.com/xmake-io/xmake/pull/3133): 增加 internal partitions 模块支持
* [#3146](https://github.com/xmake-io/xmake/issues/3146): 添加默认包组件支持
* [#3192](https://github.com/xmake-io/xmake/issues/3192): 为 auto complete 增加 json 输出支持
### Bugs 修复
* 修复 requires-lock 问题
* [#3065](https://github.com/xmake-io/xmake/issues/3065): 修复部分依赖包没有被安装的问题
* [#3082](https://github.com/xmake-io/xmake/issues/3082): 修复 build.ninja 生成器
* [#3092](https://github.com/xmake-io/xmake/issues/3092): 修复 xrepo add-repo 添加失败逻辑
* [#3013](https://github.com/xmake-io/xmake/issues/3013): 修复支持 windows UNC 路径
* [#2902](https://github.com/xmake-io/xmake/issues/2902): 修复文件被其他子进程占用问题
* [#3074](https://github.com/xmake-io/xmake/issues/3074): 修复 CMakelists 生成器链接参数设置不对问题
* [#3141](https://github.com/xmake-io/xmake/pull/3141): 修复 C++ 模块的导入顺序
* 修复 tools/xmake 包安装构建目录
* [#3159](https://github.com/xmake-io/xmake/issues/3159): 为 CLion 修复 compile_commands
## v2.7.3
### 新特性
* 一种新的可选域配置语法,对 LSP 友好,并且支持域隔离。
* [#2944](https://github.com/xmake-io/xmake/issues/2944): 为嵌入式工程添加 `gnu-rm.binary` 和 `gnu-rm.static` 规则和测试工程
* [#2636](https://github.com/xmake-io/xmake/issues/2636): 支持包组件
* 支持 msvc 的 armasm/armasm64
* [#3023](https://github.com/xmake-io/xmake/pull/3023): 改进 xmake run -d,添加 renderdoc 调试器支持
* [#3022](https://github.com/xmake-io/xmake/issues/3022): 为特定编译器添加 flags
* [#3025](https://github.com/xmake-io/xmake/pull/3025): 新增 C++ 异常接口配置
* [#3017](https://github.com/xmake-io/xmake/pull/3017): 支持 ispc 编译器规则
### 改进
* [#2925](https://github.com/xmake-io/xmake/issues/2925): 改进 doxygen 插件
* [#2948](https://github.com/xmake-io/xmake/issues/2948): 支持 OpenBSD
* 添加 `xmake g --insecure-ssl=y` 配置选项去禁用 ssl 证书检测
* [#2971](https://github.com/xmake-io/xmake/pull/2971): 使 vs/vsxmake 工程生成的结果每次保持一致
* [#3000](https://github.com/xmake-io/xmake/issues/3000): 改进 C++ 模块构建支持,实现增量编译支持
* [#3016](https://github.com/xmake-io/xmake/pull/3016): 改进 clang/msvc 去更好地支持 std 模块
### Bugs 修复
* [#2949](https://github.com/xmake-io/xmake/issues/2949): 修复 vs 分组
* [#2952](https://github.com/xmake-io/xmake/issues/2952): 修复 armlink 处理长命令失败问题
* [#2954](https://github.com/xmake-io/xmake/issues/2954): 修复 c++ module partitions 路径无效问题
* [#3033](https://github.com/xmake-io/xmake/issues/3033): 探测循环模块依赖
## v2.7.2
### 新特性
* [#2140](https://github.com/xmake-io/xmake/issues/2140): 支持 Windows Arm64
* [#2719](https://github.com/xmake-io/xmake/issues/2719): 添加 `package.librarydeps.strict_compatibility` 策略严格限制包依赖兼容性
* [#2810](https://github.com/xmake-io/xmake/pull/2810): 支持 os.execv 去执行 shell 脚本文件
* [#2817](https://github.com/xmake-io/xmake/pull/2817): 改进规则支持依赖顺序执行
* [#2824](https://github.com/xmake-io/xmake/pull/2824): 传递 cross-file 交叉编译环境给 meson.install 和 trybuild
* [#2856](https://github.com/xmake-io/xmake/pull/2856): xrepo 支持从当前指定源码目录调试程序
* [#2859](https://github.com/xmake-io/xmake/issues/2859): 改进对三方库的 trybuild 构建,利用 xmake-repo 仓库脚本更加智能化地构建三方库
* [#2879](https://github.com/xmake-io/xmake/issues/2879): 更好的动态创建和配置 target 和 rule
* [#2374](https://github.com/xmake-io/xmake/issues/2374): 允许 xmake 包中引入自定义规则
* 添加 clang-cl 工具链
### 改进
* [#2745](https://github.com/xmake-io/xmake/pull/2745): 改进 os.cp 支持符号链接复制
* [#2773](https://github.com/xmake-io/xmake/pull/2773): 改进 vcpkg 包安装,支持 freebsd 平台
* [#2778](https://github.com/xmake-io/xmake/pull/2778): 改进 xrepo.env 支持 target 的运行环境加载
* [#2783](https://github.com/xmake-io/xmake/issues/2783): 添加摘要算法选项到 WDK 的 signtool 签名工具
* [#2787](https://github.com/xmake-io/xmake/pull/2787): 改进 json 支持空数组
* [#2782](https://github.com/xmake-io/xmake/pull/2782): 改进查找 matlib sdk 和运行时
* [#2793](https://github.com/xmake-io/xmake/issues/2793): 改进 mconfdialog 配置操作体验
* [#2804](https://github.com/xmake-io/xmake/issues/2804): 安装依赖包支持 macOS arm64/x86_64 交叉编译
* [#2809](https://github.com/xmake-io/xmake/issues/2809): 改进 msvc 的编译优化选项
* 改进 trybuild 模式,为 meson/autoconf/cmake 提供更好的交叉编译支持
* [#2846](https://github.com/xmake-io/xmake/discussions/2846): 改进对 configfiles 的生成
* [#2866](https://github.com/xmake-io/xmake/issues/2866): 更好地控制 rule 规则执行顺序
### Bugs 修复
* [#2740](https://github.com/xmake-io/xmake/issues/2740): 修复 msvc 构建 C++ modules 卡死问题
* [#2875](https://github.com/xmake-io/xmake/issues/2875): 修复构建 linux 驱动错误
* [#2885](https://github.com/xmake-io/xmake/issues/2885): 修复 ccache 下,msvc 编译 pch 失败问题
## v2.7.1
### 新特性
* [#2555](https://github.com/xmake-io/xmake/issues/2555): 添加 fwatcher 模块和 `xmake watch` 插件命令
* 添加 `xmake service --pull 'build/**' outputdir` 命令去拉取远程构建服务器上的文件
* [#2641](https://github.com/xmake-io/xmake/pull/2641): 改进 C++20 模块, 支持 headerunits 和 project 生成
* [#2679](https://github.com/xmake-io/xmake/issues/2679): 支持 Mac Catalyst 构建
### 改进
* [#2576](https://github.com/xmake-io/xmake/issues/2576): 改进从 cmake 中查找包,提供更过灵活的可选配置
* [#2577](https://github.com/xmake-io/xmake/issues/2577): 改进 add_headerfiles(),增加 `{install = false}` 支持
* [#2603](https://github.com/xmake-io/xmake/issues/2603): 为 ccache 默认禁用 `-fdirectives-only`
* [#2580](https://github.com/xmake-io/xmake/issues/2580): 设置 stdout 到 line 缓冲输出
* [#2571](https://github.com/xmake-io/xmake/issues/2571): 改进分布式编译的调度算法,增加 cpu/memory 状态权重
* [#2410](https://github.com/xmake-io/xmake/issues/2410): 改进 cmakelists 生成
* [#2690](https://github.com/xmake-io/xmake/issues/2690): 改机传递 toolchains 到包
* [#2686](https://github.com/xmake-io/xmake/issues/2686): 改进 armcc/armclang 支持增量编译
* [#2562](https://github.com/xmake-io/xmake/issues/2562): 改进 rc.exe 对引用文件依赖的解析和增量编译支持
* 改进默认的并行构建任务数
### Bugs 修复
* [#2614](https://github.com/xmake-io/xmake/issues/2614): 为 msvc 修复构建 submodules2 测试工程
* [#2620](https://github.com/xmake-io/xmake/issues/2620): 修复构建缓存导致的增量编译问题
* [#2177](https://github.com/xmake-io/xmake/issues/2177): 修复 python.library 在 macOS 上段错误崩溃
* [#2708](https://github.com/xmake-io/xmake/issues/2708): 修复 mode.coverage 规则的链接错误
* 修复 ios/macOS framework 和 application 的 rpath 加载路径
## v2.6.9
### 新特性
* [#2474](https://github.com/xmake-io/xmake/issues/2474): 添加 icx 和 dpcpp 工具链
* [#2523](https://github.com/xmake-io/xmake/issues/2523): 改进对 LTO 的支持
* [#2527](https://github.com/xmake-io/xmake/issues/2527): 添加 set_runargs 接口
### 改进
* 改进 tools.cmake 支持 wasm 库构建
* [#2491](https://github.com/xmake-io/xmake/issues/2491): 如果服务器不可访问,自动回退到本地编译和缓存
* [#2514](https://github.com/xmake-io/xmake/issues/2514): 为工程生成器禁用 Unity Build
* [#2473](https://github.com/xmake-io/xmake/issues/2473): 改进 apt::find_package,支持从 pc 文件中查找
* [#2512](https://github.com/xmake-io/xmake/issues/2512): 改进远程服务支持超时配置
### Bugs 修复
* [#2488](https://github.com/xmake-io/xmake/issues/2488): 修复从 windows 到 linux 的远程编译路径问题
* [#2504](https://github.com/xmake-io/xmake/issues/2504): 修复在 msys2 上远程编译失败问题
* [#2525](https://github.com/xmake-io/xmake/issues/2525): 修复安装依赖包时候卡死问题
* [#2557](https://github.com/xmake-io/xmake/issues/2557): 修复 cmake.find_package 查找 links 错误
* 修复缓存导致的预处理文件路径冲突问题
## v2.6.8
### 新特性
* [#2447](https://github.com/xmake-io/xmake/pull/2447): 添加 qt.qmlplugin 规则和 qmltypesregistrar 支持
* [#2446](https://github.com/xmake-io/xmake/issues/2446): 支持 target 分组安装
* [#2469](https://github.com/xmake-io/xmake/issues/2469): 产生 vcpkg-configuration.json
### 改进
* 添加 `preprocessor.linemarkers` 策略去禁用 linemarkers 去加速 ccache/distcc
* [#2389](https://github.com/xmake-io/xmake/issues/2389): 改进 `xmake run` 支持并行运行目标程序
* [#2417](https://github.com/xmake-io/xmake/issues/2417): 切换 option/showmenu 的默认值,默认开启
* [#2440](https://github.com/xmake-io/xmake/pull/2440): 改进安装包的失败错误信息
* [#2438](https://github.com/xmake-io/xmake/pull/2438): 确保生成的 vsxmake 工程不会随机变动
* [#2434](https://github.com/xmake-io/xmake/issues/2434): 改进插件管理器,允许多插件管理
* [#2421](https://github.com/xmake-io/xmake/issues/2421): 改进配置选项菜单
* [#2425](https://github.com/xmake-io/xmake/issues/2425): 添加 `preprocessor.gcc.directives_only` 策略
* [#2455](https://github.com/xmake-io/xmake/issues/2455): 改进 emcc 的优化选项
* [#2467](https://github.com/xmake-io/xmake/issues/2467): 支持回退到原始文件编译,兼容 msvc 预处理器的一些问题
* [#2452](https://github.com/xmake-io/xmake/issues/2452): 添加 build.warning 策略
### Bugs 修复
* [#2435](https://github.com/xmake-io/xmake/pull/2435): 修复无法搜索带有 `.` 的包名
* [#2445](https://github.com/xmake-io/xmake/issues/2445): 修复 windows 上 ccache 构建失败问题
* [#2452](https://github.com/xmake-io/xmake/issues/2452): 修复 ccache 下,警告无法输出的问题
## v2.6.7
### 新特性
* [#2318](https://github.com/xmake-io/xmake/issues/2318): 添加 `xmake f --policies=` 配置参数去修改默认策略
### 改进
* 如果预编译包构建失败,自动回退到源码包构建
* [#2387](https://github.com/xmake-io/xmake/issues/2387): 改进 pkgconfig 和 find_package
* 添加 `build.ccache` 策略,用于在工程中配置编译缓存
### Bugs 修复
* [#2382](https://github.com/xmake-io/xmake/issues/2382): 修改 headeronly 包配置
* [#2388](https://github.com/xmake-io/xmake/issues/2388): 修复路径问题
* [#2385](https://github.com/xmake-io/xmake/issues/2385): 修复 cmake/find_package
* [#2395](https://github.com/xmake-io/xmake/issues/2395): 修复 c++ modules
* 修复 find_qt 问题
## v2.6.6
### 新特性
* [#2327](https://github.com/xmake-io/xmake/issues/2327): 支持 nvidia-hpc-sdk 工具链中的 nvc/nvc++/nvfortran 编译器
* 添加 path 实例接口
* [#2344](https://github.com/xmake-io/xmake/pull/2344): 添加 lz4 压缩模块
* [#2349](https://github.com/xmake-io/xmake/pull/2349): 添加 keil/c51 工程支持
* [#274](https://github.com/xmake-io/xmake/issues/274): 跨平台分布式编译支持
* 使用内置的本地缓存替代 ccache
### 改进
* [#2309](https://github.com/xmake-io/xmake/issues/2309): 远程编译支持用户授权验证
* 改进远程编译,增加对 lz4 压缩支持
### Bugs 修复
* 修复选择包版本时候 lua 栈不平衡导致的崩溃问题
## v2.6.5
### 新特性
* [#2138](https://github.com/xmake-io/xmake/issues/2138): 支持模板包
* [#2185](https://github.com/xmake-io/xmake/issues/2185): 添加 `--appledev=simulator` 去改进 Apple 模拟器目标编译支持
* [#2227](https://github.com/xmake-io/xmake/issues/2227): 改进 cargo 包,支持指定 Cargo.toml 文件
* 改进 `add_requires` 支持 git command 作为版本
* [#622](https://github.com/xmake-io/xmake/issues/622): 支持远程编译
* [#2282](https://github.com/xmake-io/xmake/issues/2282): 添加 `add_filegroups` 接口为 vs/vsxmake/cmake generator 增加文件组支持
### 改进
* [#2137](https://github.com/xmake-io/xmake/pull/2137): 改进 path 模块
* macOS 下,减少 50% 的 Xmake 二进制文件大小
* 改进 tools/autoconf,cmake 去更好地支持工具链切换
* [#2221](https://github.com/xmake-io/xmake/pull/2221): 改进注册表 api 去支持 unicode
* [#2225](https://github.com/xmake-io/xmake/issues/2225): 增加对 protobuf 的依赖分析和构建支持
* [#2265](https://github.com/xmake-io/xmake/issues/2265): 排序 CMakeLists.txt
* 改进 os.files 的文件遍历速度
### Bugs 修复
* [#2233](https://github.com/xmake-io/xmake/issues/2233): 修复 c++ modules 依赖
## v2.6.4
### 新特性
* [#2011](https://github.com/xmake-io/xmake/issues/2011): 支持继承和局部修改官方包,例如对现有的包更换 urls 和 versions
* 支持在 sparc, alpha, powerpc, s390x 和 sh4 上编译运行 xmake
* 为 package() 添加 on_download 自定义下载
* [#2021](https://github.com/xmake-io/xmake/issues/2021): 支持 Linux/Windows 下构建 Swift 程序
* [#2024](https://github.com/xmake-io/xmake/issues/2024): 添加 asn1c 支持
* [#2031](https://github.com/xmake-io/xmake/issues/2031): 为 add_files 增加 linker scripts 和 version scripts 支持
* [#2033](https://github.com/xmake-io/xmake/issues/2033): 捕获 ctrl-c 去打印当前运行栈,用于调试分析卡死问题
* [#2059](https://github.com/xmake-io/xmake/pull/2059): 添加 `xmake update --integrate` 命令去整合 shell
* [#2070](https://github.com/xmake-io/xmake/issues/2070): 添加一些内置的 xrepo env 环境配置
* [#2117](https://github.com/xmake-io/xmake/pull/2117): 支持为任意平台传递工具链到包
* [#2121](https://github.com/xmake-io/xmake/issues/2121): 支持导出指定的符号列表,可用于减少动态库的大小
### 改进
* [#2036](https://github.com/xmake-io/xmake/issues/2036): 改进 xrepo 支持从配置文件批量安装包,例如:`xrepo install xxx.lua`
* [#2039](https://github.com/xmake-io/xmake/issues/2039): 改进 vs generator 的 filter 目录展示
* [#2025](https://github.com/xmake-io/xmake/issues/2025): 支持为 phony 和 headeronly 目标生成 vs 工程
* 优化 vs 和 codesign 的探测速度
* [#2077](https://github.com/xmake-io/xmake/issues/2077): 改进 vs 工程生成器去支持 cuda
### Bugs 修复
* [#2005](https://github.com/xmake-io/xmake/issues/2005): 修复 path.extension
* [#2008](https://github.com/xmake-io/xmake/issues/2008): 修复 windows manifest 文件编译
* [#2016](https://github.com/xmake-io/xmake/issues/2016): 修复 vs project generator 里,对象文件名冲突导致的编译失败
## v2.6.3
### 新特性
* [#1298](https://github.com/xmake-io/xmake/issues/1928): 支持 vcpkg 清单模式安装包,实现安装包的版本选择
* [#1896](https://github.com/xmake-io/xmake/issues/1896): 添加 `python.library` 规则去构建 pybind 模块,并且支持 soabi
* [#1939](https://github.com/xmake-io/xmake/issues/1939): 添加 `remove_files`, `remove_headerfiles` 并且标记 `del_files` 作为废弃接口
* 将 on_config 作为正式的公开接口,用于 target 和 rule
* 添加 riscv32/64 支持
* [#1970](https://github.com/xmake-io/xmake/issues/1970): 添加 CMake wrapper 支持在 CMakelists 中去调用 xrepo 集成 C/C++ 包
* 添加内置的 github 镜像加速 pac 代理文件, `xmake g --proxy_pac=github_mirror.lua`
### 改进
* [#1923](https://github.com/xmake-io/xmake/issues/1923): 改进构建 linux 驱动,支持设置自定义 linux-headers 路径
* [#1962](https://github.com/xmake-io/xmake/issues/1962): 改进 armclang 工具链去支持构建 asm
* [#1959](https://github.com/xmake-io/xmake/pull/1959): 改进 vstudio 工程生成器
* [#1969](https://github.com/xmake-io/xmake/issues/1969): 添加默认的 option 描述
### Bugs 修复
* [#1875](https://github.com/xmake-io/xmake/issues/1875): 修复部署生成 Android Qt 程序包失败问题
* [#1973](https://github.com/xmake-io/xmake/issues/1973): 修复合并静态库
* [#1982](https://github.com/xmake-io/xmake/pull/1982): 修复 clang 下对 c++20 子模块的依赖构建
## v2.6.2
### 新特性
* [#1902](https://github.com/xmake-io/xmake/issues/1902): 支持构建 linux 内核驱动模块
* [#1913](https://github.com/xmake-io/xmake/issues/1913): 通过 group 模式匹配,指定构建和运行一批目标程序
### 改进
* [#1872](https://github.com/xmake-io/xmake/issues/1872): 支持转义 set_configvar 中字符串值
* [#1888](https://github.com/xmake-io/xmake/issues/1888): 改进 windows 安装器,避免错误删除其他安装目录下的文件
* [#1895](https://github.com/xmake-io/xmake/issues/1895): 改进 `plugin.vsxmake.autoupdate` 规则
* [#1893](https://github.com/xmake-io/xmake/issues/1893): 改进探测 icc 和 ifort 工具链
* [#1905](https://github.com/xmake-io/xmake/pull/1905): 改进 msvc 对 external 头文件搜索探测支持
* [#1904](https://github.com/xmake-io/xmake/pull/1904): 改进 vs201x 工程生成器
* 添加 `XMAKE_THEME` 环境变量去切换主题配置
* [#1907](https://github.com/xmake-io/xmake/issues/1907): 添加 `-f/--force` 参数使得 `xmake create` 可以在费控目录被强制创建
* [#1917](https://github.com/xmake-io/xmake/pull/1917): 改进 find_package 和配置
### Bugs 修复
* [#1885](https://github.com/xmake-io/xmake/issues/1885): 修复 package:fetch_linkdeps 链接顺序问题
* [#1903](https://github.com/xmake-io/xmake/issues/1903): 修复包链接顺序
## v2.6.1
### 新特性
* [#1799](https://github.com/xmake-io/xmake/issues/1799): 支持混合 Rust 和 C++ 程序,以及集成 Cargo 依赖库
* 添加 `utils.glsl2spv` 规则去编译 *.vert/*.frag shader 文件生成 spirv 文件和二进制 C 头文件
### 改进
* 默认切换到 Lua5.4 运行时
* [#1776](https://github.com/xmake-io/xmake/issues/1776): 改进 system::find_package,支持从环境变量中查找系统库
* [#1786](https://github.com/xmake-io/xmake/issues/1786): 改进 apt:find_package,支持查找 alias 包
* [#1819](https://github.com/xmake-io/xmake/issues/1819): 添加预编译头到 cmake 生成器
* 改进 C++20 Modules 为 msvc 支持 std 标准库
* [#1792](https://github.com/xmake-io/xmake/issues/1792): 添加自定义命令到 vs 工程生成器
* [#1835](https://github.com/xmake-io/xmake/issues/1835): 改进 MDK 程序构建支持,增加 `set_runtimes("microlib")`
* [#1858](https://github.com/xmake-io/xmake/issues/1858): 改进构建 c++20 modules,修复跨 target 构建问题
* 添加 $XMAKE_BINARY_REPO 和 $XMAKE_MAIN_REPO 仓库设置环境变量
* [#1865](https://github.com/xmake-io/xmake/issues/1865): 改进 openmp 工程
* [#1845](https://github.com/xmake-io/xmake/issues/1845): 为静态库安装 pdb 文件
### Bugs 修复
* 修复语义版本中解析带有 0 前缀的 build 字符串问题
* [#50](https://github.com/libbpf/libbpf-bootstrap/issues/50): 修复 rule 和构建 bpf 程序 bug
* [#1610](https://github.com/xmake-io/xmake/issues/1610): 修复 `xmake f --menu` 在 vscode 终端下按键无响应,并且支持 ConPTY 终端虚拟按键
## v2.5.9
### 新特性
* [#1736](https://github.com/xmake-io/xmake/issues/1736): 支持 wasi-sdk 工具链
* 支持 Lua 5.4 运行时
* 添加 gcc-8, gcc-9, gcc-10, gcc-11 工具链
* [#1623](https://github.com/xmake-io/xmake/issues/1632): 支持 find_package 从 cmake 查找包
* [#1747](https://github.com/xmake-io/xmake/issues/1747): 添加 `set_kind("headeronly")` 更好的处理 headeronly 库的安装
* [#1019](https://github.com/xmake-io/xmake/issues/1019): 支持 Unity build
* [#1438](https://github.com/xmake-io/xmake/issues/1438): 增加 `xmake l cli.amalgamate` 命令支持代码合并
* [#1765](https://github.com/xmake-io/xmake/issues/1756): 支持 nim 语言
* [#1762](https://github.com/xmake-io/xmake/issues/1762): 为 `xrepo env` 管理和切换指定的环境配置
* [#1767](https://github.com/xmake-io/xmake/issues/1767): 支持 Circle 编译器
* [#1753](https://github.com/xmake-io/xmake/issues/1753): 支持 Keil/MDK 的 armcc/armclang 工具链
* [#1774](https://github.com/xmake-io/xmake/issues/1774): 添加 table.contains api
* [#1735](https://github.com/xmake-io/xmake/issues/1735): 添加自定义命令到 cmake 生成器
* [#1781](https://github.com/xmake-io/xmake/issues/1781): 改进 get.sh 安装脚本支持 nixos
### 改进
* [#1528](https://github.com/xmake-io/xmake/issues/1528): 检测 c++17/20 特性
* [#1729](https://github.com/xmake-io/xmake/issues/1729): 改进 C++20 modules 对 clang/gcc/msvc 的支持,支持模块间依赖编译和并行优化
* [#1779](https://github.com/xmake-io/xmake/issues/1779): 改进 ml.exe/x86,移除内置的 `-Gd` 选项
## v2.5.8
### 新特性
* [#388](https://github.com/xmake-io/xmake/issues/388): Pascal 语言支持,可以使用 fpc 来编译 free pascal
* [#1682](https://github.com/xmake-io/xmake/issues/1682): 添加可选的额lua5.3 运行时替代 luajit,提供更好的平台兼容性。
* [#1622](https://github.com/xmake-io/xmake/issues/1622): 支持 Swig
* [#1714](https://github.com/xmake-io/xmake/issues/1714): 支持内置 cmake 等第三方项目的混合编译
* [#1715](https://github.com/xmake-io/xmake/issues/1715): 支持探测编译器语言标准特性,并且新增 `check_macros` 检测接口
* xmake 支持在 Loongarch 架构上运行
### 改进
* [#1618](https://github.com/xmake-io/xmake/issues/1618): 改进 vala 支持构建动态库和静态库程序
* 改进 Qt 规则去支持 Qt 4.x
* 改进 `set_symbols("debug")` 支持 clang/windows 生成 pdb 文件
* [#1638](https://github.com/xmake-io/xmake/issues/1638): 改进合并静态库
* 改进 on_load/after_load 去支持动态的添加 target deps
* [#1675](https://github.com/xmake-io/xmake/pull/1675): 针对 mingw 平台,重命名动态库和导入库文件名后缀
* [#1694](https://github.com/xmake-io/xmake/issues/1694): 支持在 set_configvar 中定义一个不带引号的字符串变量
* 改进对 Android NDK r23 的支持
* 为 `set_languages` 新增 `c++latest` 和 `clatest` 配置值
* [#1720](https://github.com/xmake-io/xmake/issues/1720): 添加 `save_scope` 和 `restore_scope` 去修复 `check_xxx` 相关接口
* [#1726](https://github.com/xmake-io/xmake/issues/1726): 改进 compile_commands 生成器去支持 nvcc
### Bugs 修复
* [#1671](https://github.com/xmake-io/xmake/issues/1671): 修复安装预编译包后,*.cmake 里面的一些不正确的绝对路径
* [#1689](https://github.com/xmake-io/xmake/issues/1689): 修复 vsxmake 插件的 unicode 字符显示和加载问题
## v2.5.7
### 新特性
* [#1534](https://github.com/xmake-io/xmake/issues/1534): 新增对 Vala 语言的支持
* [#1544](https://github.com/xmake-io/xmake/issues/1544): 添加 utils.bin2c 规则去自动从二进制资源文件产生 .h 头文件并引入到 C/C++ 代码中
* [#1547](https://github.com/xmake-io/xmake/issues/1547): option/snippets 支持运行检测模式,并且可以获取输出
* [#1567](https://github.com/xmake-io/xmake/issues/1567): 新增 xmake-requires.lock 包依赖锁定支持
* [#1597](https://github.com/xmake-io/xmake/issues/1597): 支持编译 metal 文件到 metallib,并改进 xcode.application 规则去生成内置的 default.metallib 到 app
### 改进
* [#1540](https://github.com/xmake-io/xmake/issues/1540): 更好更方便地编译自动生成的代码
* [#1578](https://github.com/xmake-io/xmake/issues/1578): 改进 add_repositories 去更好地支持相对路径
* [#1582](https://github.com/xmake-io/xmake/issues/1582): 改进安装和 os.cp 支持符号链接
### Bugs 修复
* [#1531](https://github.com/xmake-io/xmake/issues/1531): 修复 targets 加载失败的错误信息提示错误
## v2.5.6
### 新特性
* [#1483](https://github.com/xmake-io/xmake/issues/1483): 添加 `os.joinenvs()` 和改进包工具环境
* [#1523](https://github.com/xmake-io/xmake/issues/1523): 添加 `set_allowedmodes`, `set_allowedplats` 和 `set_allowedarchs`
* [#1523](https://github.com/xmake-io/xmake/issues/1523): 添加 `set_defaultmode`, `set_defaultplat` 和 `set_defaultarch`
### 改进
* 改进 vs/vsxmake 工程插件支持 vs2022
* [#1513](https://github.com/xmake-io/xmake/issues/1513): 改进 windows 预编译包的兼容性问题
* 改进 vcpkg 包在 windows 上的查找
* 改进对 Qt6 的支持
### Bugs 修复
* [#489](https://github.com/xmake-io/xmake-repo/pull/489): 修复 run os.execv 带有过长环境变量值出现的一些问题
## v2.5.5
### 新特性
* [#1421](https://github.com/xmake-io/xmake/issues/1421): 针对 target 目标,增加目标文件名的前缀,后缀和扩展名设置接口。
* [#1422](https://github.com/xmake-io/xmake/issues/1422): 支持从 vcpkg, conan 中搜索包
* [#1424](https://github.com/xmake-io/xmake/issues/1424): 设置 binary 作为默认的 target 目标类型
* [#1140](https://github.com/xmake-io/xmake/issues/1140): 支持安装时候,手动选择从第三包包管理器安装包
* [#1339](https://github.com/xmake-io/xmake/issues/1339): 改进 `xmake package` 去产生新的本地包格式,无缝集成 `add_requires`,并且新增生成远程包支持
* 添加 `appletvos` 编译平台支持, `xmake f -p appletvos`
* [#1437](https://github.com/xmake-io/xmake/issues/1437): 为包添加 headeronly 库类型去忽略 `vs_runtime`
* [#1351](https://github.com/xmake-io/xmake/issues/1351): 支持导入导出当前配置
* [#1454](https://github.com/xmake-io/xmake/issues/1454): 支持下载安装 windows 预编译包
### 改进
* [#1425](https://github.com/xmake-io/xmake/issues/1425): 改进 tools/meson 去加载 msvc 环境,并且增加一些内置配置。
* [#1442](https://github.com/xmake-io/xmake/issues/1442): 支持从 git url 去下载包资源文件
* [#1389](https://github.com/xmake-io/xmake/issues/1389): 支持添加工具链环境到 `xrepo env`
* [#1453](https://github.com/xmake-io/xmake/issues/1453): 支持 protobuf 规则导出头文件搜索目录
* 新增对 vs2022 的支持
### Bugs 修复
* [#1413](https://github.com/xmake-io/xmake/issues/1413): 修复查找包过程中出现的挂起卡死问题
* [#1420](https://github.com/xmake-io/xmake/issues/1420): 修复包检测和配置缓存
* [#1445](https://github.com/xmake-io/xmake/issues/1445): 修复 WDK 驱动签名错误
* [#1465](https://github.com/xmake-io/xmake/issues/1465): 修复缺失的链接目录
## v2.5.4
### 新特性
* [#1323](https://github.com/xmake-io/xmake/issues/1323): 支持从 apt 查找安装包,`add_requires("apt::zlib1g-dev")`
* [#1337](https://github.com/xmake-io/xmake/issues/1337): 添加环境变量去改进包安装和缓存目录
* [#1338](https://github.com/xmake-io/xmake/issues/1338): 支持导入导出已安装的包
* [#1087](https://github.com/xmake-io/xmake/issues/1087): 添加 `xrepo env shell` 并且支持从 `add_requires/xmake.lua` 加载包环境
* [#1313](https://github.com/xmake-io/xmake/issues/1313): 为 `add_requires/add_deps` 添加私有包支持
* [#1358](https://github.com/xmake-io/xmake/issues/1358): 支持设置镜像 url 站点加速包下载
* [#1369](https://github.com/xmake-io/xmake/pull/1369): 为 vcpkg 增加 arm/arm64 包集成支持,感谢 @fallending
* [#1405](https://github.com/xmake-io/xmake/pull/1405): 添加 portage 包管理器支持,感谢 @Phate6660
### 改进
* 改进 `find_package` 并且添加 `package:find_package` 接口在包定义中方便查找包
* 移除废弃的 `set_config_h` 和 `set_config_h_prefix` 接口
* [#1343](https://github.com/xmake-io/xmake/issues/1343): 改进搜索本地包文件
* [#1347](https://github.com/xmake-io/xmake/issues/1347): 针对 binary 包改进 vs_runtime 配置
* [#1353](https://github.com/xmake-io/xmake/issues/1353): 改进 del_files() 去加速匹配文件
* [#1349](https://github.com/xmake-io/xmake/issues/1349): 改进 xrepo env shell 支持,更好的支持 powershell
### Bugs 修复
* [#1380](https://github.com/xmake-io/xmake/issues/1380): 修复 `add_packages()` 失败问题
* [#1381](https://github.com/xmake-io/xmake/issues/1381): 修复添加本地 git 包源问题
* [#1391](https://github.com/xmake-io/xmake/issues/1391): 修复 cuda/nvcc 工具链
## v2.5.3
### 新特性
* [#1259](https://github.com/xmake-io/xmake/issues/1259): 支持 `add_files("*.def")` 添加 def 文件去导出 windows/dll 符号
* [#1267](https://github.com/xmake-io/xmake/issues/1267): 添加 `find_package("nvtx")`
* [#1274](https://github.com/xmake-io/xmake/issues/1274): 添加 `platform.linux.bpf` 规则去构建 linux/bpf 程序
* [#1280](https://github.com/xmake-io/xmake/issues/1280): 支持 fetchonly 包去扩展改进 find_package
* 支持自动拉取远程 ndk 工具链包和集成
* [#1268](https://github.com/xmake-io/xmake/issues/1268): 添加 `utils.install.pkgconfig_importfiles` 规则去安装 `*.pc` 文件
* [#1268](https://github.com/xmake-io/xmake/issues/1268): 添加 `utils.install.cmake_importfiles` 规则去安装 `*.cmake` 导入文件
* [#348](https://github.com/xmake-io/xmake-repo/pull/348): 添加 `platform.longpaths` 策略去支持 git longpaths
* [#1314](https://github.com/xmake-io/xmake/issues/1314): 支持安装使用 conda 包
* [#1120](https://github.com/xmake-io/xmake/issues/1120): 添加 `core.base.cpu` 模块并且改进 `os.cpuinfo()`
* [#1325](https://github.com/xmake-io/xmake/issues/1325): 为 `add_configfiles` 添加内建的 git 变量
### 改进
* [#1275](https://github.com/xmake-io/xmake/issues/1275): 改进 vsxmake 生成器,支持条件化编译 targets
* [#1290](https://github.com/xmake-io/xmake/pull/1290): 增加对 Android ndk r22 以上版本支持
* [#1311](https://github.com/xmake-io/xmake/issues/1311): 为 vsxmake 工程添加包 dll 路径,确保调试运行加载正常
### Bugs 修复
* [#1266](https://github.com/xmake-io/xmake/issues/1266): 修复在 `add_repositories` 中的 repo 相对路径
* [#1288](https://github.com/xmake-io/xmake/issues/1288): 修复 vsxmake 插件处理 option 配置问题
## v2.5.2
### 新特性
* [#955](https://github.com/xmake-io/xmake/issues/955#issuecomment-766481512): 支持 `zig cc` 和 `zig c++` 作为 c/c++ 编译器
* [#955](https://github.com/xmake-io/xmake/issues/955#issuecomment-768193083): 支持使用 zig 进行交叉编译
* [#1177](https://github.com/xmake-io/xmake/issues/1177): 改进终端和 color codes 探测
* [#1216](https://github.com/xmake-io/xmake/issues/1216): 传递自定义 includes 脚本给 xrepo
* 添加 linuxos 内置模块获取 linux 系统信息
* [#1217](https://github.com/xmake-io/xmake/issues/1217): 支持当编译项目时自动拉取工具链
* [#1123](https://github.com/xmake-io/xmake/issues/1123): 添加 `rule("utils.symbols.export_all")` 自动导出所有 windows/dll 中的符号
* [#1181](https://github.com/xmake-io/xmake/issues/1181): 添加 `utils.platform.gnu2mslib(mslib, gnulib)` 模块接口去转换 mingw/xxx.dll.a 到 msvc xxx.lib
* [#1246](https://github.com/xmake-io/xmake/issues/1246): 改进规则支持新的批处理命令去简化自定义规则实现
* [#1239](https://github.com/xmake-io/xmake/issues/1239): 添加 `add_extsources` 去改进外部包的查找
* [#1241](https://github.com/xmake-io/xmake/issues/1241): 支持为 windows 程序添加 .manifest 文件参与链接
* 支持使用 `xrepo remove --all` 命令去移除所有的包,并且支持模式匹配
* [#1254](https://github.com/xmake-io/xmake/issues/1254): 支持导出包配置给父 target,实现包配置的依赖继承
### 改进
* [#1226](https://github.com/xmake-io/xmake/issues/1226): 添加缺失的 Qt 头文件搜索路径
* [#1183](https://github.com/xmake-io/xmake/issues/1183): 改进 C++ 语言标准,以便支持 Qt6
* [#1237](https://github.com/xmake-io/xmake/issues/1237): 为 vsxmake 插件添加 qt.ui 文件
* 改进 vs/vsxmake 插件去支持预编译头文件和智能提示
* [#1090](https://github.com/xmake-io/xmake/issues/1090): 简化自定义规则
* [#1065](https://github.com/xmake-io/xmake/issues/1065): 改进 protobuf 规则,支持 compile_commands 生成器
* [#1249](https://github.com/xmake-io/xmake/issues/1249): 改进 vs/vsxmake 生成器去支持启动工程设置
* [#605](https://github.com/xmake-io/xmake/issues/605): 改进 add_deps 和 add_packages 直接的导出 links 顺序
* 移除废弃的 `add_defines_h_if_ok` and `add_defines_h` 接口
### Bugs 修复
* [#1219](https://github.com/xmake-io/xmake/issues/1219): 修复版本检测和更新
* [#1235](https://github.com/xmake-io/xmake/issues/1235): 修复 includes 搜索路径中带有空格编译不过问题
## v2.5.1
### 新特性
* [#1035](https://github.com/xmake-io/xmake/issues/1035): 图形配置菜单完整支持鼠标事件,并且新增滚动栏
* [#1098](https://github.com/xmake-io/xmake/issues/1098): 支持传递 stdin 到 os.execv 进行输入重定向
* [#1079](https://github.com/xmake-io/xmake/issues/1079): 为 vsxmake 插件添加工程自动更新插件,`add_rules("plugin.vsxmake.autoupdate")`
* 添加 `xmake f --vs_runtime=MT` 和 `set_runtimes("MT")` 去更方便的对 target 和 package 进行设置
* [#1032](https://github.com/xmake-io/xmake/issues/1032): 支持枚举注册表 keys 和 values
* [#1026](https://github.com/xmake-io/xmake/issues/1026): 支持对 vs/vsmake 工程增加分组设置
* [#1178](https://github.com/xmake-io/xmake/issues/1178): 添加 `add_requireconfs()` 接口去重写依赖包的配置
* [#1043](https://github.com/xmake-io/xmake/issues/1043): 为 luarocks 模块添加 `luarocks.module` 构建规则
* [#1190](https://github.com/xmake-io/xmake/issues/1190): 添加对 Apple Silicon (macOS ARM) 设备的支持
* [#1145](https://github.com/xmake-io/xmake/pull/1145): 支持在 windows 上安装部署 Qt 程序, 感谢 @SirLynix
### 改进
* [#1072](https://github.com/xmake-io/xmake/issues/1072): 修复并改进 cl 编译器头文件依赖信息
* 针对 ui 模块和 `xmake f --menu` 增加 utf8 支持
* 改进 zig 语言在 macOS 上的支持
* [#1135](https://github.com/xmake-io/xmake/issues/1135): 针对特定 target 改进多平台多工具链同时配置支持
* [#1153](https://github.com/xmake-io/xmake/issues/1153): 改进 llvm 工具链,针对 macos 上编译增加 isysroot 支持
* [#1071](https://github.com/xmake-io/xmake/issues/1071): 改进 vs/vsxmake 生成插件去支持远程依赖包
* 改进 vs/vsxmake 工程生成插件去支持全局的 `set_arch()` 设置
* [#1164](https://github.com/xmake-io/xmake/issues/1164): 改进 vsxmake 插件调试加载 console 程序
* [#1179](https://github.com/xmake-io/xmake/issues/1179): 改进 llvm 工具链,添加 isysroot
### Bugs 修复
* [#1091](https://github.com/xmake-io/xmake/issues/1091): 修复不正确的继承链接依赖
* [#1105](https://github.com/xmake-io/xmake/issues/1105): 修复 vsxmake 插件 c++ 语言标准智能提示错误
* [#1132](https://github.com/xmake-io/xmake/issues/1132): 修复 vsxmake 插件中配置路径被截断问题
* [#1142](https://github.com/xmake-io/xmake/issues/1142): 修复安装包的时候,出现git找不到问题
* 修复在 macOS Big Sur 上 macos.version 问题
* [#1084](https://github.com/xmake-io/xmake/issues/1084): 修复 `add_defines()` 中带有双引号和空格导致无法正确处理宏定义的问题
* [#1195](https://github.com/xmake-io/xmake/pull/1195): 修复 unicode 编码问题,改进 vs 环境查找和进程执行
## v2.3.9
### 新特性
* 添加新的 [xrepo](https://github.com/xmake-io/xrepo) 命令去管理安装 C/C++ 包
* 支持安装交叉编译的依赖包
* 新增musl.cc上的工具链支持
* [#1009](https://github.com/xmake-io/xmake/issues/1009): 支持忽略校验去安装任意版本的包,`add_requires("libcurl 7.73.0", {verify = false})`
* [#1016](https://github.com/xmake-io/xmake/issues/1016): 针对依赖包增加license兼容性检测
* [#1017](https://github.com/xmake-io/xmake/issues/1017): 支持外部/系统头文件支持 `add_sysincludedirs`,依赖包默认使用`-isystem`
* [#1020](https://github.com/xmake-io/xmake/issues/1020): 支持在 archlinux 和 msys2 上查找安装 pacman 包
* 改进 `xmake f --menu` 菜单配置,支持鼠标操作
### 改进
* [#997](https://github.com/xmake-io/xmake/issues/997): `xmake project -k cmake` 插件增加对 `set_languages` 的支持
* [#998](https://github.com/xmake-io/xmake/issues/998): 支持安装 windows-static-md 类型的 vcpkg 包
* [#996](https://github.com/xmake-io/xmake/issues/996): 改进 vcpkg 目录查找
* [#1008](https://github.com/xmake-io/xmake/issues/1008): 改进交叉编译工具链
* [#1030](https://github.com/xmake-io/xmake/issues/1030): 改进 xcode.framework and xcode.application 规则
* [#1051](https://github.com/xmake-io/xmake/issues/1051): 为 msvc 编译器添加 `edit` 和 `embed` 调试信息格式类型到 `set_symbols()`
* [#1062](https://github.com/xmake-io/xmake/issues/1062): 改进 `xmake project -k vs` 插件
## v2.3.8
### 新特性
* [#955](https://github.com/xmake-io/xmake/issues/955): 添加 Zig 空工程模板
* [#956](https://github.com/xmake-io/xmake/issues/956): 添加 Wasm 编译平台,并且支持 Qt/Wasm SDK
* 升级luajit到v2.1最新分支版本,并且支持mips64上运行xmake
* [#972](https://github.com/xmake-io/xmake/issues/972): 添加`depend.on_changed()`去简化依赖文件的处理
* [#981](https://github.com/xmake-io/xmake/issues/981): 添加`set_fpmodels()`去抽象化设置math/float-point编译优化模式
* [#980](https://github.com/xmake-io/xmake/issues/980): 添加对 Intel C/C++ 和 Fortran 编译器的全平台支持
* [#986](https://github.com/xmake-io/xmake/issues/986): 对16.8以上msvc编译器增加 `c11`/`c17` 支持
* [#979](https://github.com/xmake-io/xmake/issues/979): 添加对OpenMP的跨平台抽象配置。`add_rules("c++.openmp")`
### 改进
* [#958](https://github.com/xmake-io/xmake/issues/958): 改进mingw平台,增加对 llvm-mingw 工具链的支持,以及 arm64/arm 架构的支持
* 增加 `add_requires("zlib~xxx")` 模式使得能够支持同时安装带有多种配置的同一个包,作为独立包存在
* [#977](https://github.com/xmake-io/xmake/issues/977): 改进 find_mingw 在 windows 上的探测
* [#978](https://github.com/xmake-io/xmake/issues/978): 改进工具链的flags顺序
* 改进XCode工具链,支持macOS/arm64
### Bugs 修复
* [#951](https://github.com/xmake-io/xmake/issues/951): 修复 emcc (WebAssembly) 工具链在windows上的支持
* [#992](https://github.com/xmake-io/xmake/issues/992): 修复文件锁偶尔打开失败问题
## v2.3.7
### 新特性
* [#2941](https://github.com/microsoft/winget-pkgs/pull/2941): 支持通过 winget 来安装 xmake
* 添加 xmake-tinyc 安装包,内置tinyc编译器,支持windows上无msvc环境也可直接编译c代码
* 添加 tinyc 编译工具链
* 添加 emcc (emscripten) 编译工具链去编译 asm.js 和 WebAssembly
* [#947](https://github.com/xmake-io/xmake/issues/947): 通过 `xmake g --network=private` 配置设置私有网络模式,避免远程依赖包下载访问外网导致编译失败
### 改进
* [#907](https://github.com/xmake-io/xmake/issues/907): 改进msvc的链接器优化选项,生成更小的可执行程序
* 改进ubuntu下Qt环境的支持
* [#918](https://github.com/xmake-io/xmake/pull/918): 改进cuda11工具链的支持
* 改进Qt支持,对通过 ubuntu/apt 安装的Qt sdk也进行了探测支持,并且检测效率也优化了下
* 改进 CMake 工程文件生成器
* [#931](https://github.com/xmake-io/xmake/issues/931): 改进导出包,支持导出所有依赖包
* [#930](https://github.com/xmake-io/xmake/issues/930): 如果私有包定义没有版本定义,支持直接尝试下载包
* [#927](https://github.com/xmake-io/xmake/issues/927): 改进android ndk,支持arm/thumb指令模式切换
* 改进 trybuild/cmake 支持 Android/Mingw/iPhoneOS/WatchOS 工具链
### Bugs 修复
* [#903](https://github.com/xmake-io/xmake/issues/903): 修复vcpkg包安装失败问题
* [#912](https://github.com/xmake-io/xmake/issues/912): 修复自定义工具链
* [#914](https://github.com/xmake-io/xmake/issues/914): 修复部分aarch64设备上运行lua出现bad light userdata pointer问题
## v2.3.6
### 新特性
* 添加xcode工程生成器插件,`xmake project -k cmake` (当前采用cmake生成)
* [#870](https://github.com/xmake-io/xmake/issues/870): 支持gfortran编译器
* [#887](https://github.com/xmake-io/xmake/pull/887): 支持zig编译器
* [#893](https://github.com/xmake-io/xmake/issues/893): 添加json模块
* [#898](https://github.com/xmake-io/xmake/issues/898): 改进golang项目构建,支持交叉编译
* [#275](https://github.com/xmake-io/xmake/issues/275): 支持go包管理器去集成第三方go依赖包
* [#581](https://github.com/xmake-io/xmake/issues/581): 支持dub包管理器去集成第三方dlang依赖包
### 改进
* [#868](https://github.com/xmake-io/xmake/issues/868): 支持新的cl.exe的头文件依赖输出文件格式,`/sourceDependencies xxx.json`
* [#902](https://github.com/xmake-io/xmake/issues/902): 改进交叉编译工具链
## v2.3.5
### 新特性
* 添加`xmake show -l envs`去显示xmake内置的环境变量列表
* [#861](https://github.com/xmake-io/xmake/issues/861): 支持从指定目录搜索本地包去直接安装远程依赖包
* [#854](https://github.com/xmake-io/xmake/issues/854): 针对wget, curl和git支持全局代理设置
### 改进
* [#828](https://github.com/xmake-io/xmake/issues/828): 针对protobuf规则增加导入子目录proto文件支持
* [#835](https://github.com/xmake-io/xmake/issues/835): 改进mode.minsizerel模式,针对msvc增加/GL支持,进一步优化目标程序大小
* [#828](https://github.com/xmake-io/xmake/issues/828): protobuf规则支持import多级子目录
* [#838](https://github.com/xmake-io/xmake/issues/838#issuecomment-643570920): 支持完全重写内置的构建规则,`add_files("src/*.c", {rules = {"xx", override = true}})`
* [#847](https://github.com/xmake-io/xmake/issues/847): 支持rc文件的头文件依赖解析
* 改进msvc工具链,去除全局环境变量的依赖
* [#857](https://github.com/xmake-io/xmake/pull/857): 改进`set_toolchains()`支持交叉编译的时候,特定target可以切换到host工具链同时编译
### Bugs 修复
* 修复进度字符显示
* [#829](https://github.com/xmake-io/xmake/issues/829): 修复由于macOS大小写不敏感系统导致的sysroot无效路径问题
* [#832](https://github.com/xmake-io/xmake/issues/832): 修复find_packages在debug模式下找不到的问题
## v2.3.4
### 新特性
* [#630](https://github.com/xmake-io/xmake/issues/630): 支持*BSD系统,例如:FreeBSD, ..
* 添加wprint接口去显示警告信息
* [#784](https://github.com/xmake-io/xmake/issues/784): 添加`set_policy()`去设置修改一些内置的策略,比如:禁用自动flags检测和映射
* [#780](https://github.com/xmake-io/xmake/issues/780): 针对target添加set_toolchains/set_toolsets实现更完善的工具链设置,并且实现platform和toolchains分离
* [#798](https://github.com/xmake-io/xmake/issues/798): 添加`xmake show`插件去显示xmake内置的各种信息
* [#797](https://github.com/xmake-io/xmake/issues/797): 添加ninja主题风格,显示ninja风格的构建进度条,`xmake g --theme=ninja`
* [#816](https://github.com/xmake-io/xmake/issues/816): 添加mode.releasedbg和mode.minsizerel编译模式规则
* [#819](https://github.com/xmake-io/xmake/issues/819): 支持ansi/vt100终端字符控制
### 改进
* [#771](https://github.com/xmake-io/xmake/issues/771): 检测includedirs,linkdirs和frameworkdirs的输入有效性
* [#774](https://github.com/xmake-io/xmake/issues/774): `xmake f --menu`可视化配置菜单支持窗口大小Resize调整
* [#782](https://github.com/xmake-io/xmake/issues/782): 添加add_cxflags等配置flags自动检测失败提示
* [#808](https://github.com/xmake-io/xmake/issues/808): 生成cmakelists插件增加对add_frameworks的支持
* [#820](https://github.com/xmake-io/xmake/issues/820): 支持独立的工作目录和构建目录,保持项目目录完全干净
### Bugs 修复
* [#786](https://github.com/xmake-io/xmake/issues/786): 修复头文件依赖检测
* [#810](https://github.com/xmake-io/xmake/issues/810): 修复linux下gcc strip debug符号问题
## v2.3.3
### 新特性
* [#727](https://github.com/xmake-io/xmake/issues/727): 支持为android, ios程序生成.so/.dSYM符号文件
* [#687](https://github.com/xmake-io/xmake/issues/687): 支持编译生成objc/bundle程序
* [#743](https://github.com/xmake-io/xmake/issues/743): 支持编译生成objc/framework程序
* 支持编译bundle, framework程序,以及mac, ios应用程序,并新增一些工程模板
* 支持对ios应用程序打包生成ipa文件,以及代码签名支持
* 增加一些ipa打包、安装、重签名等辅助工具
* 添加xmake.cli规则来支持开发带有xmake/core引擎的lua扩展程序
### 改进
* [#750](https://github.com/xmake-io/xmake/issues/750): 改进qt.widgetapp规则,支持qt私有槽
* 改进Qt/android的apk部署,并且支持Qt5.14.0新版本sdk
## v2.3.2
### 新特性
* 添加powershell色彩主题用于powershell终端下背景色显示
* 添加`xmake --dry-run -v`命令去空运行构建,仅仅为了查看详细的构建命令
* [#712](https://github.com/xmake-io/xmake/issues/712): 添加sdcc平台,并且支持sdcc编译器
### 改进
* [#589](https://github.com/xmake-io/xmake/issues/589): 改进优化构建速度,支持跨目标间并行编译和link,编译速度和ninja基本持平
* 改进ninja/cmake工程文件生成器插件
* [#728](https://github.com/xmake-io/xmake/issues/728): 改进os.cp支持保留源目录结构层级的递归复制
* [#732](https://github.com/xmake-io/xmake/issues/732): 改进find_package支持查找homebrew/cmake安装的包
* [#695](https://github.com/xmake-io/xmake/issues/695): 改进采用android ndk最新的abi命名
### Bugs 修复
* 修复windows下link error显示问题
* [#718](https://github.com/xmake-io/xmake/issues/718): 修复依赖包下载在多镜像时一定概率缓存失效问题
* [#722](https://github.com/xmake-io/xmake/issues/722): 修复无效的包依赖导致安装死循环问题
* [#719](https://github.com/xmake-io/xmake/issues/719): 修复windows下主进程收到ctrlc后,.bat子进程没能立即退出的问题
* [#720](https://github.com/xmake-io/xmake/issues/720): 修复compile_commands生成器的路径转义问题
## v2.3.1
### 新特性
* [#675](https://github.com/xmake-io/xmake/issues/675): 支持通过设置强制将`*.c`作为c++代码编译, `add_files("*.c", {sourcekind = "cxx"})`。
* [#681](https://github.com/xmake-io/xmake/issues/681): 支持在msys/cygwin上编译xmake,以及添加msys/cygwin编译平台
* 添加socket/pipe模块,并且支持在协程中同时调度process/socket/pipe
* [#192](https://github.com/xmake-io/xmake/issues/192): 尝试构建带有第三方构建系统的项目,还支持autotools项目的交叉编译
* 启用gcc/clang的编译错误色彩高亮输出
* [#588](https://github.com/xmake-io/xmake/issues/588): 改进工程生成插件`xmake project -k ninja`,增加对build.ninja生成支持
### 改进
* [#665](https://github.com/xmake-io/xmake/issues/665): 支持 *nix style 的参数输入,感谢[@OpportunityLiu](https://github.com/OpportunityLiu)的贡献
* [#673](https://github.com/xmake-io/xmake/pull/673): 改进tab命令补全,增加对参数values的补全支持
* [#680](https://github.com/xmake-io/xmake/issues/680): 优化get.sh安装脚本,添加国内镜像源,加速下载
* 改进process调度器
* [#651](https://github.com/xmake-io/xmake/issues/651): 改进os/io模块系统操作错误提示
### Bugs 修复
* 修复增量编译检测依赖文件的一些问题
* 修复log输出导致xmake-vscode插件解析编译错误信息失败问题
* [#684](https://github.com/xmake-io/xmake/issues/684): 修复windows下android ndk的一些linker错误
## v2.2.9
### 新特性
* [#569](https://github.com/xmake-io/xmake/pull/569): 增加对c++模块的实验性支持
* 添加`xmake project -k xmakefile`生成器
* [620](https://github.com/xmake-io/xmake/issues/620): 添加全局`~/.xmakerc.lua`配置文件,对所有本地工程生效.
* [593](https://github.com/xmake-io/xmake/pull/593): 添加`core.base.socket`模块,为下一步远程编译和分布式编译做准备。
### 改进
* [#563](https://github.com/xmake-io/xmake/pull/563): 重构构建逻辑,将特定语言的构建抽离到独立的rules中去
* [#570](https://github.com/xmake-io/xmake/issues/570): 改进Qt构建,将`qt.application`拆分成`qt.widgetapp`和`qt.quickapp`两个构建规则
* [#576](https://github.com/xmake-io/xmake/issues/576): 使用`set_toolchain`替代`add_tools`和`set_tools`,解决老接口使用歧义,提供更加易理解的设置方式
* 改进`xmake create`创建模板工程
* [#589](https://github.com/xmake-io/xmake/issues/589): 改进默认的构建任务数,充分利用cpu core来提速整体编译速度
* [#598](https://github.com/xmake-io/xmake/issues/598): 改进`find_package`支持在macOS上对.tbd系统库文件的查找
* [#615](https://github.com/xmake-io/xmake/issues/615): 支持安装和使用其他arch和ios的conan包
* [#629](https://github.com/xmake-io/xmake/issues/629): 改进hash.uuid并且实现uuid v4
* [#639](https://github.com/xmake-io/xmake/issues/639): 改进参数解析器支持`-jN`风格传参
### Bugs 修复
* [#567](https://github.com/xmake-io/xmake/issues/567): 修复序列化对象时候出现的内存溢出问题
* [#566](https://github.com/xmake-io/xmake/issues/566): 修复安装远程依赖的链接顺序问题
* [#565](https://github.com/xmake-io/xmake/issues/565): 修复vcpkg包的运行PATH设置问题
* [#597](https://github.com/xmake-io/xmake/issues/597): 修复xmake require安装包时间过长问题
* [#634](https://github.com/xmake-io/xmake/issues/634): 修复mode.coverage构建规则,并且改进flags检测
## v2.2.8
### 新特性
* 添加protobuf c/c++构建规则
* [#468](https://github.com/xmake-io/xmake/pull/468): 添加对 Windows 的 UTF-8 支持
* [#472](https://github.com/xmake-io/xmake/pull/472): 添加`xmake project -k vsxmake`去更好的支持vs工程的生成,内部直接调用xmake来编译
* [#487](https://github.com/xmake-io/xmake/issues/487): 通过`xmake --files="src/*.c"`支持指定一批文件进行编译。
* 针对io模块增加文件锁接口
* [#513](https://github.com/xmake-io/xmake/issues/513): 增加对android/termux终端的支持,可在android设备上执行xmake来构建项目
* [#517](https://github.com/xmake-io/xmake/issues/517): 为target增加`add_cleanfiles`接口,实现快速定制化清理文件
* [#537](https://github.com/xmake-io/xmake/pull/537): 添加`set_runenv`接口去覆盖写入系统envs
### 改进
* [#257](https://github.com/xmake-io/xmake/issues/257): 锁定当前正在构建的工程,避免其他xmake进程同时对其操作
* 尝试采用/dev/shm作为os.tmpdir去改善构建过程中临时文件的读写效率
* [#542](https://github.com/xmake-io/xmake/pull/542): 改进vs系列工具链的unicode输出问题
* 对于安装的lua脚本,启用lua字节码存储,减少安装包大小(<2.4M),提高运行加载效率。
### Bugs 修复
* [#549](https://github.com/xmake-io/xmake/issues/549): 修复新版vs2019下检测环境会卡死的问题
## v2.2.7
### 新特性
* [#455](https://github.com/xmake-io/xmake/pull/455): 支持使用 clang 作为 cuda 编译器,`xmake f --cu=clang`
* [#440](https://github.com/xmake-io/xmake/issues/440): 为target/run添加`set_rundir()`和`add_runenvs()`接口设置
* [#443](https://github.com/xmake-io/xmake/pull/443): 添加命令行tab自动完成支持
* 为rule/target添加`on_link`,`before_link`和`after_link`阶段自定义脚本支持
* [#190](https://github.com/xmake-io/xmake/issues/190): 添加`add_rules("lex", "yacc")`规则去支持lex/yacc项目
### 改进
* [#430](https://github.com/xmake-io/xmake/pull/430): 添加`add_cugencodes()`api为cuda改进设置codegen
* [#432](https://github.com/xmake-io/xmake/pull/432): 针对cuda编译支持依赖分析检测(仅支持 CUDA 10.1+)
* [#437](https://github.com/xmake-io/xmake/issues/437): 支持指定更新源,`xmake update github:xmake-io/xmake#dev`
* [#438](https://github.com/xmake-io/xmake/pull/438): 支持仅更新脚本,`xmake update --scriptonly dev`
* [#433](https://github.com/xmake-io/xmake/issues/433): 改进cuda构建支持device-link设备代码链接
* [#442](https://github.com/xmake-io/xmake/issues/442): 改进tests测试框架
## v2.2.6
### 新特性
* [#380](https://github.com/xmake-io/xmake/pull/380): 添加导出compile_flags.txt
* [#382](https://github.com/xmake-io/xmake/issues/382): 简化域设置语法
* [#397](https://github.com/xmake-io/xmake/issues/397): 添加clib包集成支持
* [#404](https://github.com/xmake-io/xmake/issues/404): 增加Qt/Android编译支持,并且支持android apk生成和部署
* 添加一些Qt空工程模板,例如:`widgetapp_qt`, `quickapp_qt_static` and `widgetapp_qt_static`
* [#415](https://github.com/xmake-io/xmake/issues/415): 添加`--cu-cxx`配置参数到`nvcc/-ccbin`
* 为Android NDK添加`--ndk_stdcxx=y`和`--ndk_cxxstl=gnustl_static`参数选项
### 改进
* 改进远程依赖包管理,丰富包仓库
* 改进`target:on_xxx`自定义脚本,去支持匹配`android|armv7-a@macosx,linux|x86_64`模式
* 改进loadfile,优化启动速度,windows上启动xmake时间提速98%
### Bugs 修复
* [#400](https://github.com/xmake-io/xmake/issues/400): 修复qt项目c++语言标准设置无效问题
## v2.2.5
### 新特性
* 添加`string.serialize`和`string.deserialize`去序列化,反序列化对象,函数以及其他类型
* 添加`xmake g --menu`去图形化配置全局选项
* [#283](https://github.com/xmake-io/xmake/issues/283): 添加`target:installdir()`和`set_installdir()`接口
* [#260](https://github.com/xmake-io/xmake/issues/260): 添加`add_platformdirs`接口,用户现在可以自定义扩展编译平台
* [#310](https://github.com/xmake-io/xmake/issues/310): 新增主题设置支持,用户可随意切换和扩展主题样式
* [#318](https://github.com/xmake-io/xmake/issues/318): 添加`add_installfiles`接口到target去自定义安装文件
* [#339](https://github.com/xmake-io/xmake/issues/339): 改进`add_requires`和`find_package`使其支持对第三方包管理的集成支持
* [#327](https://github.com/xmake-io/xmake/issues/327): 实现对conan包管理的集成支持
* 添加内置API `find_packages("pcre2", "zlib")`去同时查找多个依赖包,不需要通过import导入即可直接调用
* [#320](https://github.com/xmake-io/xmake/issues/320): 添加模板配置文件相关接口,`add_configfiles`和`set_configvar`
* [#179](https://github.com/xmake-io/xmake/issues/179): 扩展`xmake project`插件,新增CMakelist.txt生成支持
* [#361](https://github.com/xmake-io/xmake/issues/361): 增加对vs2019 preview的支持
* [#368](https://github.com/xmake-io/xmake/issues/368): 支持`private, public, interface`属性设置去继承target配置
* [#284](https://github.com/xmake-io/xmake/issues/284): 通过`add_configs()`添加和传递用户自定义配置到`package()`
* [#319](https://github.com/xmake-io/xmake/issues/319): 添加`add_headerfiles`接口去改进头文件的设置
* [#342](https://github.com/xmake-io/xmake/issues/342): 为`includes()`添加一些内置的辅助函数,例如:`check_cfuncs`
### 改进
* 针对远程依赖包,改进版本和调试模式切换
* [#264](https://github.com/xmake-io/xmake/issues/264): 支持在windows上更新dev/master版本,`xmake update dev`
* [#293](https://github.com/xmake-io/xmake/issues/293): 添加`xmake f/g --mingw=xxx` 配置选线,并且改进find_mingw检测
* [#301](https://github.com/xmake-io/xmake/issues/301): 改进编译预处理头文件以及依赖头文件生成,编译速度提升30%
* [#322](https://github.com/xmake-io/xmake/issues/322): 添加`option.add_features`, `option.add_cxxsnippets` 和 `option.add_csnippets`
* 移除xmake 1.x的一些废弃接口, 例如:`add_option_xxx`
* [#327](https://github.com/xmake-io/xmake/issues/327): 改进`lib.detect.find_package`增加对conan包管理器的支持
* 改进`lib.detect.find_package`并且添加内建的`find_packages("zlib 1.x", "openssl", {xxx = ...})`接口
* 标记`set_modes()`作为废弃接口, 我们使用`add_rules("mode.debug", "mode.release")`来替代它
* [#353](https://github.com/xmake-io/xmake/issues/353): 改进`target:set`, `target:add` 并且添加`target:del`去动态修改target配置
* [#356](https://github.com/xmake-io/xmake/issues/356): 添加`qt_add_static_plugins()`接口去支持静态Qt sdk
* [#351](https://github.com/xmake-io/xmake/issues/351): 生成vs201x插件增加对yasm的支持
* 重构改进整个远程依赖包管理器,更加快速、稳定、可靠,并提供更多的常用包
### Bugs 修复
* 修复无法通过 `set_optimize()` 设置优化选项,如果存在`add_rules("mode.release")`的情况下
* [#289](https://github.com/xmake-io/xmake/issues/289): 修复在windows下解压gzip文件失败
* [#296](https://github.com/xmake-io/xmake/issues/296): 修复`option.add_includedirs`对cuda编译不生效
* [#321](https://github.com/xmake-io/xmake/issues/321): 修复PATH环境改动后查找工具不对问题
## v2.2.3
### 新特性
* [#233](https://github.com/xmake-io/xmake/issues/233): 对mingw平台增加windres的支持
* [#239](https://github.com/xmake-io/xmake/issues/239): 添加cparser编译器支持
* 添加插件管理器,`xmake plugin --help`
* 添加`add_syslinks`接口去设置系统库依赖,分离与`add_links`添加的库依赖之间的链接顺序
* 添加 `xmake l time xmake [--rebuild]` 去记录编译耗时
* [#250](https://github.com/xmake-io/xmake/issues/250): 添加`xmake f --vs_sdkver=10.0.15063.0`去改变windows sdk版本
* 添加`lib.luajit.ffi`和`lib.luajit.jit`扩展模块
* [#263](https://github.com/xmake-io/xmake/issues/263): 添加object目标类型,仅仅用于编译生成object对象文件
* [#269](https://github.com/xmake-io/xmake/issues/269): 每天第一次构建时候后台进程自动清理最近30天的临时文件
### 改进
* [#229](https://github.com/xmake-io/xmake/issues/229): 改进vs toolset选择已经vcproj工程文件生成
* 改进编译依赖,对源文件列表的改动进行依赖判断
* 支持解压*.xz文件
* [#249](https://github.com/xmake-io/xmake/pull/249): 改进编译进度信息显示格式
* [#247](https://github.com/xmake-io/xmake/pull/247): 添加`-D`和`--diagnosis`去替换`--backtrace`,改进诊断信息显示
* [#259](https://github.com/xmake-io/xmake/issues/259): 改进 on_build, on_build_file 和 on_xxx 等接口
* 改进远程包管理器,更加方便的包依赖配置切换
* 支持only头文件依赖包的安装
* 支持对包内置links的手动调整,`add_packages("xxx", {links = {}})`
### Bugs 修复
* 修复安装依赖包失败中断后的状态不一致性问题
## v2.2.2
### 新特性
* 新增fasm汇编器支持
* 添加`has_config`, `get_config`和`is_config`接口去快速判断option和配置值
* 添加`set_config`接口去设置默认配置
* 添加`$xmake --try`去尝试构建工程
* 添加`set_enabled(false)`去显示的禁用target
* [#69](https://github.com/xmake-io/xmake/issues/69): 添加远程依赖包管理, `add_requires("tbox ~1.6.1")`
* [#216](https://github.com/xmake-io/xmake/pull/216): 添加windows mfc编译规则
### 改进
* 改进Qt编译编译环境探测,增加对mingw sdk的支持
* 在自动扫描生成的xmake.lua中增加默认debug/release规则
* [#178](https://github.com/xmake-io/xmake/issues/178): 修改mingw平台下的目标名
* 对于`add_files()`在windows上支持大小写不敏感路径模式匹配
* 改进`detect.sdks.find_qt`对于Qt根目录的探测
* [#184](https://github.com/xmake-io/xmake/issues/184): 改进`lib.detect.find_package`支持vcpkg
* [#208](https://github.com/xmake-io/xmake/issues/208): 改进rpath对动态库的支持
* [#225](https://github.com/xmake-io/xmake/issues/225): 改进vs环境探测
### Bugs 修复
* [#177](https://github.com/xmake-io/xmake/issues/177): 修复被依赖的动态库target,如果设置了basename后链接失败问题
* 修复`$ xmake f --menu`中Exit问题以及cpu过高问题
* [#197](https://github.com/xmake-io/xmake/issues/197): 修复生成的vs201x工程文件带有中文路径乱码问题
* 修复WDK规则编译生成的驱动在Win7下运行蓝屏问题
* [#205](https://github.com/xmake-io/xmake/pull/205): 修复vcproj工程生成targetdir, objectdir路径设置不匹配问题
## v2.2.1
### 新特性
* [#158](https://github.com/xmake-io/xmake/issues/158): 增加对Cuda编译环境的支持
* 添加`set_tools`和`add_tools`接口为指定target目标设置编译工具链
* 添加内建规则:`mode.debug`, `mode.release`, `mode.profile`和`mode.check`
* 添加`is_mode`, `is_arch` 和`is_plat`内置接口到自定义脚本域
* 添加color256代码
* [#160](https://github.com/xmake-io/xmake/issues/160): 增加对Qt SDK编译环境的跨平台支持,并且增加`qt.console`, `qt.application`等规则
* 添加一些Qt工程模板
* [#169](https://github.com/xmake-io/xmake/issues/169): 支持yasm汇编器
* [#159](https://github.com/xmake-io/xmake/issues/159): 增加对WDK驱动编译环境支持
### 改进
* 添加FAQ到自动生成的xmake.lua文件,方便用户快速上手
* 支持Android NDK >= r14的版本
* 改进swiftc对warning flags的支持
* [#167](https://github.com/xmake-io/xmake/issues/167): 改进自定义规则:`rule()`
* 改进`os.files`和`os.dirs`接口,加速文件模式匹配
* [#171](https://github.com/xmake-io/xmake/issues/171): 改进Qt环境的构建依赖
* 在makefile生成插件中实现`make clean`
### Bugs 修复
* 修复无法通过`add_ldflags("xx", "xx", {force = true})`强制设置多个flags的问题
* [#157](https://github.com/xmake-io/xmake/issues/157): 修复pdb符号输出目录不存在情况下编译失败问题
* 修复对macho格式目标strip all符号失效问题
* [#168](https://github.com/xmake-io/xmake/issues/168): 修复生成vs201x工程插件,在x64下失败的问题
## v2.1.9
### 新特性
* 添加`del_files()`接口去从已添加的文件列表中移除一些文件
* 添加`rule()`, `add_rules()`接口实现自定义构建规则,并且改进`add_files("src/*.md", {rule = "markdown"})`
* 添加`os.filesize()`接口
* 添加`core.ui.xxx`等cui组件模块,实现终端可视化界面,用于实现跟用户进行短暂的交互
* 通过`xmake f --menu`实现可视化菜单交互配置,简化工程的编译配置
* 添加`set_values`接口到option
* 改进option,支持根据工程中用户自定义的option,自动生成可视化配置菜单
* 在调用api设置工程配置时以及在配置菜单中添加源文件位置信息
### 改进
* 改进交叉工具链配置,通过指定工具别名定向到已知的工具链来支持未知编译工具名配置, 例如: `xmake f [email protected]`
* [#151](https://github.com/xmake-io/xmake/issues/151): 改进mingw平台下动态库生成
* 改进生成makefile插件
* 改进检测错误提示
* 改进`add_cxflags`等flags api的设置,添加force参数,来禁用自动检测和映射,强制设置选项:`add_cxflags("-DTEST", {force = true})`
* 改进`add_files`的flags设置,添加force域,用于设置不带自动检测和映射的原始flags:`add_files("src/*.c", {force = {cxflags = "-DTEST"}})`
* 改进搜索工程根目录策略
* 改进vs环境探测,支持加密文件系统下vs环境的探测
* 升级luajit到最新2.1.0-beta3
* 增加对linux/arm, arm64的支持,可以在arm linux上运行xmake
* 改进vs201x工程生成插件,更好的includedirs设置支持
### Bugs 修复
* 修复依赖修改编译和链接问题
* [#151](https://github.com/xmake-io/xmake/issues/151): 修复`os.nuldev()`在mingw上传入gcc时出现问题
* [#150](https://github.com/xmake-io/xmake/issues/150): 修复windows下ar.exe打包过长obj列表参数,导致失败问题
* 修复`xmake f --cross`无法配置问题
* 修复`os.cd`到windows根路径问题
## v2.1.8
### 新特性
* 添加`XMAKE_LOGFILE`环境变量,启用输出到日志文件
* 添加对tinyc编译器的支持
### 改进
* 改进对IDE和编辑器插件的集成支持,例如:Visual Studio Code, Sublime Text 以及 IntelliJ IDEA
* 当生成新工程的时候,自动生成一个`.gitignore`文件,忽略一些xmake的临时文件和目录
* 改进创建模板工程,使用模板名代替模板id作为参数
* 改进macOS编译平台的探测,如果没有安装xcode也能够进行编译构建,如果有编译器的话
* 改进`set_config_header`接口,支持局部版本号设置,优先于全局`set_version`,例如:`set_config_header("config", {version = "2.1.8", build = "%Y%m%d%H%M"})`
### Bugs 修复
* [#145](https://github.com/xmake-io/xmake/issues/145): 修复运行target的当前目录环境
## v2.1.7
### 新特性
* 添加`add_imports`去为target,option和package的自定义脚本批量导入模块,简化自定义脚本
* 添加`xmake -y/--yes`去确认用户输入
* 添加`xmake l package.manager.install xxx`模块,进行跨平台一致性安装软件包
* 添加vscode编辑器插件支持,更加方便的使用xmake,[xmake-vscode](https://marketplace.visualstudio.com/items?itemName=tboox.xmake-vscode#overview)
* 添加`xmake macro ..`快速运行最近一次命令
### 改进
* 改进`cprint()`,支持24位真彩色输出
* 对`add_rpathdirs()`增加对`@loader_path`和`$ORIGIN`的内置变量支持,提供可迁移动态库加载
* 改进`set_version("x.x.x", {build = "%Y%m%d%H%M"})` 支持buildversion设置
* 移除docs目录,将其放置到独立xmake-docs仓库中,减少xmake.zip的大小,优化下载安装的效率
* 改进安装和卸载脚本,支持DESTDIR和PREFIX环境变量设置
* 通过缓存优化flags探测,加速编译效率
* 添加`COLORTERM=nocolor`环境变量开关,禁用彩色输出
* 移除`add_rbindings`和`add_bindings`接口
* 禁止在重定向的时候进行彩色输出,避免输出文件中带有色彩代码干扰
* 更新tbox工程模板
* 改进`lib.detect.find_program`模块接口
* 为windows cmd终端增加彩色输出
* 增加`-w|--warning`参数来启用实时警告输出
### Bugs 修复
* 修复`set_pcxxheader`编译没有继承flags配置问题
* [#140](https://github.com/xmake-io/xmake/issues/140): 修复`os.tmpdir()`在fakeroot下的冲突问题
* [#142](https://github.com/xmake-io/xmake/issues/142): 修复`os.getenv` 在windows上的中文编码问题
* 修复在带有空格路径的情况下,编译错误问题
* 修复setenv空值的崩溃问题
## v2.1.6
### 改进
* 改进`add_files`,支持对files粒度进行编译选项的各种配置,更加灵活。
* 从依赖的target和option中继承links和linkdirs。
* 改进`target.add_deps`接口,添加继承配置,允许手动禁止依赖继承,例如:`add_deps("test", {inherit = false})`
* 移除`tbox.pkg`二进制依赖,直接集成tbox源码进行编译
### Bugs 修复
* 修复目标级联依赖问题
* 修复`target:add`和`option:add`问题
* 修复在archlinux上的编译和安装问题
* 修复`/ZI`的兼容性问题,用`/Zi`替代
## v2.1.5
### 新特性
* [#83](https://github.com/xmake-io/xmake/issues/83): 添加 `add_csnippet`,`add_cxxsnippet`到`option`来检测一些编译器特性
* [#83](https://github.com/xmake-io/xmake/issues/83): 添加用户扩展模块去探测程序,库文件以及其他主机环境
* 添加`find_program`, `find_file`, `find_library`, `find_tool`和`find_package` 等模块接口
* 添加`net.*`和`devel.*`扩展模块
* 添加`val()`接口去获取内置变量,例如:`val("host")`, `val("env PATH")`, `val("shell echo hello")` and `val("reg HKEY_LOCAL_MACHINE\\XX;Value")`
* 增加对微软.rc资源文件的编译支持,当在windows上编译时,可以增加资源文件了
* 增加`has_flags`, `features`和`has_features`等探测模块接口
* 添加`option.on_check`, `option.after_check` 和 `option.before_check` 接口
* 添加`target.on_load`接口
* [#132](https://github.com/xmake-io/xmake/issues/132): 添加`add_frameworkdirs`接口
* 添加`lib.detect.has_xxx`和`lib.detect.find_xxx`接口
* 添加`add_moduledirs`接口在工程中定义和加载扩展模块
* 添加`includes`接口替换`add_subdirs`和`add_subfiles`
* [#133](https://github.com/xmake-io/xmake/issues/133): 改进工程插件,通过运行`xmake project -k compile_commands`来导出`compile_commands.json`
* 添加`set_pcheader`和`set_pcxxheader`去支持跨编译器预编译头文件,支持`gcc`, `clang`和`msvc`
* 添加`xmake f -p cross`平台用于交叉编译,并且支持自定义平台名
### 改进
* [#87](https://github.com/xmake-io/xmake/issues/87): 为依赖库目标自动添加:`includes` 和 `links`
* 改进`import`接口,去加载用户扩展模块
* [#93](https://github.com/xmake-io/xmake/pull/93): 改进 `xmake lua`,支持运行单行命令和模块
* 改进编译错误提示信息输出
* 改进`print`接口去更好些显示table数据
* [#111](https://github.com/xmake-io/xmake/issues/111): 添加`--root`通用选项去临时支持作为root运行
* [#113](https://github.com/xmake-io/xmake/pull/113): 改进权限管理,现在作为root运行也是非常安全的
* 改进`xxx_script`工程描述api,支持多平台模式选择, 例如:`on_build("iphoneos|arm*", function (target) end)`
* 改进内置变量,支持环境变量和注册表数据的获取
* 改进vstudio环境和交叉工具链的探测
* [#71](https://github.com/xmake-io/xmake/issues/71): 改进从环境变量中探测链接器和编译器
* 改进option选项检测,通过多任务检测,提升70%的检测速度
* [#129](https://github.com/xmake-io/xmake/issues/129): 检测链接依赖,如果源文件没有改变,就不必重新链接目标文件了
* 在vs201x工程插件中增加对`*.asm`文件的支持
* 标记`add_bindings`和`add_rbindings`为废弃接口
* 优化`xmake rebuild`在windows上的构建速度
* 将`core.project.task`模块迁移至`core.base.task`
* 将`echo` 和 `app2ipa` 插件迁移到 [xmake-plugins](https://github.com/xmake-io/xmake-plugins) 仓库
* 添加`set_config_header("config.h", {prefix = ""})` 代替 `set_config_h` 和 `set_config_h_prefix`
### Bugs 修复
* 修复`try-catch-finally`
* 修复解释器bug,解决当加载多级子目录时,根域属性设置不对
* [#115](https://github.com/xmake-io/xmake/pull/115): 修复安装脚本`get.sh`的路径问题
* 修复`import()`导入接口的缓存问题
## v2.1.4
### 新特性
* [#68](https://github.com/xmake-io/xmake/issues/68): 增加`$(programdir)`和`$(xmake)`内建变量
* 添加`is_host`接口去判断当前的主机环境
* [#79](https://github.com/xmake-io/xmake/issues/79): 增强`xmake lua`,支持交互式解释执行
### 改进
* 修改菜单选项颜色
* [#71](https://github.com/xmake-io/xmake/issues/71): 针对widows编译器改进优化选项映射
* [#73](https://github.com/xmake-io/xmake/issues/73): 尝试获取可执行文件路径来作为xmake的脚本目录
* 在`add_subdirs`中的子`xmake.lua`中,使用独立子作用域,避免作用域污染导致的干扰问题
* [#78](https://github.com/xmake-io/xmake/pull/78): 美化非全屏终端窗口下的`xmake --help`输出
* 避免产生不必要的`.xmake`目录,如果不在工程中的时候
### Bugs 修复
* [#67](https://github.com/xmake-io/xmake/issues/67): 修复 `sudo make install` 命令权限问题
* [#70](https://github.com/xmake-io/xmake/issues/70): 修复检测android编译器错误
* 修复临时文件路径冲突问题
* 修复`os.host`, `os.arch`等接口
* 修复根域api加载干扰其他子作用域问题
* [#77](https://github.com/xmake-io/xmake/pull/77): 修复`cprint`色彩打印中断问题
## v2.1.3
### 新特性
* [#65](https://github.com/xmake-io/xmake/pull/65): 为target添加`set_default`接口用于修改默认的构建所有targets行为
* 允许在工程子目录执行`xmake`命令进行构建,xmake会自动检测所在的工程根目录
* 添加`add_rpathdirs` api到target和option,支持动态库的自动加载运行
### 改进
* [#61](https://github.com/xmake-io/xmake/pull/61): 提供更加安全的`xmake install` and `xmake uninstall`任务,更友好的处理root安装问题
* 提供`rpm`, `deb`和`osxpkg`安装包
* [#63](https://github.com/xmake-io/xmake/pull/63): 改进安装脚本,实现更加安全的构建和安装xmake
* [#61](https://github.com/xmake-io/xmake/pull/61): 禁止在root权限下运行xmake命令,增强安全性
* 改进工具链检测,通过延迟延迟检测提升整体检测效率
* 当自动扫面生成`xmake.lua`时,添加更友好的用户提示,避免用户无操作
### Bugs 修复
* 修复版本检测的错误提示信息
* [#60](https://github.com/xmake-io/xmake/issues/60): 修复macosx和windows平台的xmake自举编译
* [#64](https://github.com/xmake-io/xmake/issues/64): 修复构建android `armv8-a`架构失败问题
* [#50](https://github.com/xmake-io/xmake/issues/50): 修复构建android可执行程序,无法运行问题
## v2.1.2
### 新特性
* 添加aur打包脚本,并支持用`yaourt`包管理器进行安装。
* 添加[set_basename](#http://xmake.io/#/zh/manual?id=targetset_basename)接口,便于定制化修改生成后的目标文件名
### 改进
* 支持vs2017编译环境
* 支持编译android版本的rust程序
* 增强vs201x工程生成插件,支持同时多模式、架构编译
### Bugs 修复
* 修复编译android程序,找不到系统头文件问题
* 修复检测选项行为不正确问题
* [#57](https://github.com/xmake-io/xmake/issues/57): 修复代码文件权限到0644
## v2.1.1
### 新特性
* 添加`--links`, `--linkdirs` and `--includedirs` 配置参数
* 添加app2ipa插件
* 为`xmake.lua`工程描述增加dictionay语法风格
* 提供智能扫描编译模式,在无任何`xmake.lua`等工程描述文件的情况下,也能直接快速编译
* 为`xmake.lua`工程描述添加`set_xmakever`接口,更加友好的处理版本兼容性问题
* 为`objc`和`swift`程序添加`add_frameworks`接口
* 更加快速方便的多语言扩展支持,增加`golang`, `dlang`和`rust`程序构建的支持
* 添加`target_end`, `option_end` 和`task_end`等可选api,用于显示结束描述域,进入根域设置,提高可读性
* 添加`golang`, `dlang`和`rust`工程模板
### 改进
* 工程生成插件支持vs2017
* 改进gcc/clang编译器警告和错误提示
* 重构代码架构,改进多语言支持,更加方便灵活的扩展语言支持
* 改进print接口,同时支持原生lua print以及格式化打印
* 如果xmake.lua不存在,自动扫描工程代码文件,并且生成xmake.lua进行编译
* 修改license,使用更加宽松的Apache License 2.0
* 移除一些二进制工具文件
* 移除install.bat脚本,提供windows nsis安装包支持
* 使用[docute](https://github.com/egoist/docute)重写[文档](http://www.xmake.io/#/zh/),提供更加完善的文档支持
* 增强`os.run`, `os.exec`, `os.cp`, `os.mv` 和 `os.rm` 等接口,支持通配符模式匹配和批量文件操作
* 精简和优化构建输出信息,添加`-q|--quiet`选项实现静默构建
* 改进`makefile`生成插件,抽取编译工具和编译选项到全局变量
### Bugs 修复
* [#41](https://github.com/waruqi/xmake/issues/41): 修复在windows下自动检测x64失败问题
* [#43](https://github.com/waruqi/xmake/issues/43): 避免创建不必要的.xmake工程缓存目录
* 针对android版本添加c++ stl搜索目录,解决编译c++失败问题
* 修复在rhel 5.10上编译失败问题
* 修复`os.iorun`返回数据不对问题
## v2.0.5
### 新特性
* 为解释器作用域增加一些内建模块支持
* 针对windows x64平台,支持ml64汇编器
### 改进
* 增强ipairs和pairs接口,支持过滤器模式,简化脚本代码
* 为vs201x工程生成增加文件filter
* 移除`core/tools`目录以及msys工具链,在windows上使用xmake自编译core源码进行安装,优化xmake源码磁盘空间
* 移除`xmake/packages`,默认模板安装不再内置二进制packages,暂时需要手动放置,以后再做成自动包依赖下载编译
### Bugs 修复
* 修复msvc的编译选项不支持问题:`-def:xxx.def`
* 修复ml.exe汇编器脚本
* 修复选项链接顺序问题
## v2.0.4
### 新特性
* 在`xmake.lua`中添加原生shell支持,例如:`add_ldflags("$(shell pkg-config --libs sqlite3)")`
* 编译windows目标程序,默认默认启用pdb符号文件
* 在windows上添加调试器支持(vsjitdebugger, ollydbg, windbg ... )
* 添加`getenv`接口到`xmake.lua`的全局作用域中
* 添加生成vstudio工程插件(支持:vs2002 - vs2015)
* 为option添加`set_default`接口
### 改进
* 增强内建变量的处理
* 支持字符串类型的选项option设置
### Bugs 修复
* 修复在linux下检测ld连接器失败,如果没装g++的话
* 修复`*.cxx`编译失败问题
## v2.0.3
### 新特性
* 增加头文件依赖自动检测和增量编译,提高编译速度
* 在终端中进行颜色高亮提示
* 添加调试器支持,`xmake run -d program ...`
### 改进
* 增强运行shell的系列接口
* 更新luajit到v2.0.4版本
* 改进makefile生成插件,移除对xmake的依赖,并且支持`windows/linux/macosx`等大部分pc平台
* 优化多任务编译速度,在windows下编译提升较为明显
### Bugs 修复
* 修复安装目录错误问题
* 修复`import`根目录错误问题
* 修复在多版本vs同时存在的情况下,检测vs环境失败问题
## v2.0.2
### 改进
* 修改安装和卸载的action处理
* 更新工程模板
* 增强函数检测
### Bugs 修复
* [#7](https://github.com/waruqi/xmake/issues/7): 修复用模板创建工程后,target名不对问题:'[targetname]'
* [#9](https://github.com/waruqi/xmake/issues/9): 修复clang不支持c++11的问题
* 修复api作用域泄露问题
* 修复在windows上的一些路径问题
* 修复检测宏函数失败问题
* 修复检测工具链失败问题
* 修复windows上编译android版本失败
## v2.0.1
### 新特性
* 增加task任务机制,可运行自定义任务脚本
* 实现plugin扩展机制,可以很方便扩展实现自定义插件,目前已实现的一些内置插件
* 增加project文件导出插件(目前已支持makefile的生成,后续会支持:vs, xcode等工程的生成)
* 增加hello xmake插件(插件demo)
* 增加doxygen文档生成插件
* 增加自定义宏脚本插件(支持动态宏记录、宏回放、匿名宏、批量导入、导出等功能)
* 增加更多的类库用于插件化开发
* 实现异常捕获机制,简化上层调用逻辑
* 增加多个option进行宏绑定,实现配置一个参数,就可以同时对多个配置进行生效
* 增加显示全局构建进度
### 改进
* 重构整个xmake.lua描述文件的解释器,更加的灵活可扩展
* 更加严格的语法检测机制
* 更加严格的作用域管理,实现沙盒引擎,对xmake.lua中脚本进行沙盒化处理,使得xmake.lua更加的安全
* 简化模板的开发,简单几行描述就可以扩展一个新的自定义工程模板
* 完全模块化platforms、tools、templates、actions,以及通过自注册机制,只需把自定义的脚本放入对应目录,就可实现快速扩展
* 针对所有可扩展脚本所需api进行大量简化,并实现大量类库,通过import机制进行导入使用
* 移除对gnu make/nmake等make工具的依赖,不再需要makefile,实现自己的make算法,
* 优化构建速度,支持多任务编译(支持vs编译器)(实测:比v1.0.4提升x4倍的构建性能)
* 优化自动检测机制,更加的稳定和准确
* 修改部分工程描述api,增强扩展性,减少一些命名歧义(对低版本向下兼容)
* 优化静态库合并:`add_files("*.a")`,修复一些bug
* 优化交叉编译,通过`--sdk=xxx`参数实现更加方便智能的进行交叉编译配置,简化mingw平台的编译配置
* 简化命令行配置开关, 支持`xmake config --xxx=[y|n|yes|no|true|false]`等开关值
* 合并iphoneos和iphonesimulator平台,以及watchos和watchsimulator平台,通过arch来区分,使得打包更加方便,能够支持一次性打包iphoneos的所有arch到一个包中
### Bugs 修复
* [#3](https://github.com/waruqi/xmake/issues/3): 修复ArchLinux 编译失败问题
* [#4](https://github.com/waruqi/xmake/issues/4): 修复windows上安装失败问题
* 修复windows上环境变量设置问题
## v1.0.4
### 新特性
* 增加对windows汇编器的支持
* 为xmake create增加一些新的工程模板,支持tbox版本
* 支持swift代码
* 针对-v参数,增加错误输出信息
* 增加apple编译平台:watchos, watchsimulator的编译支持
* 增加对windows: x64, amd64, x86_amd64架构的编译支持
* 实现动态库和静态库的快速切换
* 添加-j/--jobs参数,手动指定是否多任务编译,默认改为单任务编译
### 改进
* 增强`add_files`接口,支持直接添加`*.o/obj/a/lib`文件,并且支持静态库的合并
* 裁剪xmake的安装过程,移除一些预编译的二进制程序
### Bugs 修复
* [#1](https://github.com/waruqi/xmake/issues/4): 修复win7上安装失败问题
* 修复和增强工具链检测
* 修复一些安装脚本的bug, 改成外置sudo进行安装
* 修复linux x86_64下安装失败问题
## v1.0.3
### 新特性
* 添加set_runscript接口,支持自定义运行脚本扩展
* 添加import接口,使得在xmake.lua中可以导入一些扩展模块,例如:os,path,utils等等,使得脚本更灵活
* 添加android平台arm64-v8a支持
### Bugs 修复
* 修复set_installscript接口的一些bug
* 修复在windows x86_64下,安装失败的问题
* 修复相对路径的一些bug
|
0 | repos | repos/xmake/CODE_OF_CONDUCT.md | # Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [[email protected]]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
# Contributor Covenant行为准则
# 参与者公约
## 我们的保证
为了促进一个开放透明且友好的环境,我们作为贡献者和维护者保证:无论年龄、种族、民族、性别认同和表达(方式)、体型、身体健全与否、经验水平、国籍、个人表现、宗教或性别取向,参与者在我们项目和社区中都免于骚扰。
## 我们的标准
有助于创造正面环境的行为包括但不限于:
* 使用友好和包容性语言
* 尊重不同的观点和经历
* 耐心地接受建设性批评
* 关注对社区最有利的事情
* 友善对待其他社区成员
身为参与者不能接受的行为包括但不限于:
* 使用与性有关的言语或是图像,以及不受欢迎的性骚扰
* 捣乱/煽动/造谣的行为或进行侮辱/贬损的评论,人身攻击及政治攻击
* 公开或私下的骚扰
* 未经许可地发布他人的个人资料,例如住址或是电子地址
* 其他可以被合理地认定为不恰当或者违反职业操守的行为
## 我们的责任
项目维护者有责任为「可接受的行为」标准做出诠释,以及对已发生的不被接受的行为采取恰当且公平的纠正措施。
项目维护者有权利及责任去删除、编辑、拒绝与本行为标准有所违背的评论 (comments)、提交 (commits)、代码、wiki 编辑、问题 (issues) 和其他贡献,以及项目维护者可暂时或永久性的禁止任何他们认为有不适当、威胁、冒犯、有害行为的贡献者。
## 使用范围
当一个人代表该项目或是其社区时,本行为标准适用于其项目平台和公共平台。
代表项目或是社区的情况,举例来说包括使用官方项目的电子邮件地址、通过官方的社区媒体账号发布或线上或线下事件中担任指定代表。
该项目的呈现方式可由其项目维护者进行进一步的定义及解释。
## 强制执行
可以通过[[email protected]],来联系项目团队来举报滥用、骚扰或其他不被接受的行为。
任何维护团队认为有必要且适合的所有投诉都将进行审查及调查,并做出相对应的回应。项目小组有对事件回报者有保密的义务。具体执行的方针近一步细节可能会单独公布。
没有切实地遵守或是执行本行为标准的项目维护人员,可能会因项目领导人或是其他成员的决定,暂时或是永久地取消其参与资格。
## 来源
本行为标准改编自[贡献者公约][主页],版本 1.4
可在此观看https://www.contributor-covenant.org/zh-cn/version/1/4/code-of-conduct.html
[主页]: https://www.contributor-covenant.org
|
0 | repos | repos/xmake/CONTRIBUTING.md | # Contributing
If you discover issues, have ideas for improvements or new features, or
want to contribute a new module, please report them to the
[issue tracker][1] of the repository or submit a pull request. Please,
try to follow these guidelines when you do so.
## Issue reporting
* Check that the issue has not already been reported.
* Check that the issue has not already been fixed in the latest code
(a.k.a. `master`).
* Be clear, concise and precise in your description of the problem.
* Open an issue with a descriptive title and a summary in grammatically correct,
complete sentences.
* Include any relevant code to the issue summary.
## Pull requests
* Use a topic branch to easily amend a pull request later, if necessary.
* Write good commit messages.
* Use the same coding conventions as the rest of the project.
* Ensure your edited codes with four spaces instead of TAB.
* Please commit code to `dev` branch and we will merge into `master` branch in future.
### Some suggestions for developing code for this project
#### Speed up build
* Use `ccache`.
* Pre-build by `make build -j`. Then if you do no modification on files in dir `core`, just use `scripts/get.sh __local__ __install_only__` to quickly install.
* Use a real xmake executable file with environment variable `XMAKE_PROGRAM_DIR` set to dir `xmake` in repo path so that no installation is needed.
#### Understand API layouts
* Action scripts, plugin scripts and user's `xmake.lua` run in a sandbox. The sandbox API is in `xmake/core/sandbox`.
* Utility scripts run in a base lua environment. Base API is in `xmake/core/base`
* Native API, which includes the lua API and the xmake ext API, is written in C in `core/src/xmake`
For example, to copy a directory in sandbox, the calling procedure is: `sandbox_os.cp()` -> `os.cp()` -> `xm_os_cpdir()` -> `tb_directory_copy()`
## Financial contributions
We also welcome financial contributions in full transparency on our [sponsor](https://xmake.io/#/about/sponsor).
Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
# 贡献代码
如果你发现一些问题,或者想新增或者改进某些新特性,或者想贡献一个新的模块
那么你可以在[issues][1]上提交反馈,或者发起一个提交代码的请求(pull request).
## 问题反馈
* 确认这个问题没有被反馈过
* 确认这个问题最近还没有被修复,请先检查下 `master` 的最新提交
* 请清晰详细地描述你的问题
* 如果发现某些代码存在问题,请在issue上引用相关代码
## 提交代码
* 请先更新你的本地分支到最新,再进行提交代码请求,确保没有合并冲突
* 编写友好可读的提交信息
* 请使用与工程代码相同的代码规范
* 确保提交的代码缩进是四个空格,而不是tab
* 请提交代码到`dev`分支,如果通过,我们会在特定时间合并到`master`分支上
* 为了规范化提交日志的格式,commit消息,不要用中文,请用英文描述
[1]: https://github.com/xmake-io/xmake/issues
|
0 | repos | repos/xmake/NOTICE.md | A cross-platform build utility based on Lua
Copyright 2015-present The TBOOX Open Source Group
This product includes software developed by The TBOOX Open Source Group (https://tboox.org/).
-------------------------------------------------------------------------------
This product depends on 'lua-cjson', The Lua CJSON module provides JSON support for Lua,
which can be obtained at:
* LICENSE:
* core/src/lua-cjson/lua-cjson/LICENSE (MIT License)
* HOMEPAGE:
* https://www.kyne.com.au/~mark/software/lua-cjson.php
This product depends on 'pdcurses', an implementation of X/Open curses for multiple platforms,
which can be obtained at:
* LICENSE:
* Public Domain License
* HOMEPAGE:
* http://pdcurses.org/
This product depends on 'libsv', Public domain semantic versioning in c,
which can be obtained at:
* LICENSE:
* core/src/sv/sv/UNLICENSE (Public Domain License)
* HOMEPAGE:
* https://github.com/uael/sv
This product depends on 'LuaJIT', a Just-In-Time Compiler for Lua,
which can be obtained at:
* LICENSE:
* core/src/luajit/luajit/COPYRIGHT (MIT License)
* HOMEPAGE:
* http://luajit.org/
This product depends on 'Lua', The Lua Programming Language,
which can be obtained at:
* LICENSE:
* https://www.lua.org/license.html (MIT License)
* HOMEPAGE:
* http://lua.org/
This product depends on 'lz4', Extremely Fast Compression algorithm,
which can be obtained at:
* LICENSE:
* https://github.com/lz4/lz4/blob/dev/LICENSE
* HOMEPAGE:
* https://www.lz4.org/
This product depends on 'xxHash', Extremely fast non-cryptographic hash algorithm,
which can be obtained at:
* LICENSE:
* https://github.com/Cyan4973/xxHash/blob/dev/LICENSE
* HOMEPAGE:
* https://www.xxhash.com/
This product depends on 'tbox', The Treasure Box Library,
which can be obtained at:
* LICENSE:
* core/src/tbox/tbox/LICENSE.md (Apache License 2.0)
* HOMEPAGE:
* https://tboox.org/
|
0 | repos | repos/xmake/README.md | <div align="center">
<a href="https://xmake.io">
<img width="160" height="160" src="https://tboox.org/static/img/xmake/logo256c.png">
</a>
<h1>xmake</h1>
<div>
<a href="https://github.com/xmake-io/xmake/actions?query=workflow%3AWindows">
<img src="https://img.shields.io/github/actions/workflow/status/xmake-io/xmake/windows.yml?branch=master&style=flat-square&logo=windows" alt="github-ci" />
</a>
<a href="https://github.com/xmake-io/xmake/actions?query=workflow%3ALinux">
<img src="https://img.shields.io/github/actions/workflow/status/xmake-io/xmake/linux.yml?branch=master&style=flat-square&logo=linux" alt="github-ci" />
</a>
<a href="https://github.com/xmake-io/xmake/actions?query=workflow%3AmacOS">
<img src="https://img.shields.io/github/actions/workflow/status/xmake-io/xmake/macos.yml?branch=master&style=flat-square&logo=apple" alt="github-ci" />
</a>
<a href="https://github.com/xmake-io/xmake/releases">
<img src="https://img.shields.io/github/release/xmake-io/xmake.svg?style=flat-square" alt="Github All Releases" />
</a>
</div>
<div>
<a href="https://github.com/xmake-io/xmake/blob/master/LICENSE.md">
<img src="https://img.shields.io/github/license/xmake-io/xmake.svg?colorB=f48041&style=flat-square" alt="license" />
</a>
<a href="https://www.reddit.com/r/xmake/">
<img src="https://img.shields.io/badge/chat-on%20reddit-ff3f34.svg?style=flat-square" alt="Reddit" />
</a>
<a href="https://t.me/tbooxorg">
<img src="https://img.shields.io/badge/chat-on%20telegram-blue.svg?style=flat-square" alt="Telegram" />
</a>
<a href="https://jq.qq.com/?_wv=1027&k=5hpwWFv">
<img src="https://img.shields.io/badge/chat-on%20QQ-ff69b4.svg?style=flat-square" alt="QQ" />
</a>
<a href="https://discord.gg/xmake">
<img src="https://img.shields.io/badge/chat-on%20discord-7289da.svg?style=flat-square" alt="Discord" />
</a>
<a href="https://xmake.io/#/sponsor">
<img src="https://img.shields.io/badge/donate-us-orange.svg?style=flat-square" alt="Donate" />
</a>
</div>
<b>A cross-platform build utility based on Lua</b><br/>
<i>Modern C/C++ build tool: Simple, Fast, Powerful dependency package integration</i><br/>
</div>
## Support this project
Support this project by [becoming a sponsor](https://xmake.io/#/about/sponsor). Your logo will show up here with a link to your website. 🙏
<a href="https://opencollective.com/xmake#sponsors" target="_blank"><img src="https://opencollective.com/xmake/sponsors.svg?width=890"></a>
<a href="https://opencollective.com/xmake#backers" target="_blank"><img src="https://opencollective.com/xmake/backers.svg?width=890"></a>
## Technical support
You can also consider sponsoring us to get extra technical support services via the [Github sponsor program](https://github.com/sponsors/waruqi). If you do, you can get access to the [xmake-io/technical-support](https://github.com/xmake-io/technical-support) repository, which has the following benefits:
- [X] Handling Issues with higher priority
- [X] One-to-one technical consulting service
- [X] Review your xmake.lua and provide suggestions for improvement
## Introduction ([中文](/README_zh.md))
What is Xmake?
1. Xmake is a cross-platform build utility based on the Lua scripting language.
2. Xmake is very lightweight and has no dependencies outside of the standard library.
3. Uses the `xmake.lua` file to maintain project builds with a simple and readable syntax.
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 *built-in* package management system to help users integrate C/C++ dependencies.
```
Xmake = Build backend + Project Generator + Package Manager + [Remote|Distributed] Build + Cache
```
Although less precise, one can still understand Xmake in the following way:
```
Xmake ≈ Make/Ninja + CMake/Meson + Vcpkg/Conan + distcc + ccache/sccache
```
If you want to know more, please refer to: the [Documentation](https://xmake.io/#/getting_started), [GitHub](https://github.com/xmake-io/xmake) or [Gitee](https://gitee.com/tboox/xmake). You are also welcome to join our [community](https://xmake.io/#/about/contact).
The official Xmake repository can be found at [xmake-io/xmake-repo](https://github.com/xmake-io/xmake-repo).

## Installation
### With cURL
```bash
curl -fsSL https://xmake.io/shget.text | bash
```
### With Wget
```bash
wget https://xmake.io/shget.text -O - | bash
```
### With PowerShell
```sh
Invoke-Expression (Invoke-Webrequest 'https://xmake.io/psget.text' -UseBasicParsing).Content
```
### Other installation methods
If you don't want to use the above scripts to install Xmake, visit the [Installation Guide](https://xmake.io/#/guide/installation) for other installation methods (building from source, package managers, etc.).
## Simple Project Description
```lua
target("console")
set_kind("binary")
add_files("src/*.c")
```
Creates a new target `console` of kind `binary`, and adds all the files ending in `.c` in the `src` directory.
## Package dependencies
```lua
add_requires("tbox 1.6.*", "zlib", "libpng ~1.6")
```
Adds a requirement of tbox v1.6, zlib (any version), and libpng v1.6.
The official xmake package repository exists at: [xmake-repo](https://github.com/xmake-io/xmake-repo)
<p align="center">
<img src="https://github.com/xmake-io/xmake-docs/raw/master/assets/img/index/package.gif" width="650px" />
</p>
## Command line interface reference
The below assumes you are currently in the project's root directory.
### Build a project
```bash
$ xmake
```
### Run target
```bash
$ xmake run console
```
### Debug target
```bash
$ xmake run -d console
```
### Run test
```bash
$ xmake test
```
### Configure platform
```bash
$ xmake f -p [windows|linux|macosx|android|iphoneos ..] -a [x86|arm64 ..] -m [debug|release]
$ xmake
```
### Menu configuration
```bash
$ xmake f --menu
```
<p align="center">
<img src="https://xmake.io/assets/img/index/menuconf.png" width="650px"/>
</p>
## Supported platforms
* Windows (x86, x64, arm, arm64, arm64ec)
* macOS (i386, x86_64, arm64)
* Linux (i386, x86_64, arm, arm64, riscv, mips, 390x, sh4 ...)
* *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)
* AppleXROS (arm64, x86_64)
* MSYS (i386, x86_64)
* MinGW (i386, x86_64, arm, arm64)
* Cygwin (i386, x86_64)
* Wasm (wasm32, wasm64)
* Haiku (i386, x86_64)
* Harmony (x86_64, armeabi-v7a, arm64-v8a)
* Cross (cross-toolchains ..)
## Supported toolchains
```bash
$ xmake show -l toolchains
xcode Xcode IDE
msvc Microsoft Visual C/C++ Compiler
clang-cl LLVM Clang C/C++ Compiler compatible with msvc
yasm The Yasm Modular Assembler
clang A C language family frontend for LLVM
go Go Programming Language Compiler
dlang D Programming Language Compiler (Auto)
dmd D Programming Language Compiler
ldc The LLVM-based D Compiler
gdc The GNU D Compiler (GDC)
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
ifx Intel LLVM 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
icx Intel LLVM C/C++ Compiler
dpcpp Intel LLVM C++ Compiler for data parallel programming model based on Khronos SYCL
masm32 The MASM32 SDK
iverilog Icarus Verilog
verilator Verilator open-source SystemVerilog simulator and lint system
cosmocc build-once run-anywhere
hdk Harmony SDK
```
## Supported languages
* C and C++
* Objective-C and Objective-C++
* Swift
* Assembly
* Golang
* Rust
* Dlang
* Fortran
* Cuda
* Zig
* Vala
* Pascal
* Nim
* Verilog
* FASM
* NASM
* YASM
* MASM32
* Cppfront
## Features
Xmake exhibits:
* Simple yet flexible configuration grammar.
* Quick, dependency-free installation.
* Easy compilation for most all supported platforms.
* Supports cross-compilation with intelligent analysis of cross toolchain information.
* Extremely fast parallel compilation support.
* Supports C++ modules (new in C++20).
* Supports cross-platform C/C++ dependencies with built-in package manager.
* Multi-language compilation support including mixed-language projects.
* Rich plug-in support with various project generators (ex. Visual Studio/Makefiles/CMake/`compile_commands.json`)
* REPL interactive execution support
* Incremental compilation support with automatic analysis of header files
* Built-in toolchain management
* A large number of expansion modules
* Remote compilation support
* Distributed compilation support
* Local and remote build cache support
## Supported Project Types
Xmake supports the below types of projects:
* Static libraries
* Shared libraries
* Console/CLI applications
* CUDA programs
* Qt applications
* WDK drivers (umdf/kmdf/wdm)
* WinSDK applications
* MFC applications
* Darwin applications (with metal support)
* Frameworks and bundles (in Darwin)
* SWIG modules (Lua, Python, ...)
* LuaRocks modules
* Protobuf programs
* Lex/Yacc programs
* Linux kernel modules
## Package management
### Download and build
Xmake can automatically fetch and install dependencies!
<p align="center">
<img src="https://xmake.io/assets/img/index/package_manage.png" width="650px" />
</p>
### Supported package repositories
* Official package repository [xmake-repo](https://github.com/xmake-io/xmake-repo) (tbox >1.6.1)
* Official package manager [Xrepo](https://github.com/xmake-io/xrepo)
* [User-built repositories](https://xmake.io/#/package/remote_package?id=using-self-built-private-package-repository)
* 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)
* Zypper on openSUSE (zypper::libsfml2 2.5)
### Package management features
* The official repository provides nearly 500+ packages with simple compilation on all supported platforms
* Full platform package support, support for cross-compiled dependent packages
* Support package virtual environment using `xrepo env shell`
* Precompiled package acceleration for Windows (NT)
* Support self-built package repositories and private repository deployment
* Third-party package repository support for repositories such as: vcpkg, conan, conda, etc.
* Supports automatic pulling of remote toolchains
* Supports dependency version locking
## Processing architecture
Below is a diagram showing roughly the architecture of Xmake, and thus how it functions.
<p align="center">
<img src="https://xmake.io/assets/img/index/package_arch.png" width="650px" />
</p>
## Distributed Compilation
- [X] Cross-platform support.
- [X] Support for MSVC, Clang, GCC and other cross-compilation toolchains.
- [X] Support for building for Android, Linux, Windows NT, and Darwin hosts.
- [X] No dependencies other than the compilation toolchain.
- [X] Support for build server load balancing scheduling.
- [X] Support for real time compressed transfer of large files (lz4).
- [X] Almost zero configuration cost, no shared filesystem required, for convenience and security.
For more details see: [#274](https://github.com/xmake-io/xmake/issues/274)
## Remote Compilation
For more details see: [#622](https://github.com/xmake-io/xmake/issues/622)
## Local/Remote Build Cache
For more details see: [#622](https://github.com/xmake-io/xmake/issues/2371)
## Benchmark
Xmake's speed on is par with Ninja! The test project: [xmake-core](https://github.com/xmake-io/xmake/tree/master/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 |
## More Examples
### Debug and release profiles
```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
```
### Custom scripts
```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)
```
### Automatic integration of dependent packages
Download and use packages in [xmake-repo](https://github.com/xmake-io/xmake-repo) or third-party repositories:
```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")
```
In addition, we can also use the [xrepo](https://github.com/xmake-io/xrepo) command to quickly install dependencies.
### Qt QuickApp Program
```lua
target("test")
add_rules("qt.quickapp")
add_files("src/*.cpp")
add_files("src/qml.qrc")
```
### Cuda Program
```lua
target("test")
set_kind("binary")
add_files("src/*.cu")
add_cugencodes("native")
add_cugencodes("compute_35")
```
### WDK/UMDF Driver Program
```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")
```
For more WDK driver examples (UMDF/KMDF/WDM), please visit [WDK Program Examples](https://xmake.io/#/guide/project_examples?id=wdk-driver-program)
### Darwin Applications
```lua
target("test")
add_rules("xcode.application")
add_files("src/*.m", "src/**.storyboard", "src/*.xcassets")
add_files("src/Info.plist")
```
### Framework and Bundle Program (Darwin)
```lua
target("test")
add_rules("xcode.framework") -- or xcode.bundle
add_files("src/*.m")
add_files("src/Info.plist")
```
### OpenMP Program
```lua
add_requires("libomp", {optional = true})
target("loop")
set_kind("binary")
add_files("src/*.cpp")
add_rules("c++.openmp")
add_packages("libomp")
```
### Zig Program
```lua
target("test")
set_kind("binary")
add_files("src/main.zig")
```
### Automatically fetch remote toolchain
#### fetch a special version of LLVM
Require the Clang version packaged with LLM-10 to compile a project.
```lua
add_requires("llvm 10.x", {alias = "llvm-10"})
target("test")
set_kind("binary")
add_files("src/*.c")
set_toolchains("llvm@llvm-10")
```
#### Fetch a cross-compilation toolchain
We can also pull a specified cross-compilation toolchain in to compile the project.
```lua
add_requires("muslcc")
target("test")
set_kind("binary")
add_files("src/*.c")
set_toolchains("@muslcc")
```
#### Fetch toolchain and packages
We can also use the specified `muslcc` cross-compilation toolchain to compile and integrate all dependent packages.
```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")
```
## Plugins
#### Generate IDE project file plugin(makefile, vs2002 - vs2022 .. )
```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
```
#### Run a custom lua script plugin
```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
}
```
To see a list of bultin plugs, please visit [Builtin plugins](https://xmake.io/#/plugin/builtin_plugins).
Please download and install other plugins from the plugins repository [xmake-plugins](https://github.com/xmake-io/xmake-plugins).
## IDE/Editor Integration
* [xmake-vscode](https://github.com/xmake-io/xmake-vscode)
<img src="https://raw.githubusercontent.com/xmake-io/xmake-vscode/master/res/problem.gif" width="650px" />
* [xmake-sublime](https://github.com/xmake-io/xmake-sublime)
<img src="https://raw.githubusercontent.com/xmake-io/xmake-sublime/master/res/problem.gif" width="650px" />
* [xmake-idea](https://github.com/xmake-io/xmake-idea)
<img src="https://raw.githubusercontent.com/xmake-io/xmake-idea/master/res/problem.gif" width="650px" />
* [xmake.vim](https://github.com/luzhlon/xmake.vim) (third-party, thanks [@luzhlon](https://github.com/luzhlon))
* [xmake-visualstudio](https://github.com/HelloWorld886/xmake-visualstudio) (third-party, thanks [@HelloWorld886](https://github.com/HelloWorld886))
* [xmake-qtcreator](https://github.com/Arthapz/xmake-project-manager) (third-party, thanks [@Arthapz](https://github.com/Arthapz))
### Xmake Gradle Plugin (JNI)
We can use the [xmake-gradle](https://github.com/xmake-io/xmake-gradle) plugin to compile JNI libraries via gradle.
```
plugins {
id 'org.tboox.gradle-xmake-plugin' version '1.1.5'
}
android {
externalNativeBuild {
xmake {
path "jni/xmake.lua"
}
}
}
```
The `xmakeBuild` task will be injected into the `assemble` task automatically if the `gradle-xmake-plugin` has been applied.
```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
```
## CI Integration
### GitHub Action
The [github-action-setup-xmake](https://github.com/xmake-io/github-action-setup-xmake) plugin for GitHub Actions can allow you to use Xmake with minimal efforts if you use GitHub Actions for your CI pipeline.
```yaml
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
```
## Who is using Xmake?
The list of people and projects who are using Xmake is available [here](https://xmake.io/#/about/who_is_using_xmake).
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.
This will help the Xmake project and it's community grow stronger and expand!
## Contacts
* Email:[[email protected]](mailto:[email protected])
* Homepage:[xmake.io](https://xmake.io)
* Community
- [Chat on Reddit](https://www.reddit.com/r/xmake/)
- [Chat on Telegram](https://t.me/tbooxorg)
- [Chat on Discord](https://discord.gg/xmake)
- Chat on QQ Group: 343118190, 662147501
* Source Code:[GitHub](https://github.com/xmake-io/xmake), [Gitee](https://gitee.com/tboox/xmake)
* WeChat Public: tboox-os
## Thanks
This project exists thanks to all the people who have [contributed](CONTRIBUTING.md):
<a href="https://github.com/xmake-io/xmake/graphs/contributors"><img src="https://opencollective.com/xmake/contributors.svg?width=890&button=false" /></a>
* [TitanSnow](https://github.com/TitanSnow): Provide the xmake [logo](https://github.com/TitanSnow/ts-xmake-logo) and install scripts
* [uael](https://github.com/uael): Provide the semantic versioning library [sv](https://github.com/uael/sv)
* [OpportunityLiu](https://github.com/OpportunityLiu): Improve cuda, tests and ci
* [xq144](https://github.com/xq114): Improve `xrepo env shell`, and contribute a lot of packages to the [xmake-repo](https://github.com/xmake-io/xmake-repo) repository.
* `enderger`: Helped smooth out the edges on the English translation of the README
|
0 | repos | repos/xmake/README_zh.md | <div align="center">
<a href="https://xmake.io/cn">
<img width="160" height="160" src="https://tboox.org/static/img/xmake/logo256c.png">
</a>
<h1>xmake</h1>
<div>
<a href="https://github.com/xmake-io/xmake/actions?query=workflow%3AWindows">
<img src="https://img.shields.io/github/actions/workflow/status/xmake-io/xmake/windows.yml?branch=master&style=flat-square&logo=windows" alt="github-ci" />
</a>
<a href="https://github.com/xmake-io/xmake/actions?query=workflow%3ALinux">
<img src="https://img.shields.io/github/actions/workflow/status/xmake-io/xmake/linux.yml?branch=master&style=flat-square&logo=linux" alt="github-ci" />
</a>
<a href="https://github.com/xmake-io/xmake/actions?query=workflow%3AmacOS">
<img src="https://img.shields.io/github/actions/workflow/status/xmake-io/xmake/macos.yml?branch=master&style=flat-square&logo=apple" alt="github-ci" />
</a>
<a href="https://github.com/xmake-io/xmake/releases">
<img src="https://img.shields.io/github/release/xmake-io/xmake.svg?style=flat-square" alt="Github All Releases" />
</a>
</div>
<div>
<a href="https://github.com/xmake-io/xmake/blob/master/LICENSE.md">
<img src="https://img.shields.io/github/license/xmake-io/xmake.svg?colorB=f48041&style=flat-square" alt="license" />
</a>
<a href="https://www.reddit.com/r/xmake/">
<img src="https://img.shields.io/badge/chat-on%20reddit-ff3f34.svg?style=flat-square" alt="Reddit" />
</a>
<a href="https://t.me/tbooxorg">
<img src="https://img.shields.io/badge/chat-on%20telegram-blue.svg?style=flat-square" alt="Telegram" />
</a>
<a href="https://jq.qq.com/?_wv=1027&k=5hpwWFv">
<img src="https://img.shields.io/badge/chat-on%20QQ-ff69b4.svg?style=flat-square" alt="QQ" />
</a>
<a href="https://discord.gg/xmake">
<img src="https://img.shields.io/badge/chat-on%20discord-7289da.svg?style=flat-square" alt="Discord" />
</a>
<a href="https://xmake.io/#/zh-cn/about/sponsor">
<img src="https://img.shields.io/badge/donate-us-orange.svg?style=flat-square" alt="Donate" />
</a>
</div>
<b>A cross-platform build utility based on Lua</b><br/>
<i>Modern C/C++ build tools, Simple, Fast, Powerful dependency package integration</i><br/>
</div>
## 项目支持
通过[成为赞助者](https://xmake.io/#/about/sponsor)来支持该项目。您的logo将显示在此处,并带有指向您网站的链接。🙏
<a href="https://opencollective.com/xmake#sponsors" target="_blank"><img src="https://opencollective.com/xmake/sponsors.svg?width=890"></a>
<a href="https://opencollective.com/xmake#backers" target="_blank"><img src="https://opencollective.com/xmake/backers.svg?width=600"></a>
## 技术支持
你也可以考虑通过 [Github 的赞助计划](https://github.com/sponsors/waruqi) 赞助我们来获取额外的技术支持服务,然后你就能获取 [xmake-io/technical-support](https://github.com/xmake-io/technical-support) 仓库的访问权限,获取更多技术咨询相关的信息。
- [x] 更高优先级的 Issues 问题处理
- [x] 一对一技术咨询服务
- [x] Review xmake.lua 并提供改进建议
## 简介
Xmake 是一个基于 Lua 的轻量级跨平台构建工具。
它非常的轻量,没有任何依赖,因为它内置了 Lua 运行时。
它使用 xmake.lua 维护项目构建,相比 makefile/CMakeLists.txt,配置语法更加简洁直观,对新手非常友好,短时间内就能快速入门,能够让用户把更多的精力集中在实际的项目开发上。
我们能够使用它像 Make/Ninja 那样可以直接编译项目,也可以像 CMake/Meson 那样生成工程文件,另外它还有内置的包管理系统来帮助用户解决 C/C++ 依赖库的集成使用问题。
目前,Xmake 主要用于 C/C++ 项目的构建,但是同时也支持其他 native 语言的构建,可以实现跟 C/C++ 进行混合编译,同时编译速度也是非常的快,可以跟 Ninja 持平。
```
Xmake = Build backend + Project Generator + Package Manager + [Remote|Distributed] Build + Cache
```
尽管不是很准确,但我们还是可以把 Xmake 按下面的方式来理解:
```
Xmake ≈ Make/Ninja + CMake/Meson + Vcpkg/Conan + distcc + ccache/sccache
```
如果你想要了解更多,请参考:[在线文档](https://xmake.io/#/zh-cn/getting_started), [Github](https://github.com/xmake-io/xmake)以及[Gitee](https://gitee.com/tboox/xmake)和[GitCode](https://gitcode.com/xmake-io/xmake),同时也欢迎加入我们的 [社区](https://xmake.io/#/zh-ch/about/contact).

## 课程
xmake 官方也推出了一些入门课程,带你一步步快速上手 xmake,课程列表如下:
* [Xmake 带你轻松构建 C/C++ 项目](https://xmake.io/#/zh-cn/about/course)
## 安装
#### 使用curl
```bash
curl -fsSL https://xmake.io/shget.text | bash
```
#### 使用wget
```bash
wget https://xmake.io/shget.text -O - | bash
```
#### 使用powershell
```powershell
Invoke-Expression (Invoke-Webrequest 'https://xmake.io/psget.text' -UseBasicParsing).Content
```
#### 其他安装方式
如果不想使用脚本安装,也可以点击查看 [安装文档](https://xmake.io/#/zh-cn/guide/installation),了解其他安装方法。
## 简单的工程描述
```lua
target("hello")
set_kind("binary")
add_files("src/*.cpp")
```
## 包依赖描述
```lua
add_requires("tbox 1.6.*", "zlib", "libpng ~1.6")
```
官方的xmake包管理仓库: [xmake-repo](https://github.com/xmake-io/xmake-repo)
<img src="https://github.com/xmake-io/xmake-docs/raw/master/assets/img/index/package.gif" width="650px" />
## 命令行使用
### 创建工程
```bash
$ xmake create hello
$ cd hello
```
### 构建工程
```bash
$ xmake
```
### 运行目标
```bash
$ xmake run console
```
### 调试程序
```bash
$ xmake run -d console
```
### 运行测试
```bash
$ xmake test
```
### 配置平台
```bash
$ xmake f -p [windows|linux|macosx|android|iphoneos ..] -a [x86|arm64 ..] -m [debug|release]
$ xmake
```
### 图形化菜单配置
```bash
$ xmake f --menu
```
<img src="https://xmake.io/assets/img/index/menuconf.png" width="650px" />
## 跟ninja一样快的构建速度
测试工程: [xmake-core](https://github.com/xmake-io/xmake/tree/master/core)
### 多任务并行编译测试
| 构建系统 | Termux (8core/-j12) | 构建系统 | 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 |
### 单任务编译测试
| 构建系统 | Termux (-j1) | 构建系统 | 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 |
## 包依赖管理
### 架构和流程
<img src="https://xmake.io/assets/img/index/package_arch.png" width="650px" />
### 支持的包管理仓库
* 官方自建仓库 [xmake-repo](https://github.com/xmake-io/xmake-repo) (tbox >1.6.1)
* 官方包管理器 [Xrepo](https://github.com/xmake-io/xrepo)
* [用户自建仓库](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)
* 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)
### 包管理特性
* 官方仓库提供近 800+ 常用包,真正做到全平台一键下载集成编译
* 全平台包支持,支持交叉编译的依赖包集成
* 支持包虚拟环境管理和加载,`xrepo env shell`
* Windows 云端预编译包加速
* 支持自建包仓库,私有仓库部署
* 第三方包仓库支持,提供更加丰富的包源,例如:vcpkg, conan, conda 等等
* 支持自动拉取使用云端工具链
* 支持包依赖锁定
## 支持平台
* Windows (x86, x64, arm, arm64, arm64ec)
* macOS (i386, x86_64, arm64)
* Linux (i386, x86_64, arm, arm64, riscv, mips, 390x, sh4 ...)
* *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)
* AppleXROS (arm64, x86_64)
* MSYS (i386, x86_64)
* MinGW (i386, x86_64, arm, arm64)
* Cygwin (i386, x86_64)
* Wasm (wasm32, wasm64)
* Haiku (i386, x86_64)
* Harmony (x86_64, armeabi-v7a, arm64-v8a)
* Cross (cross-toolchains ..)
## 支持工具链
```bash
$ xmake show -l toolchains
xcode Xcode IDE
msvc Microsoft Visual C/C++ Compiler
clang-cl LLVM Clang C/C++ Compiler compatible with msvc
yasm The Yasm Modular Assembler
clang A C language family frontend for LLVM
go Go Programming Language Compiler
dlang D Programming Language Compiler (Auto)
dmd D Programming Language Compiler
ldc The LLVM-based D Compiler
gdc The GNU D Compiler (GDC)
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
ifx Intel LLVM 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
icx Intel LLVM C/C++ Compiler
dpcpp Intel LLVM C++ Compiler for data parallel programming model based on Khronos SYCL
masm32 The MASM32 SDK
iverilog Icarus Verilog
verilator Verilator open-source SystemVerilog simulator and lint system
cosmocc build-once run-anywhere
hdk Harmony SDK
```
## 支持语言
* C/C++
* Objc/Objc++
* Swift
* Assembly
* Golang
* Rust
* Dlang
* Fortran
* Cuda
* Zig
* Vala
* Pascal
* Nim
* Verilog
* FASM
* NASM
* YASM
* MASM32
* Cppfront
## 支持特性
* 语法简单易上手
* 快速安装,无任何依赖
* 全平台一键编译
* 支持交叉编译,智能分析交叉工具链信息
* 极速,多任务并行编译支持
* C++20 Module 支持
* 支持跨平台的 C/C++ 依赖包快速集成,内置包管理器
* 多语言混合编译支持
* 丰富的插件支持,提供各种工程生成器,例如:vs/makefile/cmakelists/compile_commands 生成插件
* REPL 交互式执行支持
* 增量编译支持,头文件依赖自动分析
* 工具链的快速切换、定制化支持
* 丰富的扩展模块支持
* 远程编译支持
* 分布式编译支持
* 内置的本地和远程编译缓存支持
## 工程类型
* 静态库程序
* 动态库类型
* 控制台程序
* Cuda 程序
* Qt 应用程序
* WDK Windows 驱动程序
* WinSDK 应用程序
* MFC 应用程序
* iOS/MacOS 应用程序(支持.metal)
* Framework和Bundle程序(iOS/MacOS)
* SWIG/Pybind11 模块 (Lua, python, ...)
* Luarocks 模块
* Protobuf 程序
* Lex/yacc 程序
* C++20 模块
* Linux 内核驱动模块
* Keil MDK/C51 嵌入式程序
* Verilog 仿真程序
## 分布式编译和缓存
- [x] 跨平台支持
- [x] 支持 msvc, clang, gcc 和交叉编译工具链
- [x] 支持构建 android, ios, linux, win, macOS 程序
- [x] 除了编译工具链,无任何其他依赖
- [x] 支持编译服务器负载均衡调度
- [x] 支持大文件实时压缩传输 (lz4)
- [x] 几乎零配置成本,无需共享文件系统,更加方便和安全
关于分布式编译和缓存,可以见下面的文档。
- [分布式编译](https://xmake.io/#/zh-cn/features/distcc_build)
- [编译缓存](https://xmake.io/#/zh-cn/features/build_cache)
## 远程编译
更多详情见:[远程编译](https://xmake.io/#/zh-cn/features/remote_build)
## 更多例子
#### Debug 和 Release 模式
```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
```
#### 自定义脚本
```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)
```
#### 依赖包自动集成
下载和使用在 [xmake-repo](https://github.com/xmake-io/xmake-repo) 和第三方包仓库的依赖包:
```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")
```
另外,我们也可以使用 [xrepo](https://github.com/xmake-io/xrepo) 命令来快速安装依赖包。
#### Qt QuickApp 应用程序
```lua
target("test")
add_rules("qt.quickapp")
add_files("src/*.cpp")
add_files("src/qml.qrc")
```
#### Cuda 程序
```lua
target("test")
set_kind("binary")
add_files("src/*.cu")
add_cugencodes("native")
add_cugencodes("compute_35")
```
#### WDK/UMDF 驱动程序
```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")
```
更多WDK驱动程序例子(umdf/kmdf/wdm),见:[WDK工程例子](https://xmake.io/#/zh-cn/guide/project_examples?id=wdk%e9%a9%b1%e5%8a%a8%e7%a8%8b%e5%ba%8f)
#### iOS/MacOS 应用程序
```lua
target("test")
add_rules("xcode.application")
add_files("src/*.m", "src/**.storyboard", "src/*.xcassets")
add_files("src/Info.plist")
```
#### Framework 和 Bundle 程序(iOS/MacOS)
```lua
target("test")
add_rules("xcode.framework") -- 或者 xcode.bundle
add_files("src/*.m")
add_files("src/Info.plist")
```
#### OpenMP 程序
```lua
add_requires("libomp", {optional = true})
target("loop")
set_kind("binary")
add_files("src/*.cpp")
add_rules("c++.openmp")
add_packages("libomp")
```
#### Zig 程序
```lua
target("test")
set_kind("binary")
add_files("src/main.zig")
```
### 自动拉取远程工具链
#### 拉取指定版本的 llvm 工具链
我们使用 llvm-10 中的 clang 来编译项目。
```lua
add_requires("llvm 10.x", {alias = "llvm-10"})
target("test")
set_kind("binary")
add_files("src/*.c")
set_toolchains("llvm@llvm-10")
````
#### 拉取交叉编译工具链
我们也可以拉取指定的交叉编译工具链来编译项目。
```lua
add_requires("muslcc")
target("test")
set_kind("binary")
add_files("src/*.c")
set_toolchains("@muslcc")
```
#### 拉取工具链并且集成对应工具链编译的依赖包
我们也可以使用指定的muslcc交叉编译工具链去编译和集成所有的依赖包。
```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")
```
## 插件
#### 生成IDE工程文件插件(makefile, vs2002 - vs2022, ...)
```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
```
#### 加载自定义lua脚本插件
```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
}
```
更多内置插件见相关文档:[内置插件文档](https://xmake.io/#/zh-cn/plugin/builtin_plugins)
其他扩展插件,请到插件仓库进行下载安装: [xmake-plugins](https://github.com/xmake-io/xmake-plugins).
## IDE和编辑器插件
* [xmake-vscode](https://github.com/xmake-io/xmake-vscode)
<img src="https://raw.githubusercontent.com/xmake-io/xmake-vscode/master/res/problem.gif" width="650px" />
* [xmake-sublime](https://github.com/xmake-io/xmake-sublime)
<img src="https://raw.githubusercontent.com/xmake-io/xmake-sublime/master/res/problem.gif" width="650px" />
* [xmake-idea](https://github.com/xmake-io/xmake-idea)
<img src="https://raw.githubusercontent.com/xmake-io/xmake-idea/master/res/problem.gif" width="650px" />
* [xmake.vim](https://github.com/luzhlon/xmake.vim) (third-party, thanks [@luzhlon](https://github.com/luzhlon))
* [xmake-visualstudio](https://github.com/HelloWorld886/xmake-visualstudio) (third-party, thanks [@HelloWorld886](https://github.com/HelloWorld886))
* [xmake-qtcreator](https://github.com/Arthapz/xmake-project-manager) (third-party, thanks [@Arthapz](https://github.com/Arthapz))
### XMake Gradle插件 (JNI)
我们也可以在Gradle中使用[xmake-gradle](https://github.com/xmake-io/xmake-gradle)插件来集成编译JNI库
```
plugins {
id 'org.tboox.gradle-xmake-plugin' version '1.1.5'
}
android {
externalNativeBuild {
xmake {
path "jni/xmake.lua"
}
}
}
```
当`gradle-xmake-plugin`插件被应用生效后,`xmakeBuild`任务会自动注入到现有的`assemble`任务中去,自动执行jni库编译和集成。
```console
$ ./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
```
## CI 集成
### GitHub Action
我们可以使用 [github-action-setup-xmake](https://github.com/xmake-io/github-action-setup-xmake) 在 Github Action 上实现跨平台安装集成 Xmake。
```
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
```
## 谁在使用 Xmake?
请点击 [用户列表](https://xmake.io/#/zh-cn/about/who_is_using_xmake) 查看完整用户使用列表。
如果您在使用 xmake,也欢迎通过 PR 将信息提交至上面的列表,让更多的用户了解有多少用户在使用 xmake,也能让用户更加安心使用 xmake。
我们也会有更多的动力去持续投入,让 xmake 项目和社区更加繁荣。
## 联系方式
* 邮箱:[[email protected]](mailto:[email protected])
* 主页:[xmake.io](https://xmake.io/#/zh-cn/)
* 社区
- [Reddit论坛](https://www.reddit.com/r/xmake/)
- [Telegram群组](https://t.me/tbooxorg)
- [Discord聊天室](https://discord.gg/xmake)
- QQ群:343118190, 662147501
* 源码:[Github](https://github.com/xmake-io/xmake), [Gitee](https://gitee.com/tboox/xmake)
* 微信公众号:tboox-os
## 感谢
感谢所有对xmake有所[贡献](CONTRIBUTING.md)的人:
<a href="https://github.com/xmake-io/xmake/graphs/contributors"><img src="https://opencollective.com/xmake/contributors.svg?width=890&button=false" /></a>
* [TitanSnow](https://github.com/TitanSnow): 提供xmake [logo](https://github.com/TitanSnow/ts-xmake-logo) 和安装脚本。
* [uael](https://github.com/uael): 提供语义版本跨平台c库 [sv](https://github.com/uael/sv)。
* [OpportunityLiu](https://github.com/OpportunityLiu): 改进cuda构建, tests框架和ci。
* [xq144](https://github.com/xq114): 改进 `xrepo env shell`,并贡献大量包到 [xmake-repo](https://github.com/xmake-io/xmake-repo) 仓库。
|
0 | repos | repos/xmake/LICENSE.md |
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2015-present TBOOX Open Source Group
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
0 | repos/xmake | repos/xmake/tests/run.lua | -- imports
import("core.base.task")
import("core.base.option")
import("runner", {rootdir = os.scriptdir()})
function _run_test(script)
runner(script)
end
-- run test with the given name
function _run_test_filter(name)
local tests = {}
local root = path.absolute(os.scriptdir())
for _, script in ipairs(os.files(path.join(root, "**", name, "**", "test.lua"))) do
if not script:find(".xmake", 1, true) then
table.insert(tests, path.absolute(script))
end
end
for _, script in ipairs(os.files(path.join(root, name, "**", "test.lua"))) do
if not script:find(".xmake", 1, true) then
table.insert(tests, path.absolute(script))
end
end
for _, script in ipairs(os.files(path.join(root, "**", name, "test.lua"))) do
table.insert(tests, path.absolute(script))
end
for _, script in ipairs(os.files(path.join(root, name, "test.lua"))) do
table.insert(tests, path.absolute(script))
end
tests = table.unique(tests)
if #tests == 0 then
utils.warning("no test have run, please check your filter .. (%s)", name)
else
cprint("> %d test(s) found", #tests)
if option.get("diagnosis") then
for _, v in ipairs(tests) do
cprint("> %s", v)
end
end
for _, v in ipairs(tests) do
_run_test(v)
end
cprint("> %d test(s) succeed", #tests)
end
end
function main(name)
return _run_test_filter(name or "/")
end
|
0 | repos/xmake | repos/xmake/tests/runner.lua | import("core.base.option")
import("test_utils.context", { alias = "test_context" })
function main(script)
if os.isdir(script) then
script = path.join(script, "test.lua")
end
script = path.absolute(script)
assert(path.filename(script) == "test.lua", "file should named `test.lua`")
assert(os.isfile(script), "should be a file")
-- disable statistics
os.setenv("XMAKE_STATS", "false")
-- init test context
local context = test_context(script)
local root = path.directory(script)
local verbose = option.get("verbose") or option.get("diagnosis")
-- trace
cprint(">> testing %s ...", path.relative(root))
-- get test functions
local data = import("test", { rootdir = root, anonymous = true })
if data.main then
-- ignore everthing when we found a main function
data = { test_main = data.main }
end
-- enter script directory
local old_dir = os.cd(root)
-- run test
local succeed_count = 0
for k, v in pairs(data) do
if k:startswith("test") and type(v) == "function" then
if verbose then print(">> running %s ...", k) end
context.func = v
context.funcname = k
local result = try
{
function ()
-- set workdir for each test
os.cd(root)
return v(context)
end,
catch
{
function (errors)
if errors then
errors = tostring(errors)
end
if errors and not errors:find("aborting because of ") then
context:print_error(errors, v, "unhandled error")
else
raise(errors)
end
end
}
}
if context:is_skipped(result) then
print(">> skipped %s : %s", k, result.reason)
end
succeed_count = succeed_count + 1
end
end
if verbose then print(">> finished %d test method(s) ...", succeed_count) end
-- leave script directory
os.cd(old_dir)
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/table/test.lua | function test_remove_if(t)
t:are_equal(table.remove_if({1, 2, 3, 4, 5, 6}, function (i, v) return (v % 2) == 0 end), {1, 3, 5})
t:are_equal(table.remove_if({a = 1, b = 2, c = 3}, function (i, v) return (v % 2) == 0 end), {a = 1, c = 3})
end
function test_find_if(t)
t:are_equal(table.find_if({1, 2, 3, 4, 5, 6}, function (i, v) return (v % 2) == 0 end), {2, 4, 6})
t:are_equal(table.find_first_if({1, 2, 3, 4, 5, 6}, function (i, v) return (v % 2) == 0 end), 2)
t:are_equal(table.find({1, 2, 4, 4, 5, 6}, 4), {3, 4})
t:are_equal(table.find_first({1, 2, 3, 4, 5, 6}, 4), 4)
end
function test_wrap(t)
t:are_equal(table.wrap(1), {1})
t:are_equal(table.wrap(nil), {})
t:are_equal(table.wrap({}), {})
t:are_equal(table.wrap({1}), {1})
t:are_equal(table.wrap({{}}), {{}})
local a = table.wrap_lock({1})
t:are_equal(table.wrap({a}), {a})
end
function test_unwrap(t)
t:are_equal(table.unwrap(1), 1)
t:are_equal(table.unwrap(nil), nil)
t:are_equal(table.unwrap({}), {})
t:are_equal(table.unwrap({1}), 1)
t:are_equal(table.unwrap({{}}), {})
local a = table.wrap_lock({1})
t:are_equal(table.unwrap(a), a)
end
function test_orderkeys(t)
-- sort by modulo 2 then from the smallest to largest
local f = function(a, b)
if a % 2 == 0 and b % 2 ~= 0 then
return true
elseif b % 2 == 0 and a % 2 ~= 0 then
return false
end
return a < b
end
t:are_equal(table.orderkeys({[2] = 2, [1] = 1, [4] = 4, [3] = 3}, f), {2, 4, 1, 3})
t:are_equal(table.orderkeys({[1] = 1, [2] = 2, [3] = 3, [4] = 4}), {1, 2 , 3, 4})
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/os/cpuinfo.lua | function main()
print(os.cpuinfo())
while true do
print("total: %d%%", math.floor(os.cpuinfo("usagerate") * 100))
os.sleep(1000)
end
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/os/meminfo.lua | function main()
while true do
print("%d%%", math.floor(os.meminfo("usagerate") * 100))
os.sleep(1000)
end
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/os/test.lua | function test_cpdir(t)
-- get mclock
local tm = os.mclock()
-- test cpdir
os.mkdir("test1")
t:require(os.exists("test1"))
os.cp("test1","test2")
t:require(os.exists("test2"))
os.rmdir("test1")
t:require_not(os.exists("test1"))
io.writefile("test2/awd","awd")
os.rmdir("test2")
t:require_not(os.exists("test2"))
-- assert mclock
t:require(os.mclock() >= tm)
end
function test_rename(t)
-- get mclock
local tm = os.mclock()
-- test rename
os.mkdir("test1")
t:require(os.exists("test1"))
os.mv("test1","test2")
t:require_not(os.exists("test1"))
t:require(os.exists("test2"))
os.rmdir("test2")
t:require_not(os.exists("test2"))
-- assert mclock
t:require(os.mclock() >= tm)
end
function test_cp_mvdir_into_another_dir(t)
-- get mclock
local tm = os.mclock()
-- test cp/mvdir into another dir
os.mkdir("test1")
os.mkdir("test2")
t:require(os.exists("test1"))
t:require(os.exists("test2"))
os.cp("test1","test2")
t:require(os.exists("test2/test1"))
os.mv("test1","test2/test1")
t:require_not(os.exists("test1"))
t:require(os.exists("test2/test1/test1"))
os.rmdir("test2")
t:require_not(os.exists("test2"))
-- assert mclock
t:require(os.mclock() >= tm)
end
function test_cp_symlink(t)
if is_host("windows") then
return
end
os.touch("test1")
os.ln("test1", "test2")
t:require(os.isfile("test1"))
t:require(os.isfile("test2"))
t:require(os.islink("test2"))
os.cp("test2", "test3")
t:require(os.isfile("test3"))
t:require(not os.islink("test3"))
os.cp("test2", "test4", {symlink = true})
t:require(os.isfile("test4"))
t:require(os.islink("test4"))
os.mkdir("dir")
os.touch("dir/test1")
os.cd("dir")
os.ln("test1", "test2")
os.cd("-")
t:require(os.islink("dir/test2"))
os.cp("dir", "dir2")
t:require(not os.islink("dir2/test2"))
os.cp("dir", "dir3", {symlink = true})
t:require(os.islink("dir3/test2"))
os.tryrm("test1")
os.tryrm("test2")
os.tryrm("test3")
os.tryrm("test4")
os.tryrm("dir")
os.tryrm("dir2")
os.tryrm("dir3")
t:require(not os.exists("test1"))
t:require(not os.exists("test2"))
t:require(not os.exists("dir"))
end
function test_setenv(t)
-- get mclock
local tm = os.mclock()
-- test setenv
os.setenv("__AWD","DWA")
t:are_equal(os.getenv("__AWD"), "DWA")
os.setenv("__AWD","DWA2")
t:are_equal(os.getenv("__AWD"), "DWA2")
-- assert mclock
t:require(os.mclock() >= tm)
end
function test_argv(t)
t:are_equal(os.argv(""), {})
-- $cli aa bb cc
t:are_equal(os.argv("aa bb cc"), {"aa", "bb", "cc"})
-- $cli aa --bb=bbb -c
t:are_equal(os.argv("aa --bb=bbb -c"), {"aa", "--bb=bbb", "-c"})
-- $cli "aa bb cc" dd
t:are_equal(os.argv('"aa bb cc" dd'), {"aa bb cc", "dd"})
-- $cli aa(bb)cc dd
t:are_equal(os.argv('aa(bb)cc dd'), {"aa(bb)cc", "dd"})
-- $cli aa\\bb/cc dd
t:are_equal(os.argv('aa\\bb/cc dd'), {"aa\\bb/cc", "dd"})
-- $cli "aa\\bb/cc dd" ee
t:are_equal(os.argv('"aa\\\\bb/cc dd" ee'), {"aa\\bb/cc dd", "ee"})
-- $cli "aa\\bb/cc (dd)" ee
t:are_equal(os.argv('"aa\\\\bb/cc (dd)" ee'), {"aa\\bb/cc (dd)", "ee"})
-- $cli -DTEST=\"hello\"
t:are_equal(os.argv('-DTEST=\\"hello\\"'), {'-DTEST="hello"'})
-- $cli -DTEST=\"hello\" -DTEST=\"hello\"
t:are_equal(os.argv('-DTEST=\\"hello\\" -DTEST2=\\"hello\\"'), {'-DTEST="hello"', '-DTEST2="hello"'})
-- $cli -DTEST="hello"
t:are_equal(os.argv('-DTEST="hello"'), {'-DTEST=hello'})
-- $cli -DTEST="hello world"
t:are_equal(os.argv('-DTEST="hello world"'), {'-DTEST=hello world'})
-- $cli -DTEST=\"hello world\"
t:are_equal(os.argv('-DTEST=\\"hello world\\"'), {'-DTEST="hello', 'world\"'})
-- $cli "-DTEST=\"hello world\"" "-DTEST2="\hello world2\""
t:are_equal(os.argv('"-DTEST=\\\"hello world\\\"" "-DTEST2=\\\"hello world2\\\""'), {'-DTEST="hello world"', '-DTEST2="hello world2"'})
-- $cli '-DTEST="hello world"' '-DTEST2="hello world2"'
t:are_equal(os.argv("'-DTEST=\"hello world\"' '-DTEST2=\"hello world2\"'"), {'-DTEST="hello world"', '-DTEST2="hello world2"'})
-- only split
t:are_equal(os.argv('-DTEST="hello world"', {splitonly = true}), {'-DTEST="hello world"'})
t:are_equal(os.argv('-DTEST="hello world" -DTEST2="hello world2"', {splitonly = true}), {'-DTEST="hello world"', '-DTEST2="hello world2"'})
end
function test_args(t)
t:are_equal(os.args({}), "")
t:are_equal(os.args({"aa", "bb", "cc"}), "aa bb cc")
t:are_equal(os.args({"aa", "--bb=bbb", "-c"}), "aa --bb=bbb -c")
t:are_equal(os.args({"aa bb cc", "dd"}), '"aa bb cc" dd')
t:are_equal(os.args({"aa(bb)cc", "dd"}), 'aa(bb)cc dd')
t:are_equal(os.args({"aa\\bb/cc", "dd"}), "aa\\bb/cc dd")
t:are_equal(os.args({"aa\\bb/cc dd", "ee"}), '"aa\\\\bb/cc dd" ee')
t:are_equal(os.args({"aa\\bb/cc (dd)", "ee"}), '"aa\\\\bb/cc (dd)" ee')
t:are_equal(os.args({"aa\\bb/cc", "dd"}, {escape = true}), "aa\\\\bb/cc dd")
t:are_equal(os.args('-DTEST="hello"'), '-DTEST=\\"hello\\"')
t:are_equal(os.args({'-DTEST="hello"', '-DTEST2="hello"'}), '-DTEST=\\"hello\\" -DTEST2=\\"hello\\"')
t:are_equal(os.args('-DTEST=hello'), '-DTEST=hello') -- irreversible
t:are_equal(os.args({'-DTEST="hello world"', '-DTEST2="hello world2"'}), '"-DTEST=\\\"hello world\\\"" "-DTEST2=\\\"hello world2\\\""')
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/signal/sigint.lua | import("core.base.signal")
function main()
signal.register(signal.SIGINT, function (signo)
print("signal.SIGINT(%d)", signo)
end)
io.read()
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/cache/test.lua | import("core.cache.memcache")
import("core.cache.localcache")
import("core.cache.globalcache")
function test_memcache(t)
memcache.set("mycache", "xyz", {1, 2, 3})
memcache.set2("mycache", "foo", "bar", "1")
t:are_equal(memcache.get("mycache", "xyz"), {1, 2, 3})
t:are_equal(memcache.get2("mycache", "foo", "bar"), "1")
memcache.clear("mycache")
t:are_equal(memcache.get2("mycache", "foo", "bar"), nil)
memcache.set2("mycache", "foo", "bar", "1")
memcache.clear()
t:are_equal(memcache.get("mycache", "xyz"), nil)
t:are_equal(memcache.get2("mycache", "foo", "bar"), nil)
end
function test_localcache(t)
localcache.set("mycache", "xyz", {1, 2, 3})
localcache.set2("mycache", "foo", "bar", "1")
t:are_equal(localcache.get("mycache", "xyz"), {1, 2, 3})
t:are_equal(localcache.get2("mycache", "foo", "bar"), "1")
localcache.clear("mycache")
t:are_equal(localcache.get2("mycache", "foo", "bar"), nil)
localcache.set2("mycache", "foo", "bar", "1")
localcache.clear()
t:are_equal(localcache.get("mycache", "xyz"), nil)
t:are_equal(localcache.get2("mycache", "foo", "bar"), nil)
end
function test_globalcache(t)
globalcache.set("mycache", "xyz", {1, 2, 3})
globalcache.set2("mycache", "foo", "bar", "1")
t:are_equal(globalcache.get("mycache", "xyz"), {1, 2, 3})
t:are_equal(globalcache.get2("mycache", "foo", "bar"), "1")
globalcache.clear("mycache")
t:are_equal(globalcache.get2("mycache", "foo", "bar"), nil)
globalcache.set2("mycache", "foo", "bar", "1")
globalcache.clear()
t:are_equal(globalcache.get("mycache", "xyz"), nil)
t:are_equal(globalcache.get2("mycache", "foo", "bar"), nil)
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/sched_tcp/file_client.lua | import("core.base.socket")
import("core.base.scheduler")
import("core.base.bytes")
function _session(addr, port)
print("connect %s:%d ..", addr, port)
local sock = socket.connect(addr, port)
print("%s: connected!", sock)
local real = 0
local recv = 0
local data = nil
local wait = false
local buff = bytes(8192)
while true do
real, data = sock:recv(buff, 8192)
if real > 0 then
recv = recv + real
wait = false
elseif real == 0 and not wait then
if sock:wait(socket.EV_RECV, -1) == socket.EV_RECV then
wait = true
else
break
end
else
break
end
end
print("%s: recv ok, size: %d!", sock, recv)
sock:close()
end
function main(count)
count = count and tonumber(count) or 1
for i = 1, count do
scheduler.co_start(_session, "127.0.0.1", 9092)
end
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/sched_tcp/echo_client.lua | import("core.base.bytes")
import("core.base.socket")
import("core.base.scheduler")
function _session_recv(sock)
print("%s: recv ..", sock)
local count = 0
local result = nil
local buff = bytes(8192)
while count < 100000 do
local recv, data = sock:recv(buff, 13, {block = true})
if recv > 0 then
result = data
count = count + 1
else
break
end
end
print("%s: recv ok, count: %d!", sock, count)
if result then
result:dump()
end
end
function _session_send(sock)
print("%s: send ..", sock)
local count = 0
while count < 100000 do
local send = sock:send("hello world..", {block = true})
if send > 0 then
count = count + 1
else
break
end
end
print("%s: send ok, count: %d!", sock, count)
end
local socks = {}
function _session(addr, port)
print("connect %s:%d ..", addr, port)
local sock = socket.connect(addr, port)
if sock then
print("%s: connected!", sock)
table.insert(socks, sock)
sock:ctrl(socket.CTRL_SET_SENDBUFF, 6000000)
sock:ctrl(socket.CTRL_SET_RECVBUFF, 6000000)
scheduler.co_group_begin("test", function ()
scheduler.co_start(_session_recv, sock)
scheduler.co_start(_session_send, sock)
end)
else
print("connect %s:%d failed", addr, port)
end
end
function main(count)
count = count and tonumber(count) or 1
scheduler.co_group_begin("test", function ()
for i = 1, count do
scheduler.co_start(_session, "127.0.0.1", 9091)
end
end)
scheduler.co_group_wait("test")
for _, sock in ipairs(socks) do
sock:close()
end
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/sched_tcp/echo_server.lua | import("core.base.bytes")
import("core.base.socket")
import("core.base.scheduler")
function _session_recv(sock)
print("%s: recv ..", sock)
local count = 0
local result = nil
local buff = bytes(8192)
while count < 100000 do
local recv, data = sock:recv(buff, 13, {block = true})
if recv > 0 then
result = data
count = count + 1
else
break
end
end
print("%s: recv ok, count: %d!", sock, count)
if result then
result:dump()
end
end
function _session_send(sock)
print("%s: send ..", sock)
local count = 0
while count < 100000 do
local send = sock:send("hello world..", {block = true})
if send > 0 then
count = count + 1
else
break
end
end
print("%s: send ok, count: %d!", sock, count)
end
function _listen(addr, port)
local sock_clients = {}
local sock = socket.bind(addr, port)
sock:listen(100)
print("%s: listening %s:%d ..", sock, addr, port)
while true do
local sock_client = sock:accept()
if sock_client then
print("%s: accepted", sock_client)
table.insert(sock_clients, sock_client)
sock_client:ctrl(socket.CTRL_SET_SENDBUFF, 6000000)
sock_client:ctrl(socket.CTRL_SET_RECVBUFF, 6000000)
scheduler.co_start(_session_recv, sock_client)
scheduler.co_start(_session_send, sock_client)
end
end
for _, sock_client in ipairs(sock_clients) do
sock_client:close()
end
sock:close()
end
function main()
scheduler.co_start(_listen, "127.0.0.1", 9091)
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/sched_tcp/file_server.lua | import("core.base.socket")
import("core.base.scheduler")
function _session(sock, filepath)
local file = io.open(filepath, 'rb')
if file then
local send = sock:sendfile(file, {block = true})
print("%s: send %s %d bytes!", sock, filepath, send)
file:close()
end
sock:close()
end
function _listen(addr, port, filepath)
local sock = socket.bind(addr, port)
sock:listen(100)
print("%s: listening %s:%d ..", sock, addr, port)
while true do
local sock_client = sock:accept()
if sock_client then
print("%s: accepted", sock_client)
scheduler.co_start(_session, sock_client, filepath)
end
end
sock:close()
end
function main(filepath)
scheduler.co_start(_listen, "127.0.0.1", 9092, filepath)
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/udp/echo_client.lua | import("core.base.bytes")
import("core.base.socket")
function main(data)
local addr = "127.0.0.1"
local port = 9091
local buff = bytes(8192)
local sock = socket.udp()
local send = sock:sendto(data or "hello xmake!", addr, port, {block = true})
print("%s: send to %s:%d %d bytes!", sock, addr, port, send)
local recv, data, peer_addr, peer_port = sock:recvfrom(buff, 8112, {block = true})
if recv > 0 then
print("%s: recv %d bytes from %s:%d", sock, recv, peer_addr, peer_port)
data:dump()
end
sock:close()
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/udp/echo_server.lua | import("core.base.bytes")
import("core.base.socket")
function main()
local addr = "127.0.0.1"
local port = 9091
local sock = socket.udp()
local buff = bytes(8192)
sock:bind(addr, port)
while true do
print("%s: recv in %s:%d ..", sock, addr, port)
local recv, data, peer_addr, peer_port = sock:recvfrom(buff, 8192, {block = true})
print("%s: recv %d bytes from: %s:%d", sock, recv, peer_addr, peer_port)
if data then
data:dump()
sock:sendto(data, peer_addr, peer_port)
end
end
sock:close()
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/sched_udp/echo_client.lua | import("core.base.bytes")
import("core.base.socket")
import("core.base.scheduler")
function _session(addr, port, data)
local buff = bytes(8192)
local sock = socket.udp()
local send = sock:sendto(data or "hello xmake!", addr, port, {block = true})
print("%s: send to %s:%d %d bytes!", sock, addr, port, send)
local recv, data, peer_addr, peer_port = sock:recvfrom(buff, 8112, {block = true})
if recv > 0 then
print("%s: recv %d bytes from %s:%d", sock, recv, peer_addr, peer_port)
data:dump()
end
sock:close()
end
function main(data)
scheduler.co_start(_session, "127.0.0.1", 9091, data)
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/sched_udp/echo_server.lua | import("core.base.bytes")
import("core.base.socket")
import("core.base.scheduler")
function _listen(addr, port)
local buff = bytes(8192)
local sock = socket.udp()
sock:bind(addr, port)
while true do
print("%s: recv in %s:%d ..", sock, addr, port)
local recv, data, peer_addr, peer_port = sock:recvfrom(buff, 8192, {block = true})
print("%s: recv %d bytes from: %s:%d", sock, recv, peer_addr, peer_port)
if data then
data:dump()
sock:sendto(data, peer_addr, peer_port)
end
end
sock:close()
end
function main()
scheduler.co_start(_listen, "127.0.0.1", 9091)
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/tcp/file_client.lua | import("core.base.socket")
import("core.base.bytes")
function main()
local addr = "127.0.0.1"
local port = 9092
print("connect %s:%d ..", addr, port)
local sock = socket.connect(addr, port)
print("%s: connected!", sock)
local real = 0
local recv = 0
local data = nil
local wait = false
local buff = bytes(8192)
while true do
real, data = sock:recv(buff, 8192)
if real > 0 then
recv = recv + real
wait = false
elseif real == 0 and not wait then
if sock:wait(socket.EV_RECV, -1) == socket.EV_RECV then
wait = true
else
break
end
else
break
end
end
print("%s: recv ok, size: %d!", sock, recv)
sock:close()
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/tcp/echo_client.lua | import("core.base.bytes")
import("core.base.socket")
function main()
local addr = "127.0.0.1"
local port = 9091
print("connect %s:%d ..", addr, port)
local sock = socket.connect(addr, port)
if sock then
print("%s: connected!", sock)
local count = 0
local buff = bytes(8192)
while count < 10000 do
local send = sock:send("hello world..", {block = true})
if send > 0 then
sock:recv(buff, 13, {block = true})
else
break
end
count = count + 1
end
print("%s: send ok, count: %d!", sock, count)
sock:close()
end
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/tcp/echo_server.lua | import("core.base.bytes")
import("core.base.socket")
function main()
local addr = "127.0.0.1"
local port = 9091
local sock = socket.bind(addr, port)
sock:listen(20)
print("%s: listening %s:%d ..", sock, addr, port)
while true do
local sock_client = sock:accept()
if sock_client then
print("%s: accepted", sock_client)
local count = 0
local result = nil
local buff = bytes(8192)
while true do
local recv, data = sock_client:recv(buff, 13, {block = true})
if recv > 0 then
result = data
sock_client:send(data, {block = true})
count = count + 1
else
break
end
end
print("%s: recv: %d, count: %d", sock_client, result and result:size() or 0, count)
if result then
result:dump()
end
sock_client:close()
end
end
sock:close()
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/tcp/file_server.lua | import("core.base.socket")
function main(filepath)
local addr = "127.0.0.1"
local port = 9092
local sock = socket.bind(addr, port)
sock:listen(20)
print("%s: listening %s:%d ..", sock, addr, port)
while true do
local sock_client = sock:accept()
if sock_client then
print("%s: accepted", sock_client)
local file = io.open(filepath, 'rb')
if file then
local send = sock_client:sendfile(file, {block = true})
print("%s: send %s %d bytes!", sock_client, filepath, send)
file:close()
end
sock_client:close()
end
end
sock:close()
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/unix_tcp/file_client.lua | import("core.base.socket")
import("core.base.bytes")
function main(addr)
addr = addr or path.join(os.tmpdir(), "file.socket")
print("connect %s ..", addr)
local sock = socket.connect_unix(addr)
print("%s: connected!", sock)
local real = 0
local recv = 0
local data = nil
local wait = false
local buff = bytes(8192)
while true do
real, data = sock:recv(buff, 8192)
if real > 0 then
recv = recv + real
wait = false
elseif real == 0 and not wait then
if sock:wait(socket.EV_RECV, -1) == socket.EV_RECV then
wait = true
else
break
end
else
break
end
end
print("%s: recv ok, size: %d!", sock, recv)
sock:close()
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/unix_tcp/echo_client.lua | import("core.base.bytes")
import("core.base.socket")
function main(addr)
addr = addr or path.join(os.tmpdir(), "echo.socket")
print("connect %s ..", addr)
local buff = bytes(8192)
local sock = socket.connect_unix(addr)
if sock then
print("%s: connected!", sock)
local count = 0
while count < 10000 do
local send = sock:send("hello world..", {block = true})
if send > 0 then
sock:recv(buff, 13, {block = true})
else
break
end
count = count + 1
end
print("%s: send ok, count: %d!", sock, count)
sock:close()
end
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/unix_tcp/echo_server.lua | import("core.base.bytes")
import("core.base.socket")
function main(addr)
addr = addr or path.join(os.tmpdir(), "echo.socket")
os.tryrm(addr)
local sock = socket.bind_unix(addr)
sock:listen(20)
print("%s: listening %s ..", sock, addr)
while true do
local sock_client = sock:accept()
if sock_client then
print("%s: accepted", sock_client)
local count = 0
local result = nil
local buff = bytes(8192)
while true do
local recv, data = sock_client:recv(buff, 13, {block = true})
if recv > 0 then
result = data
sock_client:send(data, {block = true})
count = count + 1
else
break
end
end
print("%s: recv: %d, count: %d", sock_client, result and result:size() or 0, count)
if result then
result:dump()
end
sock_client:close()
end
end
sock:close()
end
|
0 | repos/xmake/tests/modules/socket | repos/xmake/tests/modules/socket/unix_tcp/file_server.lua | import("core.base.socket")
function main(filepath, addr)
addr = addr or path.join(os.tmpdir(), "file.socket")
local sock = socket.bind_unix(addr)
sock:listen(20)
print("%s: listening %s ..", sock, addr)
while true do
local sock_client = sock:accept()
if sock_client then
print("%s: accepted", sock_client)
local file = io.open(filepath, 'rb')
if file then
local send = sock_client:sendfile(file, {block = true})
print("%s: send %s %d bytes!", sock_client, filepath, send)
file:close()
end
sock_client:close()
end
end
sock:close()
end
|
0 | repos/xmake/tests/modules/private | repos/xmake/tests/modules/private/select_script/test.lua | import("private.core.base.select_script")
function _match_patterns(patterns, opt)
local scripts = {}
for _, pattern in ipairs(patterns) do
pattern = pattern:gsub("([%+%.%-%^%$%%])", "%%%1")
pattern = pattern:gsub("%*", "\001")
pattern = pattern:gsub("\001", ".*")
scripts[pattern] = true
end
return select_script(scripts, opt) == true
end
function test_plat_only(t)
t:require(_match_patterns("*", {plat = "macosx"}))
t:require(_match_patterns("macosx", {plat = "macosx"}))
t:require(_match_patterns("macosx,linux", {plat = "macosx"}))
t:require(_match_patterns("mac*", {plat = "macosx"}))
t:require_not(_match_patterns("macosx", {plat = "linux"}))
t:require_not(_match_patterns("linux", {plat = "macosx"}))
t:require_not(_match_patterns("!macosx", {plat = "macosx"}))
t:require_not(_match_patterns("!mac*", {plat = "macosx"}))
t:require(_match_patterns("!macosx", {plat = "linux"}))
t:require(_match_patterns("!macosx,!android", {plat = "linux"}))
t:require(_match_patterns("!mac*", {plat = "linux"}))
end
function test_plat_arch(t)
t:require(_match_patterns("!wasm|!arm*", {plat = "linux", arch = "x86_64"}))
t:require_not(_match_patterns("!wasm|!arm*", {plat = "linux", arch = "arm64"}))
t:require(_match_patterns("*|x86_64", {plat = "macosx", arch = "x86_64"}))
t:require(_match_patterns("macosx|x86_64", {plat = "macosx", arch = "x86_64"}))
t:require(_match_patterns("macosx|x86_64,linux|x86_64", {plat = "macosx", arch = "x86_64"}))
t:require(_match_patterns("macosx|x86_*", {plat = "macosx", arch = "x86_64"}))
t:require_not(_match_patterns("macosx|x86_64", {plat = "linux", arch = "x86_64"}))
t:require_not(_match_patterns("macosx|i386", {plat = "macosx", arch = "x86_64"}))
t:require_not(_match_patterns("!macosx|x86_64", {plat = "macosx", arch = "x86_64"}))
t:require_not(_match_patterns("!mac*|x86_64", {plat = "macosx", arch = "x86_64"}))
t:require(_match_patterns("!macosx|x86_64", {plat = "linux", arch = "x86_64"}))
t:require(_match_patterns("!mac*|x86_64", {plat = "linux", arch = "x86_64"}))
t:require(_match_patterns("macosx|!i386", {plat = "macosx", arch = "x86_64"}))
t:require(_match_patterns("!macosx|!i386", {plat = "linux", arch = "x86_64"}))
t:require(_match_patterns("windows|!x86", {plat = "windows", arch = "x64"}))
t:require_not(_match_patterns("windows|!x86", {plat = "android", arch = "arm64-v8a"}))
t:require(_match_patterns("macosx|native", {plat = "macosx", arch = "x86_64", subarch = "x86_64"}))
t:require(_match_patterns("macosx|!native", {plat = "macosx", arch = "arm64", subarch = "x86_64"}))
t:require_not(_match_patterns("macosx|!native", {plat = "macosx", arch = "x86_64", subarch = "x86_64"}))
t:require_not(_match_patterns("windows|native", {plat = "macosx", arch = "x86_64", subarch = "x86_64"}))
end
function test_subhost_only(t)
t:require(_match_patterns("@*", {subhost = "macosx"}))
t:require(_match_patterns("@macosx", {subhost = "macosx"}))
t:require(_match_patterns("@mac*", {subhost = "macosx"}))
t:require_not(_match_patterns("@macosx", {subhost = "linux"}))
t:require_not(_match_patterns("@linux", {subhost = "macosx"}))
t:require_not(_match_patterns("@!macosx", {subhost = "macosx"}))
t:require_not(_match_patterns("@!mac*", {subhost = "macosx"}))
t:require(_match_patterns("@!macosx", {subhost = "linux"}))
t:require(_match_patterns("@!mac*", {subhost = "linux"}))
end
function test_subhost_subarch(t)
t:require(_match_patterns("@*|x86_64", {subhost = "macosx", subarch = "x86_64"}))
t:require(_match_patterns("@macosx|x86_64", {subhost = "macosx", subarch = "x86_64"}))
t:require(_match_patterns("@macosx|x86_*", {subhost = "macosx", subarch = "x86_64"}))
t:require_not(_match_patterns("@macosx|x86_64", {subhost = "linux", subarch = "x86_64"}))
t:require_not(_match_patterns("@macosx|i386", {subhost = "macosx", subarch = "x86_64"}))
t:require_not(_match_patterns("@!macosx|x86_64", {subhost = "macosx", subarch = "x86_64"}))
t:require_not(_match_patterns("@!mac*|x86_64", {subhost = "macosx", subarch = "x86_64"}))
t:require(_match_patterns("@!macosx|x86_64", {subhost = "linux", subarch = "x86_64"}))
t:require(_match_patterns("@!mac*|x86_64", {subhost = "linux", subarch = "x86_64"}))
t:require(_match_patterns("@macosx|!i386", {subhost = "macosx", subarch = "x86_64"}))
t:require(_match_patterns("@!macosx|!i386", {subhost = "linux", subarch = "x86_64"}))
t:require(_match_patterns("@windows|!x86", {subhost = "windows", subarch = "x64"}))
t:require_not(_match_patterns("@windows|!x86", {subhost = "android", subarch = "arm64-v8a"}))
t:require(_match_patterns("@macosx|native", {subhost = "macosx", subarch = "x86_64"}))
t:require(_match_patterns("@macosx|native", {subhost = "macosx", subarch = "arm64"}))
t:require_not(_match_patterns("@macosx|!native", {subhost = "macosx", subarch = "x86_64"}))
t:require_not(_match_patterns("@windows|native", {subhost = "macosx", subarch = "x86_64"}))
end
function test_plat_subhost(t)
t:require(_match_patterns("*@macosx", {plat = "macosx", subhost = "macosx"}))
t:require(_match_patterns("android@macosx", {plat = "android", subhost = "macosx"}))
t:require(_match_patterns("android@macosx,linux", {plat = "android", subhost = "linux"}))
t:require(_match_patterns("android@mac*", {plat = "android", subhost = "macosx"}))
t:require(_match_patterns("android@!macosx", {plat = "android", subhost = "linux"}))
t:require_not(_match_patterns("!android@macosx", {plat = "android", subhost = "macosx"}))
t:require(_match_patterns("!iphon*@macosx", {plat = "linux", subhost = "macosx"}))
end
function test_plat_arch_subhost(t)
t:require(_match_patterns("*|x86_64@macosx", {plat = "macosx", subhost = "macosx", arch = "x86_64"}))
t:require(_match_patterns("android|arm64-v8a@macosx", {plat = "android", subhost = "macosx", arch = "arm64-v8a"}))
t:require(_match_patterns("android|x86_64@macosx,linux", {plat = "android", subhost = "linux", arch = "x86_64"}))
t:require(_match_patterns("android|x86_64@mac*", {plat = "android", subhost = "macosx", arch = "x86_64"}))
t:require(_match_patterns("android|x86_64@!macosx", {plat = "android", subhost = "linux", arch = "x86_64"}))
t:require_not(_match_patterns("!android|x86_64@macosx", {plat = "android", subhost = "macosx", arch = "x86_64"}))
t:require(_match_patterns("!iphon*|x86_64@macosx", {plat = "linux", subhost = "macosx", arch = "x86_64"}))
t:require(_match_patterns("iphon*|arm64@macosx", {plat = "iphoneos", subhost = "macosx", arch = "arm64"}))
t:require_not(_match_patterns("iphon*|arm64@macosx", {plat = "iphoneos", subhost = "linux", arch = "arm64"}))
end
function test_plat_arch_subhost_subarch(t)
t:require(_match_patterns("*|x86_64@macosx|x86_64", {plat = "macosx", subhost = "macosx", arch = "x86_64", subarch = "x86_64"}))
t:require(_match_patterns("android|arm64-v8a@macosx|x86_64", {plat = "android", subhost = "macosx", arch = "arm64-v8a", subarch = "x86_64"}))
t:require(_match_patterns("android|x86_64@macosx|x86_64,linux|x86_64", {plat = "android", subhost = "linux", arch = "x86_64", subarch = "x86_64"}))
t:require(_match_patterns("android|x86_64@mac*|x86_64", {plat = "android", subhost = "macosx", arch = "x86_64", subarch = "x86_64"}))
t:require(_match_patterns("android|x86_64@!macosx|x86_64", {plat = "android", subhost = "linux", arch = "x86_64", subarch = "x86_64"}))
t:require_not(_match_patterns("!android|x86_64@macosx|x86_64", {plat = "android", subhost = "macosx", arch = "x86_64", subarch = "x86_64"}))
t:require(_match_patterns("!iphon*|x86_64@macosx|x86_64", {plat = "linux", subhost = "macosx", arch = "x86_64", subarch = "x86_64"}))
t:require(_match_patterns("iphon*|arm64@macosx|x86_64", {plat = "iphoneos", subhost = "macosx", arch = "arm64", subarch = "x86_64"}))
t:require_not(_match_patterns("iphon*|arm64@macosx|x86_64", {plat = "iphoneos", subhost = "linux", arch = "arm64", subarch = "x86_64"}))
t:require(_match_patterns("android|native@macosx|x86_64", {plat = "android", subhost = "macosx", arch = "x86_64", subarch = "x86_64"}))
end
function test_logical_expr(t)
t:require(_match_patterns("!macosx|x86_64,!iphoneos|arm64", {plat = "linux", arch = "x86_64"}))
t:require(_match_patterns("!wasm|!arm* and !cross|!arm*", {plat = "linux", arch = "x86_64"}))
t:require_not(_match_patterns("!wasm|!arm* and !cross|!arm*", {plat = "linux", arch = "arm64"}))
t:require_not(_match_patterns("!wasm|!arm* and !cross|!arm*", {plat = "wasm", arch = "x86_64"}))
t:require(_match_patterns("!macosx|x86_64 or !iphoneos|arm64", {plat = "linux", arch = "x86_64"}))
t:require_not(_match_patterns("!android@macosx or !android@linux", {plat = "android", subhost = "macosx"}))
t:require(_match_patterns("@macosx|x86_64 or @linux|x86_64", {subhost = "macosx", subarch = "x86_64"}))
t:require(_match_patterns("@macosx or @linux", {subhost = "macosx"}))
t:require(_match_patterns("!wasm|!arm* or (!cross|!arm* or linux)", {plat = "linux", arch = "arm64"}))
t:require_not(_match_patterns("!wasm|!arm* or (!cross|!arm* and !linux)", {plat = "linux", arch = "arm64"}))
t:require_not(_match_patterns("!macosx|x86_64 and !linux|x86_64", {plat = "linux", arch = "x86_64"}))
t:require_not(_match_patterns("!macosx and !android", {plat = "android"}))
t:require_not(_match_patterns("!macosx and !android", {plat = "macosx"}))
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/bloom_filter/test.lua | import("core.base.bloom_filter")
function test_bloom_filter(t)
local filter = bloom_filter.new()
t:are_equal(filter:set("hello"), true) -- not found
t:are_equal(filter:set("hello"), false)
t:are_equal(filter:set("hello"), false)
t:are_equal(filter:get("hello"), true)
t:are_equal(filter:set("xmake"), true) -- not found
t:are_equal(filter:set("xmake"), false)
t:are_equal(filter:set("xmake"), false)
t:are_equal(filter:get("xmake"), true)
t:are_equal(filter:get("not exists"), false)
local data = filter:data()
local filter2 = bloom_filter.new()
filter2:data_set(data)
t:are_equal(filter2:get("hello"), true)
t:are_equal(filter2:get("xmake"), true)
t:are_equal(filter2:get("not exists"), false)
end
|
0 | repos/xmake/tests/modules/devel | repos/xmake/tests/modules/devel/git/test.lua | import("devel.git")
function test_asgiturl(t)
t:are_equal(git.asgiturl("http://github.com/a/b"), "https://github.com/a/b.git")
t:are_equal(git.asgiturl("http://github.com/a/b/"), "https://github.com/a/b.git")
t:are_equal(git.asgiturl("HTTP://github.com//a/b/"), "https://github.com/a/b.git")
t:are_equal(git.asgiturl("http://github.com//a/b/s"), nil)
t:are_equal(git.asgiturl("https://github.com/a/b"), "https://github.com/a/b.git")
t:are_equal(git.asgiturl("https://github.com/a/b.git"), "https://github.com/a/b.git")
t:are_equal(git.asgiturl("HTTPS://GITHUB.com/a/b.git.git"), "https://github.com/a/b.git.git")
t:are_equal(git.asgiturl("github:a/b"), "https://github.com/a/b.git")
t:are_equal(git.asgiturl("github:a/b.git"), "https://github.com/a/b.git.git")
t:are_equal(git.asgiturl("GitHub://a/b/"), "https://github.com/a/b.git")
t:are_equal(git.asgiturl("github:a/b/c"), nil)
end |
0 | repos/xmake/tests/modules/lib | repos/xmake/tests/modules/lib/detect/test.lua | import("lib.detect.find_toolname")
function test_find_toolname(t)
t:are_equal(find_toolname("xcrun -sdk macosx clang"), "clang")
t:are_equal(find_toolname("xcrun -sdk macosx clang++"), "clangxx")
t:are_equal(find_toolname("/usr/bin/arm-linux-gcc"), "gcc")
t:are_equal(find_toolname("/usr/bin/arm-linux-g++"), "gxx")
t:are_equal(find_toolname("/usr/bin/arm-linux-ar"), "ar")
t:are_equal(find_toolname("link.exe -lib"), "link")
t:are_equal(find_toolname("arm-android-clang++"), "clangxx")
t:are_equal(find_toolname("pkg-config"), "pkg_config")
t:are_equal(find_toolname("gcc-5"), "gcc")
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/hello/test.lua |
function test_hello(context)
print("hello")
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/process/test.lua | import("core.base.process")
import("core.base.scheduler")
local inftimeout = 5000
function test_single_process(t)
local stdout = os.tmpfile()
local stderr = os.tmpfile()
local proc = process.openv("xmake", {"lua", "print", "xmake"}, {stdout = stdout, stderr = stderr})
proc:wait(inftimeout)
proc:close()
t:are_equal(io.readfile(stdout):trim(), "xmake")
end
function test_sched_process(t)
local count = 0
local _session = function ()
local stdout = io.open(os.tmpfile(), 'w')
local stderr = io.open(os.tmpfile(), 'w')
local proc = process.openv("xmake", {"lua", "print", "xmake"}, {stdout = stdout, stderr = stderr})
local ok, status = proc:wait(inftimeout)
proc:close()
stdout:close()
stderr:close()
count = count + 1
end
scheduler.co_group_begin("test", function ()
for i = 1, 3 do
scheduler.co_start(_session)
end
end)
scheduler.co_group_wait("test")
t:are_equal(count, 3)
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/process/process_killed.lua | import("core.base.process")
import("core.base.scheduler")
function main(cmd)
for i = 1, 10 do
scheduler.co_start(function ()
-- @note we need test xx.bat cmd on windows
local proc = process.open(cmd or "xmake l os.sleep 60000")
print("%s: wait ..", proc)
-- we need to terminate all unclosed processes automatically after parent process is exited after do ctrl-c
proc:wait(-1)
print("%s: wait ok", proc)
proc:close()
end)
end
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/process/sched_process_pipe.lua | import("core.base.pipe")
import("core.base.bytes")
import("core.base.process")
import("core.base.scheduler")
function _session_read_pipe(id, rpipeopt)
local buff = bytes(8192)
local rpipe = rpipeopt.rpipe
print("%s/%d: read ..", rpipe, id)
local read = 0
while not rpipeopt.stop do
local real, data = rpipe:read(buff, 8192 - read, {start = read + 1})
if real > 0 then
read = read + real
elseif real == 0 then
if rpipe:wait(pipe.EV_READ, -1) < 0 then
break
end
else
break
end
end
local results = bytes(buff, 1, read)
print("%s/%d: read ok, size: %d", rpipe, id, results:size())
if results:size() > 0 then
results:dump()
end
rpipe:close()
end
function _session(id, program, ...)
local rpipe, wpipe = pipe.openpair()
local rpipeopt = {rpipe = rpipe, stop = false}
scheduler.co_start(_session_read_pipe, id, rpipeopt)
local proc = process.openv(program, table.pack(...), {stdout = wpipe})
local ok, status = proc:wait(-1)
rpipeopt.stop = true
print("%s/%d: %d, status: %d", proc, id, ok, status)
proc:close()
wpipe:close()
end
function main(program, ...)
for i = 1, 10 do
scheduler.co_start(_session, i, program, ...)
end
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/process/process_autoexit.lua | import("core.base.process")
import("core.base.scheduler")
function main(cmd)
for i = 1, 10 do
scheduler.co_start(function ()
process.open(cmd or "xmake l os.sleep 60000")
--process.openv("xmake", {"l", "os.sleep", "60000"}, {detach = true}):close()
end)
end
-- check processes status after exiting
-- we need to terminate all unclosed processes automatically after parent process is exited
-- ps aux | grep sleep
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/process/sched_process.lua | import("core.base.process")
import("core.base.scheduler")
function _session(id, program, ...)
local proc = process.openv(program, table.pack(...))
local ok, status = proc:wait(-1)
print("%s/%d: %d, status: %d", proc, id, ok, status)
proc:close()
end
function main(program, ...)
for i = 1, 10 do
scheduler.co_start(_session, i, program, ...)
end
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/bytes/test.lua | import("core.base.bytes")
function test_ctor(t)
t:are_equal(bytes("123456789"):str(), "123456789")
t:are_equal(bytes(bytes("123456789")):str(), "123456789")
t:are_equal(bytes(bytes("123456789"), 3, 5):str(), "345")
t:are_equal(bytes("123456789"):size(), 9)
t:are_equal(bytes(10):size(), 10)
t:are_equal(bytes(bytes("123"), bytes("456"), bytes("789")):str(), "123456789")
t:are_equal(bytes({bytes("123"), bytes("456"), bytes("789")}):str(), "123456789")
end
function test_clone(t)
t:are_equal(bytes(10):clone():size(), 10)
t:are_equal(bytes("123456789"):clone():str(), "123456789")
end
function test_slice(t)
t:are_equal(bytes(10):slice(1, 2):size(), 2)
t:are_equal(bytes("123456789"):slice(1, 4):str(), "1234")
end
function test_index(t)
local b = bytes("123456789")
t:are_equal(b[{1, 4}]:str(), "1234")
t:will_raise(function() b[1] = string.byte('2') end)
b = bytes(9)
b[{1, 9}] = bytes("123456789")
t:are_equal(b:str(), "123456789")
b[1] = string.byte('2')
t:are_equal(b:str(), "223456789")
t:will_raise(function() b[100] = string.byte('2') end)
end
function test_concat(t)
t:are_equal((bytes("123") .. bytes("456")):str(), "123456")
t:are_equal(bytes(bytes("123"), bytes("456")):str(), "123456")
end
function test_copy(t)
t:are_equal(bytes(9):copy("123456789"):str(), "123456789")
t:are_equal(bytes(5):copy("123456789", 5, 9):str(), "56789")
end
function test_copy2(t)
t:are_equal(bytes(18):copy("123456789"):copy2(10, "123456789"):str(), "123456789123456789")
t:are_equal(bytes(14):copy("123456789"):copy2(10, "123456789", 5, 9):str(), "12345678956789")
end
function test_move(t)
t:are_equal(bytes(9):copy("123456789"):move(5, 9):str(), "567896789")
t:are_equal(bytes(9):copy("123456789"):move2(2, 5, 9):str(), "156789789")
end
function test_int(t)
t:are_equal(bytes(1):u8_set(1, 1):u8(1), 1)
t:are_equal(bytes(10):u8_set(5, 255):u8(5), 255)
t:are_equal(bytes(10):u16le_set(5, 12346):u16le(5), 12346)
t:are_equal(bytes(10):u16be_set(5, 12346):u16be(5), 12346)
t:are_equal(bytes(20):u32le_set(5, 12345678):u32le(5), 12345678)
t:are_equal(bytes(20):u32be_set(5, 12345678):u32be(5), 12345678)
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/compress/test.lua | import("core.compress.lz4")
function test_lz4(t)
t:are_equal(lz4.decompress(lz4.compress("hello world")):str(), "hello world")
t:are_equal(lz4.block_decompress(lz4.block_compress("hello world"), 11):str(), "hello world")
local srcfile = os.tmpfile() .. ".src"
local dstfile = os.tmpfile() .. ".dst"
local dstfile2 = os.tmpfile() .. ".dst2"
io.writefile(srcfile, "hello world")
lz4.compress_file(srcfile, dstfile)
lz4.decompress_file(dstfile, dstfile2)
t:are_equal(io.readfile(srcfile), io.readfile(dstfile2))
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/json/test.lua | import("core.base.json")
local json_null = json.null
local json_pure_null = json.purenull
function json_decode(jsonstr)
return json.decode(jsonstr)
end
function json_encode(luatable)
return json.encode(luatable)
end
function json_pure_decode(jsonstr)
return json.decode(jsonstr, {pure = true})
end
function json_pure_encode(luatable)
return json.encode(luatable, {pure = true})
end
function test_json_decode(t)
t:are_equal(json_decode('{}'), {})
t:are_equal(json_decode('[]'), {})
t:are_equal(json.is_marked_as_array(json_decode('[]')), true)
t:are_equal(not json.is_marked_as_array(json_decode('{}')), true)
t:are_equal(json_decode('{"a":1, "b":"2", "c":true, "d":false, "e":null, "f":[]}'), {a = 1, b = "2", c = true, d = false, e = json_null, f = {}})
t:are_equal(json_decode('{"a":[], "b":[1,2], "c":{"a":1}}'), {a = {}, b = {1,2}, c = {a = 1}})
t:are_equal(json_decode('[1,"2"]'), {1, "2"})
t:are_equal(json_decode('[1,"2", {"a":1, "b":true}]'), {1, "2", {a = 1, b = true}})
t:are_equal(json_decode('[1,0xa,0xdeadbeef, 0xffffffff,-1]'), {1, 0xa, 0xdeadbeef, 0xffffffff, -1})
end
function test_json_encode(t)
t:are_equal(json_encode({}), '{}')
t:are_equal(json_encode(json.mark_as_array({})), '[]')
t:are_equal(json_encode({json_null, 1, "2", false, true}), '[null,1,"2",false,true]')
t:are_equal(json_encode({1, "2", {a = 1}}), '[1,"2",{"a":1}]')
t:are_equal(json_encode({1, "2", {b = true}}), '[1,"2",{"b":true}]')
t:are_equal(json_encode(json.mark_as_array({1, 0xa, 0xdeadbeef, 0xffffffff, -1})), '[1,10,3735928559,4294967295,-1]')
end
function test_pure_json_decode(t)
t:are_equal(json_pure_decode('{}'), {})
t:are_equal(json_pure_decode('[]'), {})
t:are_equal(json.is_marked_as_array(json_pure_decode('[]')), true)
t:are_equal(not json.is_marked_as_array(json_pure_decode('{}')), true)
t:are_equal(json_pure_decode('{"a":1, "b":"2", "c":true, "d":false, "e":null, "f":[]}'), {a = 1, b = "2", c = true, d = false, e = json_pure_null, f = {}})
t:are_equal(json_pure_decode('{"a":[], "b":[1,2], "c":{"a":1}}'), {a = {}, b = {1,2}, c = {a = 1}})
t:are_equal(json_pure_decode('[1,"2"]'), {1, "2"})
t:are_equal(json_pure_decode('[1,"2", {"a":1, "b":true}]'), {1, "2", {a = 1, b = true}})
t:are_equal(json_pure_decode('[1,0xa,0xdeadbeef, 0xffffffff,-1]'), {1, 0xa, 0xdeadbeef, 0xffffffff, -1})
end
function test_pure_json_encode(t)
t:are_equal(json_pure_encode({}), '{}')
t:are_equal(json_pure_encode(json.mark_as_array({})), '[]')
t:are_equal(json_pure_encode({json_pure_null, 1, "2", false, true}), '[null,1,"2",false,true]')
t:are_equal(json_pure_encode({1, "2", {a = 1}}), '[1,"2",{"a":1}]')
t:are_equal(json_pure_encode({1, "2", {b = true}}), '[1,"2",{"b":true}]')
t:are_equal(json_pure_encode(json.mark_as_array({1, 0xa, 0xdeadbeef, 0xffffffff, -1})), '[1,10,3735928559,4294967295,-1]')
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/list/test.lua | import("core.base.list")
function test_push(t)
local d = list.new()
d:push({v = 1})
d:push({v = 2})
d:push({v = 3})
d:push({v = 4})
d:push({v = 5})
t:are_equal(d:first().v, 1)
t:are_equal(d:last().v, 5)
local idx = 1
for item in d:items() do
t:are_equal(item.v, idx)
idx = idx + 1
end
end
function test_insert(t)
local d = list.new()
local v3 = {v = 3}
d:insert({v = 1})
d:insert({v = 2})
d:insert(v3)
d:insert({v = 5})
d:insert({v = 4}, v3)
t:are_equal(d:first().v, 1)
t:are_equal(d:last().v, 5)
local idx = 1
for item in d:items() do
t:are_equal(item.v, idx)
idx = idx + 1
end
end
function test_remove(t)
local d = list.new()
local v3 = {v = 3}
d:insert({v = 1})
d:insert({v = 2})
d:insert(v3)
d:insert({v = 3})
d:insert({v = 4})
d:insert({v = 5})
d:remove(v3)
t:are_equal(d:first().v, 1)
t:are_equal(d:last().v, 5)
local idx = 1
for item in d:items() do
t:are_equal(item.v, idx)
idx = idx + 1
end
end
function test_remove_first(t)
local d = list.new()
d:push({v = 1})
d:push({v = 2})
d:push({v = 3})
d:push({v = 4})
d:push({v = 5})
d:remove_first()
t:are_equal(d:first().v, 2)
t:are_equal(d:last().v, 5)
local idx = 2
for item in d:items() do
t:are_equal(item.v, idx)
idx = idx + 1
end
end
function test_remove_last(t)
local d = list.new()
d:push({v = 1})
d:push({v = 2})
d:push({v = 3})
d:push({v = 4})
d:push({v = 5})
d:remove_last()
t:are_equal(d:first().v, 1)
t:are_equal(d:last().v, 4)
local idx = 1
for item in d:items() do
t:are_equal(item.v, idx)
idx = idx + 1
end
end
function test_for_remove(t)
local d = list.new()
d:push({v = 1})
d:push({v = 2})
d:push({v = 3})
d:push({v = 4})
d:push({v = 5})
t:are_equal(d:first().v, 1)
t:are_equal(d:last().v, 5)
local idx = 1
local item = d:first()
while item ~= nil do
local next = d:next(item)
t:are_equal(item.v, idx)
d:remove(item)
item = next
idx = idx + 1
end
t:require(d:empty())
end
function test_rfor_remove(t)
local d = list.new()
d:push({v = 1})
d:push({v = 2})
d:push({v = 3})
d:push({v = 4})
d:push({v = 5})
t:are_equal(d:first().v, 1)
t:are_equal(d:last().v, 5)
local idx = 5
local item = d:last()
while item ~= nil do
local prev = d:prev(item)
t:are_equal(item.v, idx)
d:remove(item)
item = prev
idx = idx - 1
end
t:require(d:empty())
end
function test_insert_first(t)
local d = list.new()
d:push({v = 2})
d:push({v = 3})
d:push({v = 4})
d:push({v = 5})
d:insert_first({v = 1})
t:are_equal(d:first().v, 1)
t:are_equal(d:last().v, 5)
local idx = 1
for item in d:items() do
t:are_equal(item.v, idx)
idx = idx + 1
end
end
function test_insert_last(t)
local d = list.new()
d:push({v = 1})
d:push({v = 2})
d:push({v = 3})
d:push({v = 4})
d:insert_last({v = 5})
t:are_equal(d:first().v, 1)
t:are_equal(d:last().v, 5)
local idx = 1
for item in d:items() do
t:are_equal(item.v, idx)
idx = idx + 1
end
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/string/lastof_perf.lua |
function _lastof_perf(str, pattern, opt)
local plain = opt and opt.plain
local dt = os.mclock()
for i = 0, 1000000 do
str:lastof(pattern, plain)
end
dt = os.mclock() - dt
print("lastof(%s .., %s, %s): %d ms", str:sub(1, 16), pattern, string.serialize(opt or {}, {strip = true, indent = false}), dt)
end
function main()
local str = "shortstr: 123abc123123xyz[123]+abc123"
_lastof_perf(str, "1")
_lastof_perf(str, "123")
_lastof_perf(str, "[123]+")
print("")
_lastof_perf(str, "1", {plain = true})
_lastof_perf(str, "123", {plain = true})
_lastof_perf(str, "[123]+", {plain = true})
print("")
str = "longstr: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
for i = 0, 100 do
str = str .. "[123]+"
end
_lastof_perf(str, "1")
_lastof_perf(str, "123")
_lastof_perf(str, "[123]+")
print("")
_lastof_perf(str, "1", {plain = true})
_lastof_perf(str, "123", {plain = true})
_lastof_perf(str, "[123]+", {plain = true})
print("")
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/string/test.lua |
function test_endswith(t)
t:require(("aaaccc"):endswith("ccc"))
t:require(("aaaccc"):endswith("aaaccc"))
t:require_not(("rc"):endswith("xcadas"))
t:require_not(("aaaccc "):endswith("%s"))
end
function test_startswith(t)
t:require(("aaaccc"):startswith("aaa"))
t:require(("aaaccc"):startswith("aaaccc"))
t:require_not(("rc"):startswith("xcadas"))
t:require_not((" aaaccc"):startswith("%s"))
end
function test_trim(t)
t:are_equal((""):trim(), "")
t:are_equal((" "):trim(), "")
t:are_equal((""):trim(""), "")
t:are_equal((" "):trim(""), "")
t:are_equal((" aaa ccc "):trim(), "aaa ccc")
t:are_equal(("aaa ccc "):trim(), "aaa ccc")
t:are_equal((" aaa ccc"):trim(), "aaa ccc")
t:are_equal(("aaa ccc"):trim(), "aaa ccc")
t:are_equal(("\t\naaa ccc\r\n"):trim(), "aaa ccc")
t:are_equal(("aba"):trim("a"), "b")
end
function test_ltrim(t)
t:are_equal((""):ltrim(), "")
t:are_equal((" "):ltrim(), "")
t:are_equal((""):ltrim(""), "")
t:are_equal((" "):ltrim(""), "")
t:are_equal((" aaa ccc "):ltrim(), "aaa ccc ")
t:are_equal(("aaa ccc "):ltrim(), "aaa ccc ")
t:are_equal((" aaa ccc"):ltrim(), "aaa ccc")
t:are_equal(("aaa ccc"):ltrim(), "aaa ccc")
t:are_equal(("\t\naaa ccc\r\n"):ltrim(), "aaa ccc\r\n")
t:are_equal(("aba"):ltrim("a"), "ba")
end
function test_rtrim(t)
t:are_equal((""):rtrim(), "")
t:are_equal((" "):rtrim(), "")
t:are_equal((""):rtrim(""), "")
t:are_equal((" "):rtrim(""), "")
t:are_equal((" aaa ccc "):rtrim(), " aaa ccc")
t:are_equal(("aaa ccc "):rtrim(), "aaa ccc")
t:are_equal((" aaa ccc"):rtrim(), " aaa ccc")
t:are_equal(("aaa ccc"):rtrim(), "aaa ccc")
t:are_equal(("\t\naaa ccc\r\n"):rtrim(), "\t\naaa ccc")
t:are_equal(("aba"):rtrim("a"), "ab")
end
function test_split(t)
-- pattern match and ignore empty string
t:are_equal(("1\n\n2\n3"):split('\n'), {"1", "2", "3"})
t:are_equal(("abc123123xyz123abc"):split('123'), {"abc", "xyz", "abc"})
t:are_equal(("abc123123xyz123abc"):split('[123]+'), {"abc", "xyz", "abc"})
-- plain match and ignore empty string
t:are_equal(("1\n\n2\n3"):split('\n', {plain = true}), {"1", "2", "3"})
t:are_equal(("abc123123xyz123abc"):split('123', {plain = true}), {"abc", "xyz", "abc"})
-- pattern match and contains empty string
t:are_equal(("1\n\n2\n3"):split('\n', {strict = true}), {"1", "", "2", "3"})
t:are_equal(("abc123123xyz123abc"):split('123', {strict = true}), {"abc", "", "xyz", "abc"})
t:are_equal(("abc123123xyz123abc"):split('[123]+', {strict = true}), {"abc", "xyz", "abc"})
t:are_equal(("123abc123123xyz123abc123"):split('[123]+', {strict = true}), {"", "abc", "xyz", "abc", ""})
t:are_equal(("123123"):split('[123]+', {strict = true}), {"", ""})
t:are_equal((""):split('[123]+', {strict = true}), {""})
-- plain match and contains empty string
t:are_equal(("1\n\n2\n3"):split('\n', {plain = true, strict = true}), {"1", "", "2", "3"})
t:are_equal(("abc123123xyz123abc"):split('123', {plain = true, strict = true}), {"abc", "", "xyz", "abc"})
t:are_equal(("123abc123123xyz123abc123"):split('123', {plain = true, strict = true}), {"", "abc", "", "xyz", "abc", ""})
t:are_equal(("123"):split('123', {plain = true, strict = true}), {"", ""})
t:are_equal((""):split('123', {plain = true, strict = true}), {""})
-- limit split count
t:are_equal(("1\n\n2\n3"):split('\n', {limit = 2}), {"1", "2\n3"})
t:are_equal(("1\n\n2\n3"):split('\n', {limit = 2, strict = true}), {"1", "\n2\n3"})
t:are_equal(("\n1\n\n2\n3"):split('\n', {limit = 2, strict = true}), {"", "1\n\n2\n3"})
t:are_equal(("1.2.3.4.5"):split('%.', {limit = 3}), {"1", "2", "3.4.5"})
t:are_equal(("123.45"):split('%.', {limit = 3}), {"123", "45"})
t:are_equal((""):split('123', {plain = true, limit = 2, strict = true}), {""})
t:are_equal(("123123"):split('123', {plain = true, limit = 2, strict = true}), {"", "123"})
end
function test_lastof(t)
t:are_equal(("1.2.3.4.5"):lastof('%.'), 8)
t:are_equal(("1.2.3.4.5"):lastof('.', true), 8)
t:are_equal(("/home/file.txt"):lastof('[/\\]'), 6)
t:are_equal(("/home/file.txt"):lastof('/', true), 6)
t:are_equal(("/home/file.txt"):lastof('/home', true), 1)
t:are_equal(("/home/file.txt"):lastof('[/\\]home'), 1)
end
function test_replace(t)
t:are_equal(("123xyz456xyz789xyz"):replace("123", "000"), "000xyz456xyz789xyz")
t:are_equal(("123xyz456xyz789xyz"):replace("xyz", "000"), "123000456000789000")
t:are_equal(("123xyz456xyz789xyz"):replace("123", "000", {plain = true}), "000xyz456xyz789xyz")
t:are_equal(("123xyz456xyz789xyz"):replace("xyz", "000", {plain = true}), "123000456000789000")
t:are_equal(("123$xyz456xyz789xyz"):replace("123$", "000"), "123$xyz456xyz789xyz")
t:are_equal(("123xyz$456xyz$789xyz$"):replace("xyz$", "000"), "123xyz$456xyz$789xyz$")
t:are_equal(("123$xyz456xyz789xyz"):replace("123$", "000", {plain = true}), "000xyz456xyz789xyz")
t:are_equal(("123xyz$456xyz$789xyz$"):replace("xyz$", "000", {plain = true}), "123000456000789000")
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/string/split_perf.lua |
function _split_perf(str, delimiter, opt)
local dt = os.mclock()
for i = 0, 1000000 do
str:split(delimiter, opt)
end
dt = os.mclock() - dt
print("split(%s .., %s, %s): %d ms", str:sub(1, 16), delimiter, string.serialize(opt or {}, {strip = true, indent = false}), dt)
end
function main()
local str = "shortstr: 123abc123123xyz[123]+abc123"
_split_perf(str, "1")
_split_perf(str, "123")
_split_perf(str, "[123]+")
print("")
_split_perf(str, "1", {plain = true})
_split_perf(str, "123", {plain = true})
_split_perf(str, "[123]+", {plain = true})
print("")
str = "longstr: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
for i = 0, 100 do
str = str .. "[123]+"
end
_split_perf(str, "1")
_split_perf(str, "123")
_split_perf(str, "[123]+")
print("")
_split_perf(str, "1", {plain = true})
_split_perf(str, "123", {plain = true})
_split_perf(str, "[123]+", {plain = true})
print("")
end
|
0 | repos/xmake/tests/modules/string | repos/xmake/tests/modules/string/serialize/test.lua |
function roundtripimpl(value, opt)
local s, serr = string.serialize(value, opt)
if serr then
raise(serr)
end
local v, verr = s:deserialize()
if verr then
raise(verr)
end
return v
end
function roundtrip(round0)
local round1 = roundtripimpl(round0, false)
local round2 = roundtripimpl(round1, true)
local round3 = roundtripimpl(round2, {binary=true})
local round4 = roundtripimpl(round3, {indent=16})
local round5 = roundtripimpl(round4, {indent=" \r\n\t"})
return round5
end
function test_number(t)
t:are_equal(roundtrip(12), 12)
t:are_equal(roundtrip(0), 0)
t:are_equal(roundtrip(-1), -1)
t:are_equal(roundtrip(7.25), 7.25)
t:are_equal(roundtrip(math.huge), math.huge)
t:are_equal(roundtrip(-math.huge), -math.huge)
t:are_equal(roundtrip(math.nan), math.nan)
end
function test_boolean(t)
t:are_equal(roundtrip(true), true)
t:are_equal(roundtrip(false), false)
end
function test_nil(t)
t:are_equal(roundtrip(nil), nil)
end
function test_table(t)
t:are_equal(roundtrip({}), {})
t:are_equal(roundtrip({{},{1}}), {{},{1}})
t:are_equal(roundtrip({["true"] = true}), {["true"] = true})
t:are_equal(roundtrip({1, 2, 3}), {1, 2, 3})
t:are_equal(roundtrip({1, "", 3}), {1, "", 3})
t:are_equal(roundtrip({{1, 2, 3, nil, 4}}), {{1, 2, 3, nil, 4}})
t:are_equal(roundtrip({{1, 2, 3, nil, 4, [100]=5}}), {{1, 2, 3, nil, 4, [100]=5}})
t:are_equal(roundtrip({{a=1, b=2, c=3, nil, 4}}), {{a=1, b=2, c=3, nil, 4}})
end
function test_function(t)
t:are_equal(roundtrip(function() return {} end)(), {})
t:are_equal(roundtrip(function() return {1, 2, 3} end)(), {1, 2, 3})
t:are_equal(roundtrip(function() return {{1, 2, 3, nil, 4}} end)(), {{1, 2, 3, nil, 4}})
t:are_equal(roundtrip({function() return {{1, 2, 3, nil, 4}} end})[1](), {{1, 2, 3, nil, 4}})
t:are_equal(roundtrip({{function() return {{1, 2, 3, nil, 4}} end}})[1][1](), {{1, 2, 3, nil, 4}})
-- x in fenv
x = {}
-- return x in fenv
function f() return x end
-- fenv will restore
if xmake.luajit() then
-- TODO we need to fix it for lua backend
t:are_same(roundtrip(f)(), x)
end
y = {}
-- y in fenv
local g_y = y
-- y in upvalue
local y = {}
-- return y in upvalue
function g() return y end
-- upvalue will not restore if striped
t:are_same(roundtrip(g)(), nil)
-- upvalue will be restored by fenv, so y in fenv is returned
t:are_same(roundtripimpl(g)(), g_y)
end
function test_refloop(t)
local l1 = {}
l1.l = l1
local r1 = roundtrip(l1)
t:are_same(r1.l, r1)
local l2 = {{1}, {2}, {3}}
l2[1].l = { root = l2, a = l2[1], b = l2[2], c = l2[3] }
local r2 = roundtrip(l2)
t:are_same(r2[1].l.root, r2)
t:are_same(r2[1].l.a, r2[1])
t:are_same(r2[1].l.b, r2[2])
t:are_same(r2[1].l.c, r2[3])
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/math/test.lua | function test_isinf(t)
t:will_raise(function() math.isinf(nil) end)
t:will_raise(function() math.isinf(true) end)
t:require_not(math.isinf(0))
t:require_not(math.isinf(math.nan))
t:are_same(math.isinf(math.inf), 1)
t:are_same(math.isinf(-math.inf), -1)
end
function test_isnan(t)
t:will_raise(function() math.isinf(nil) end)
t:will_raise(function() math.isinf(true) end)
t:require_not(math.isnan(0))
t:require(math.isnan(math.nan))
t:require_not(math.isnan(math.huge))
t:require_not(math.isnan(-math.huge))
end
function test_isint(t)
t:will_raise(function() math.isint(nil) end)
t:will_raise(function() math.isint(true) end)
t:require(math.isint(0))
t:require(math.isint(-10))
t:require(math.isint(123456))
t:require_not(math.isint(123456.1))
t:require_not(math.isint(-9.99))
t:require_not(math.isint(math.nan))
t:require_not(math.isint(math.huge))
t:require_not(math.isint(-math.huge))
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/heap/test.lua | import("core.base.heap")
function test_cdataheap(t)
if not xmake.luajit() then
return
end
local h = heap.cdataheap{
size = 100,
ctype = [[
struct {
int priority;
int order;
}
]],
cmp = function(a, b)
if a.priority == b.priority then
return a.order > b.order
end
return a.priority < b.priority
end}
h:push{priority = 20, order = 1}
h:push{priority = 10, order = 2}
h:push{priority = 10, order = 3}
h:push{priority = 20, order = 4}
t:are_equal(h:pop().order, 3)
t:are_equal(h:pop().order, 2)
t:are_equal(h:pop().order, 4)
t:are_equal(h:pop().order, 1)
end
function test_valueheap(t)
local h = heap.valueheap{cmp = function(a, b)
return a.priority < b.priority
end}
h:push{priority = 20, etc = 'bar'}
h:push{priority = 10, etc = 'foo'}
t:are_equal(h:pop().priority, 10)
t:are_equal(h:pop().priority, 20)
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/io/test.lua | function test_read(t)
t:are_equal(io.readfile("files/utf8bom-lf-eleof"), "123\\\n456\n789\n")
t:are_equal(io.readfile("files/utf8-crlf-neleof"), "123\\\n456\n789")
t:are_equal(io.readfile("files/utf8-crlf-neleof", {encoding = "binary"}), "123\\\r\n456\r\n789")
t:are_equal(io.readfile("files/utf8-crlf-neleof", {continuation = "\\"}), "123456\n789")
t:are_equal(io.readfile("files/utf16be-lf-eleof"), "123\\\n456\n789\n")
t:are_equal(io.readfile("files/utf16le-crlf-neleof"), "123\\\n456\n789")
local data1 = io.readfile("files/utf8-longline-neleof")
t:are_equal(#data1, 10000)
t:require(data1:endswith("1234567890"))
local data2 = io.readfile("files/utf8-longline-eleof")
t:are_equal(#data2, 10001)
t:require(data2:endswith("1234567890\n"))
end
function test_lines(t)
t:are_equal(table.to_array(io.lines("files/utf8bom-lf-eleof")), {"123\\", "456", "789"})
t:are_equal(table.to_array(io.lines("files/utf8-crlf-neleof")), {"123\\", "456", "789"})
t:are_equal(table.to_array(io.lines("files/utf8-crlf-neleof", {encoding = "binary"})), {"123\\\r\n", "456\r\n", "789"})
t:are_equal(table.to_array(io.lines("files/utf8-crlf-neleof", {continuation = "\\"})), {"123456", "789"})
t:are_equal(table.to_array(io.lines("files/utf16be-lf-eleof")), {"123\\", "456", "789"})
t:are_equal(table.to_array(io.lines("files/utf16le-crlf-neleof")), {"123\\", "456", "789"})
end
function test_readlines(t)
function get_all_keep_crlf(file, opt)
local fp = io.open(file, "r", opt)
local r = {}
while true do
local l = fp:read("L", opt)
if l == nil then break end
table.insert(r, l)
end
t:require(fp:close())
return r
end
function get_all_without_crlf(file, opt)
local r = {}
local fp = io.open(file, "r", opt)
for l in fp:lines(opt) do
table.insert(r, l)
end
t:require(fp:close())
return r
end
t:are_equal(get_all_keep_crlf("files/utf8bom-lf-eleof"), {"123\\\n", "456\n", "789\n"})
t:are_equal(get_all_keep_crlf("files/utf8-crlf-neleof"), {"123\\\n", "456\n", "789"})
t:are_equal(get_all_keep_crlf("files/utf8-crlf-neleof", {encoding = "binary"}), {"123\\\r\n", "456\r\n", "789"})
t:are_equal(get_all_keep_crlf("files/utf8-crlf-neleof", {continuation = "\\"}), {"123456\n", "789"})
t:are_equal(get_all_keep_crlf("files/utf16be-lf-eleof"), {"123\\\n", "456\n", "789\n"})
t:are_equal(get_all_keep_crlf("files/utf16le-crlf-neleof"), {"123\\\n", "456\n", "789"})
t:are_equal(get_all_without_crlf("files/utf8bom-lf-eleof"), {"123\\", "456", "789"})
t:are_equal(get_all_without_crlf("files/utf8-crlf-neleof"), {"123\\", "456", "789"})
t:are_equal(get_all_without_crlf("files/utf8-crlf-neleof", {encoding = "binary"}), {"123\\\r\n", "456\r\n", "789"})
t:are_equal(get_all_without_crlf("files/utf8-crlf-neleof", {continuation = "\\"}), {"123456", "789"})
t:are_equal(get_all_without_crlf("files/utf16be-lf-eleof"), {"123\\", "456", "789"})
t:are_equal(get_all_without_crlf("files/utf16le-crlf-neleof"), {"123\\", "456", "789"})
end
function test_prop(t)
t:are_equal(io.open("files/utf8bom-lf-eleof"):size(), 16)
t:are_equal(io.open("files/utf8-crlf-neleof"):size(), 14)
t:are_equal(io.open("files/utf16be-lf-eleof"):size(), 28)
t:are_equal(io.open("files/utf16le-crlf-neleof"):size(), 30)
t:are_equal(io.open("files/utf8bom-lf-eleof"):path(), path.absolute("files/utf8bom-lf-eleof"))
t:are_equal(io.open("files/utf8-crlf-neleof"):path(), path.absolute("files/utf8-crlf-neleof"))
t:are_equal(io.open("files/utf16be-lf-eleof"):path(), path.absolute("files/utf16be-lf-eleof"))
t:are_equal(io.open("files/utf16le-crlf-neleof"):path(), path.absolute("files/utf16le-crlf-neleof"))
end
function test_write(t)
function write(fname, opt)
local f = io.open(fname, "w", opt)
f:write(123, "abc", 456, "def", "\n")
f:close()
-- give encoding info
t:are_equal(io.readfile(fname, opt), "123abc456def\n")
-- auto detect encoding
t:are_equal(io.readfile(fname), "123abc456def\n")
end
write("temp/path/not/exist/utf8", {encoding = "utf8"})
write("temp/path/not/exist/utf16", {encoding = "utf16"})
write("temp/path/not/exist/utf16le", {encoding = "utf16le"})
write("temp/path/not/exist/utf16be", {encoding = "utf16be"})
os.tryrm("temp")
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/fwatcher/watchdirs.lua | import("core.base.fwatcher")
function main(watchdir)
print("watch %s ..", watchdir)
fwatcher.watchdirs(watchdir, function (event)
local status
if event.type == fwatcher.ET_CREATE then
status = "created"
elseif event.type == fwatcher.ET_MODIFY then
status = "modified"
elseif event.type == fwatcher.ET_DELETE then
status = "deleted"
end
print(event.path, status)
end)
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/fwatcher/on_deleted.lua | import("core.base.fwatcher")
function main(watchdir)
print("watch %s ..", watchdir)
fwatcher.on_deleted(watchdir, function (filepath)
print(filepath, "deleted")
end)
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/fwatcher/on_created.lua | import("core.base.fwatcher")
function main(watchdir)
print("watch %s ..", watchdir)
fwatcher.on_created(watchdir, function (filepath)
print(filepath, "created")
end)
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/fwatcher/watchdir.lua | import("core.base.fwatcher")
function main(watchdir)
print("watch %s ..", watchdir)
fwatcher.add(watchdir)
while true do
local ok, event = fwatcher.wait(-1)
if ok > 0 then
print(event)
end
end
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/fwatcher/on_modified.lua | import("core.base.fwatcher")
function main(watchdir)
print("watch %s ..", watchdir)
fwatcher.on_modified(watchdir, function (filepath)
print(filepath, "modified")
end)
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/fwatcher/sched_watchdir.lua | import("core.base.fwatcher")
import("core.base.scheduler")
function _watch(watchdir)
print("watch %s ..", watchdir)
fwatcher.add(watchdir)
while true do
local ok, event = fwatcher.wait(-1)
if ok > 0 then
print(event)
end
end
end
function _sleep()
while true do
print("sleep ..")
os.sleep(1000)
end
end
function main(watchdir)
scheduler.co_start(_watch, watchdir)
scheduler.co_start(_sleep)
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/semver/test.lua | import("core.base.semver")
-- select version
function _check_semver_select(t, results, required_ver, versions, tags, branches)
local version, source = semver.select(required_ver, versions or {}, tags or {}, branches or {})
t:are_equal((version.version or version), results[1])
t:are_equal(source, results[2])
end
-- test select version
function test_semver_select(t)
_check_semver_select(t, {"1.5.1", "version"}
, ">=1.5.0 <1.6.0"
, {"1.4.0", "1.5.0", "1.5.1"})
_check_semver_select(t, {"1.5.1", "version"}
, "^1.5.0"
,{"1.4.0", "1.5.0", "1.5.1"})
_check_semver_select(t, {"master", "branch"}
, "master"
, {"1.4.0", "1.5.0", "1.5.1"}
, {"v1.2.0", "v1.6.0"}
, {"master", "dev"})
_check_semver_select(t, {"1.5.1", "version"}
, "latest"
, {"1.4.0", "1.5.0", "1.5.1"})
end
-- select version
function _check_semver_satisfies(t, expected, version, range)
local result = semver.satisfies(version, range)
t:are_equal(result, expected)
end
-- test satisfies version
function test_semver_satisfies(t)
_check_semver_satisfies(t, true, "1.5.1", ">=1.5.0 <1.6.0")
_check_semver_satisfies(t, true, "1.5.1", "^1.5.0")
_check_semver_satisfies(t, true, "1.5.1", "~1.5.0")
_check_semver_satisfies(t, true, "1.6.0", "^1.5.0")
_check_semver_satisfies(t, true, "1.6.0", "v1.6.0")
_check_semver_satisfies(t, false, "1.6.1", "~1.5.0")
_check_semver_satisfies(t, false, "2.5.1", "^1.5.0")
_check_semver_satisfies(t, false, "1.4.1", ">=1.5.0 <1.6.0")
_check_semver_satisfies(t, false, "1.6.0", "v1.6.1")
end
-- parse version
function _check_semver_parse(t, version_str, major, minor, patch, prerelease, build)
local version = semver.new(version_str)
t:require(version)
t:are_equal(version:major(), major)
t:are_equal(version:minor(), minor)
t:are_equal(version:patch(), patch)
t:are_equal(version:prerelease(), prerelease or {})
t:are_equal(version:build(), build or {})
end
-- match version
function _check_semver_match(t, str, version_str, major, minor, patch, prerelease, build)
local version = semver.match(str)
t:require(version)
t:are_equal(version:rawstr(), version_str)
t:are_equal(version:major(), major)
t:are_equal(version:minor(), minor)
t:are_equal(version:patch(), patch)
t:are_equal(version:prerelease(), prerelease or {})
t:are_equal(version:build(), build or {})
end
-- test parse version
function test_semver_parse(t)
_check_semver_parse(t, "1.2.3", 1, 2, 3)
_check_semver_parse(t, "1.2.3-beta", 1, 2, 3, {"beta"})
_check_semver_parse(t, "1.2.3-beta+77", 1, 2, 3, {"beta"}, {77})
_check_semver_parse(t, "v1.2.3-alpha.1+77", 1, 2, 3, {"alpha", 1}, {77})
_check_semver_parse(t, "v3.2.1-alpha.1+77.foo", 3, 2, 1, {"alpha", 1}, {77, "foo"})
end
-- test match version string
function test_semver_match(t)
_check_semver_match(t, "gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0", "7.4.0-1ubuntu1", 7, 4, 0, {"1ubuntu1"})
_check_semver_match(t, "gcc (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 8.1.0", "8.1.0", 8, 1, 0)
_check_semver_match(t, "DMD64 D Compiler v2.090.0", "2.090.0", 2, 90, 0)
_check_semver_match(t, "Apple clang version 11.0.0 (clang-1100.0.33.12)", "11.0.0", 11, 0, 0)
_check_semver_match(t, "curl 7.54.0 (x86_64-apple-darwin18.0) libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1", "7.54.0", 7, 54, 0)
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/path/test.lua | function test_splitenv_win(t)
if not is_host("windows") then
return t:skip("wrong host platform")
end
t:are_equal(path.splitenv(""), {})
t:are_equal(path.splitenv("a"), {'a'})
t:are_equal(path.splitenv("a;b"), {'a','b'})
t:are_equal(path.splitenv(";;a;;b;"), {'a','b'})
t:are_equal(path.splitenv('c:/a;c:\\b'), {'c:/a', 'c:\\b'})
t:are_equal(path.splitenv('"a;aa;aa;;"'), {"a;aa;aa;;"})
t:are_equal(path.splitenv('"a;aa;aa;;";bb;;'), {"a;aa;aa;;", 'bb'})
t:are_equal(path.splitenv('"a;aa;aa;;";"a;cc;aa;;";bb;"d";'), {"a;aa;aa;;","a;cc;aa;;", 'bb', 'd' })
end
function test_splitenv_unix(t)
if is_host("windows") then
return t:skip("wrong host platform")
end
t:are_equal(path.splitenv(""), {})
t:are_equal(path.splitenv("a"), {'a'})
t:are_equal(path.splitenv("a:b"), {'a','b'})
t:are_equal(path.splitenv("::a::b:"), {'a','b'})
t:are_equal(path.splitenv('a%tag:b'), {'a','b'})
t:are_equal(path.splitenv('a%tag:b%tag'), {'a','b'})
t:are_equal(path.splitenv('a%tag:b%%tag%%'), {'a','b'})
t:are_equal(path.splitenv('a%tag:b:%tag:'), {'a','b'})
end
function test_extension(t)
t:are_equal(path.extension("1.1/abc"), "")
t:are_equal(path.extension("1.1\\abc"), "")
t:are_equal(path.extension("foo.so"), ".so")
t:are_equal(path.extension("/home/foo.so"), ".so")
t:are_equal(path.extension("\\home\\foo.so"), ".so")
end
function test_directory(t)
t:are_equal(path.directory(""), nil)
t:are_equal(path.directory("."), nil)
t:are_equal(path.directory("foo"), ".")
if is_host("windows") then
t:are_equal(path.directory("c:"), nil)
t:are_equal(path.directory("c:\\"), nil)
t:are_equal(path.directory("c:\\xxx"), "c:")
t:are_equal(path.directory("c:\\xxx\\yyy"), "c:\\xxx")
else
t:are_equal(path.directory("/tmp"), "/")
t:are_equal(path.directory("/tmp/"), "/")
t:are_equal(path.directory("/tmp/xxx"), "/tmp")
t:are_equal(path.directory("/tmp/xxx/"), "/tmp")
t:are_equal(path.directory("/"), nil)
end
end
function test_absolute(t)
t:are_equal(path.absolute("", ""), nil)
t:are_equal(path.absolute(".", "."), ".")
if is_host("windows") then
t:are_equal(path.absolute("foo", "c:"), "c:\\foo")
t:are_equal(path.absolute("foo", "c:\\"), "c:\\foo")
t:are_equal(path.absolute("foo", "c:\\tmp"), "c:\\tmp\\foo")
t:are_equal(path.absolute("foo", "c:\\tmp\\"), "c:\\tmp\\foo")
else
t:are_equal(path.absolute("", "/"), nil)
t:are_equal(path.absolute("/", "/"), "/")
t:are_equal(path.absolute(".", "/"), "/")
t:are_equal(path.absolute("foo", "/tmp/"), "/tmp/foo")
t:are_equal(path.absolute("foo", "/tmp"), "/tmp/foo")
end
end
function test_relative(t)
t:are_equal(path.relative("", ""), nil)
t:are_equal(path.relative(".", "."), ".")
if is_host("windows") then
t:are_equal(path.relative("c:", "c:\\"), ".")
t:are_equal(path.relative("c:\\foo", "c:\\foo"), ".")
t:are_equal(path.relative("c:\\foo", "c:\\"), "foo")
t:are_equal(path.relative("c:\\tmp\\foo", "c:\\tmp"), "foo")
t:are_equal(path.relative("c:\\tmp\\foo", "c:\\tmp\\"), "foo")
else
t:are_equal(path.relative("", "/"), nil)
t:are_equal(path.relative("/", "/"), ".")
t:are_equal(path.relative("/tmp/foo", "/tmp/"), "foo")
t:are_equal(path.relative("/tmp/foo", "/tmp"), "foo")
end
end
function test_translate(t)
t:are_equal(path.translate(""), nil)
t:are_equal(path.translate("."), ".")
t:are_equal(path.translate(".."), "..")
if is_host("windows") then
t:are_equal(path.translate("c:"), "c:")
t:are_equal(path.translate("c:\\"), "c:")
t:are_equal(path.translate("c:\\foo\\\\\\"), "c:\\foo")
t:are_equal(path.translate("c:\\foo\\..\\.."), "c:\\foo\\..\\..")
else
t:are_equal(path.translate("/"), "/");
t:are_equal(path.translate("////"), "/");
t:are_equal(path.translate("/foo//////"), "/foo");
t:are_equal(path.translate("/foo/../.."), "/foo/../..");
t:are_equal(path.translate("/foo/../../"), "/foo/../..");
end
end
function test_normalize(t)
t:are_equal(path.normalize("././."), ".")
t:are_equal(path.normalize("../foo/.."), "..")
t:are_equal(path.normalize("../foo/bar/../.."), "..")
if is_host("windows") then
t:are_equal(path.normalize("c:\\foo\\.\\.\\"), "c:\\foo")
t:are_equal(path.normalize("c:\\foo\\bar\\.\\..\\xyz"), "c:\\foo\\xyz")
t:are_equal(path.normalize("c:\\foo\\.\\.."), "c:")
t:are_equal(path.normalize("../.."), "..\\..")
t:are_equal(path.normalize("../foo/bar/.."), "..\\foo")
t:are_equal(path.normalize("../foo/bar/../../.."), "..\\..")
else
t:are_equal(path.normalize("/foo/././"), "/foo");
t:are_equal(path.normalize("/./././"), "/");
t:are_equal(path.normalize("/foo/bar/.//..//xyz"), "/foo/xyz");
t:are_equal(path.normalize("/foo/../.."), "/");
t:are_equal(path.normalize("/foo/bar../.."), "/foo");
t:are_equal(path.normalize("../.."), "../..");
t:are_equal(path.normalize("../foo/bar/.."), "../foo");
t:are_equal(path.normalize("../foo/bar/../../.."), "../..");
end
end
function test_instance(t)
t:are_equal(path("/tmp/a"):str(), "/tmp/a")
t:are_equal(path("/tmp/a"):directory():str(), "/tmp")
t:are_equal(path("/tmp/a", function (p) return "--key=" .. p end):str(), "--key=/tmp/a")
t:are_equal(path("/tmp/a", function (p) return "--key=" .. p end):rawstr(), "/tmp/a")
t:are_equal(path("/tmp/a", function (p) return "--key=" .. p end):clone():set("/tmp/b"):str(), "--key=/tmp/b")
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/graph/test.lua | import("core.base.graph")
function test_topological_sort(t)
local edges = {
{0, 5},
{0, 2},
{0, 1},
{3, 6},
{3, 5},
{3, 4},
{5, 4},
{6, 4},
{6, 0},
{3, 2},
{1, 4},
}
local dag = graph.new(true)
for _, e in ipairs(edges) do
dag:add_edge(e[1], e[2])
end
local order_path = dag:topological_sort()
local orders = {}
for i, v in ipairs(order_path) do
orders[v] = i
end
for _, e in ipairs(edges) do
t:require(orders[e[1]] < orders[e[2]])
end
dag = dag:reverse()
order_path = dag:topological_sort()
orders = {}
for i, v in ipairs(order_path) do
orders[v] = i
end
for _, e in ipairs(edges) do
t:require(orders[e[1]] > orders[e[2]])
end
end
function test_find_cycle(t)
local edges = {
{9, 1},
{1, 6},
{6, 0},
{0, 1},
{4, 5}
}
local dag = graph.new(true)
for _, e in ipairs(edges) do
dag:add_edge(e[1], e[2])
end
local cycle = dag:find_cycle()
t:are_equal(cycle, {1, 6, 0})
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/pipe/pipe_pair.lua | import("core.base.pipe")
import("core.base.bytes")
function main()
local buff = bytes(8192)
local rpipe, wpipe = pipe.openpair()
wpipe:write("hello xmake!", {block = true})
local read, data = rpipe:read(buff, 13)
if read > 0 and data then
data:dump()
end
rpipe:close()
wpipe:close()
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/pipe/sched_pipe_pair.lua | import("core.base.pipe")
import("core.base.bytes")
import("core.base.scheduler")
function _session_read(id, pipefile)
print("%s/%d: read ..", pipefile, id)
local result = nil
local buff = bytes(8192)
for i = 1, 10000 do
local read, data = pipefile:read(buff, 12, {block = true})
if read > 0 and data then
result = data:str()
end
end
print("%s/%d: read ok, data: %s", pipefile, id, result and result or "")
pipefile:close()
end
function _session_write(id, pipefile)
print("%s/%d: write ..", pipefile, id)
for i = 1, 10000 do
pipefile:write("hello xmake!", {block = true})
end
print("%s/%d: write ok", pipefile, id)
pipefile:close()
end
function _session(id)
local rpipe, wpipe = pipe.openpair()
scheduler.co_start(_session_read, id, rpipe)
scheduler.co_start(_session_write, id, wpipe)
end
function main(count)
count = count and tonumber(count) or 1
for i = 1, count do
scheduler.co_start(_session, i)
end
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/pipe/echo_client.lua | import("core.base.pipe")
function main(name)
local pipefile = pipe.open(name or "test", 'w')
local count = 0
while count < 10000 do
local write = pipefile:write("hello world..", {block = true})
if write <= 0 then
break
end
count = count + 1
end
print("%s: write ok, count: %d!", pipefile, count)
pipefile:close()
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/pipe/echo_server.lua | import("core.base.pipe")
import("core.base.bytes")
function main(name)
local buff = bytes(8192)
local pipefile = pipe.open(name or "test", 'r')
if pipefile:connect() > 0 then
print("%s: connected", pipefile)
local count = 0
local result = nil
while count < 10000 do
local read, data = pipefile:read(buff, 13, {block = true})
if read > 0 then
result = data
count = count + 1
else
break
end
end
print("%s: read: %d, count: %d", pipefile, result and result:size() or 0, count)
result:dump()
end
pipefile:close()
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/pipe/sched_echo_client.lua | import("core.base.pipe")
import("core.base.scheduler")
function _session(id)
local pipefile = pipe.open("test" .. id, 'w')
local count = 0
while count < 10000 do
local write = pipefile:write("hello world..", {block = true})
if write <= 0 then
break
end
count = count + 1
end
print("%s/%d: write ok, count: %d!", pipefile, id, count)
pipefile:close()
end
function main(count)
count = count and tonumber(count) or 1
for i = 1, count do
scheduler.co_start(_session, i)
end
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/pipe/sched_echo_server.lua | import("core.base.pipe")
import("core.base.bytes")
import("core.base.scheduler")
function _session(id)
local pipefile = pipe.open("test" .. id, 'r')
if pipefile:connect() > 0 then
print("%s/%d: connected", pipefile, id)
local count = 0
local result = nil
local buff = bytes(8192)
while count < 10000 do
local read, data = pipefile:read(buff, 13, {block = true})
if read > 0 then
result = data
count = count + 1
else
break
end
end
print("%s/%d: read: %d, count: %d", pipefile, id, result and result:size() or 0, count)
result:dump()
end
pipefile:close()
end
function main(count)
count = count and tonumber(count) or 1
for i = 1, count do
scheduler.co_start(_session, i)
end
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/scheduler/spinner.lua | import("async.runjobs")
function main()
printf("testing .. ")
runjobs("test", function ()
os.sleep(10000)
end, {progress = true})
print("ok")
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/scheduler/runjobs.lua | import("core.base.scheduler")
import("private.async.jobpool")
import("async.runjobs")
function _jobfunc(index, total, opt)
print("%s: run job (%d/%d)", scheduler.co_running(), index, total)
local dt = os.mclock()
os.sleep(1000)
dt = os.mclock() - dt
print("%s: run job (%d/%d) end, progress: %s, dt: %d ms", scheduler.co_running(), index, total, opt.progress, dt)
end
function main()
-- test callback
print("==================================== test callback ====================================")
local t = os.mclock()
runjobs("test", _jobfunc, {total = 100, comax = 6, timeout = 1000, timer = function (running_jobs_indices)
print("%s: timeout (%d ms), running: %s", scheduler.co_running(), os.mclock() - t, table.concat(running_jobs_indices, ","))
end})
-- test jobs
print("==================================== test jobs ====================================")
local jobs = jobpool.new()
local root = jobs:addjob("job/root", function (index, total, opt)
_jobfunc(index, total, opt)
end)
for i = 1, 3 do
local job = jobs:addjob("job/" .. i, function (index, total, opt)
_jobfunc(index, total, opt)
end, {rootjob = root})
for j = 1, 50 do
jobs:addjob("job/" .. i .. "/" .. j, function (index, total, opt)
_jobfunc(index, total, opt)
end, {rootjob = job})
end
end
t = os.mclock()
runjobs("test", jobs, {comax = 6, timeout = 1000, timer = function (running_jobs_indices)
print("%s: timeout (%d ms), running: %s", scheduler.co_running(), os.mclock() - t, table.concat(running_jobs_indices, ","))
end})
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/scheduler/test.lua | import("core.base.scheduler")
function test_group(t)
local count = 0
local task = function (a)
t:are_equal(a, "xmake!")
count = count + 1
end
scheduler.co_group_begin("test", function ()
for i = 1, 100 do
scheduler.co_start(task, "xmake!")
end
end)
scheduler.co_group_wait("test")
t:are_equal(count, 100)
end
function test_sleep(t)
local count = 0
local task = function (a)
local dt = os.mclock()
os.sleep(500)
dt = os.mclock() - dt
t:require(dt > 100 and dt < 1000)
count = count + 1
end
for i = 1, 3 do
scheduler.co_start(task)
end
end
function test_yield(t)
local count = 0
local task = function (a)
scheduler.co_yield()
count = count + 1
end
scheduler.co_group_begin("test", function ()
for i = 1, 10 do
scheduler.co_start(task)
end
end)
scheduler.co_group_wait("test")
t:are_equal(count, 10)
end
function test_runjobs(t)
import("async.runjobs")
local total = 100
local comax = 6
local count = 0
runjobs("test", function (index)
t:require(index >= 1 and index <= total)
count = count + 1
end, {total = total, comax = comax})
t:are_equal(count, total)
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/scheduler/yield.lua | import("core.base.scheduler")
function _session(id)
print("test: %d ..", id)
scheduler.co_yield()
print("test: %d end", id)
end
function main()
for i = 1, 10 do
scheduler.co_start(_session, i)
end
end
|
0 | repos/xmake/tests/modules | repos/xmake/tests/modules/scheduler/sleep.lua | import("core.base.scheduler")
function _session2(id)
print("session2: %d ..", id)
local dt = os.mclock()
os.sleep(1000)
dt = os.mclock() - dt
print("session2: %d end, dt: %d ms", id, dt)
end
function _session1(id)
print("session1: %d ..", id)
local dt = os.mclock()
scheduler.co_sleep(1000)
dt = os.mclock() - dt
print("session1: %d end, dt: %d ms", id, dt)
end
function main()
for i = 1, 10 do
scheduler.co_start(_session1, i)
scheduler.co_start(_session2, i)
end
end
|
0 | repos/xmake/tests/plugins | repos/xmake/tests/plugins/pack/xmake.lua | set_version("1.0.0")
add_rules("mode.debug", "mode.release")
includes("@builtin/xpack")
add_requires("zlib", {configs = {shared = true}})
target("test")
set_kind("binary")
add_files("src/*.cpp")
if is_plat("windows") then
add_files("src/*.rc")
end
target("foo")
set_kind("shared")
add_files("src/*.cpp")
add_headerfiles("include/(*.h)")
add_packages("zlib")
xpack("test")
set_formats("nsis", "srpm", "rpm", "deb", "zip", "targz", "srczip", "srctargz", "runself", "wix")
set_title("hello")
set_author("ruki <[email protected]>")
set_description("A test installer.")
set_homepage("https://xmake.io")
set_license("Apache-2.0")
set_licensefile("LICENSE.md")
add_targets("test", "foo")
add_installfiles("src/(assets/*.png)", {prefixdir = "images"})
add_sourcefiles("(src/**)")
add_sourcefiles("xmake.lua")
set_iconfile("src/assets/xmake.ico")
add_components("LongPath")
on_load(function (package)
if package:with_source() then
package:set("basename", "test-$(plat)-src-v$(version)")
else
package:set("basename", "test-$(plat)-$(arch)-v$(version)")
end
end)
after_installcmd(function (package, batchcmds)
if package:format() == "runself" then
batchcmds:runv("echo", {"hello"})
else
batchcmds:mkdir(package:installdir("resources"))
batchcmds:cp("src/assets/*.txt", package:installdir("resources"), {rootdir = "src"})
batchcmds:mkdir(package:installdir("stub"))
end
end)
after_uninstallcmd(function (package, batchcmds)
batchcmds:rmdir(package:installdir("resources"))
batchcmds:rmdir(package:installdir("stub"))
end)
xpack_component("LongPath")
set_default(false)
set_title("Enable Long Path")
set_description("Increases the maximum path length limit, up to 32,767 characters (before 256).")
on_installcmd(function (component, batchcmds)
batchcmds:rawcmd("wix", [[
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Control\FileSystem">
<RegistryValue Type="integer" Name="LongPathsEnabled" Value="1" KeyPath="yes"/>
</RegistryKey>
]])
batchcmds:rawcmd("nsis", [[
${If} $NoAdmin == "false"
; Enable long path
WriteRegDWORD ${HKLM} "SYSTEM\CurrentControlSet\Control\FileSystem" "LongPathsEnabled" 1
${EndIf}]])
end)
|
0 | repos/xmake/tests/plugins | repos/xmake/tests/plugins/pack/LICENSE.md |
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2015-present TBOOX Open Source Group
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
0 | repos/xmake/tests/plugins/pack | repos/xmake/tests/plugins/pack/src/xmake.rc | IDI_APP ICON DISCARDABLE "assets/xmake.ico"
|
0 | repos/xmake/tests/plugins/pack | repos/xmake/tests/plugins/pack/src/main.cpp | #include <iostream>
using namespace std;
int main(int argc, char** argv)
{
cout << "hello world!" << endl;
return 0;
}
|
0 | repos/xmake/tests/plugins/pack/src | repos/xmake/tests/plugins/pack/src/assets/file2.txt | hello
|
0 | repos/xmake/tests/plugins/pack/src | repos/xmake/tests/plugins/pack/src/assets/file1.txt | hello
|
0 | repos/xmake/tests/plugins | repos/xmake/tests/plugins/project/test.lua | import("core.project.config")
import("core.platform.platform")
import("core.tool.toolchain")
import("lib.detect.find_tool")
function test_vsxmake(t)
if not is_subhost("windows") then
return t:skip("wrong host platform")
end
local projname = "testproj"
local tempdir = os.tmpfile()
os.mkdir(tempdir)
os.cd(tempdir)
-- create project
os.vrunv("xmake", {"create", projname})
os.cd(projname)
-- set config
local arch = os.getenv("platform") or "x86"
config.set("arch", arch, {readonly = true, force = true})
platform.load(config.plat(), arch):check()
-- create sln & vcxproj
local vs = config.get("vs")
local vstype = "vsxmake" .. vs
os.execv("xmake", {"project", "-k", vstype, "-a", arch})
os.cd(vstype)
-- run msbuild
try
{
function ()
local runenvs = toolchain.load("msvc"):runenvs()
local msbuild = find_tool("msbuild", {envs = runenvs})
os.execv(msbuild.program, {"/P:XmakeDiagnosis=true", "/P:XmakeVerbose=true"}, {envs = runenvs})
end,
catch
{
function ()
print("--- sln file ---")
io.cat(projname .. ".sln")
print("--- vcx file ---")
io.cat(projname .. "/" .. projname .. ".vcxproj")
print("--- filter file ---")
io.cat(projname .. "/" .. projname .. ".vcxproj.filters")
raise("msbuild failed")
end
}
}
-- clean up
os.cd(os.scriptdir())
os.tryrm(tempdir)
end
function test_compile_commands(t)
local projname = "testproj"
local tempdir = os.tmpfile()
os.mkdir(tempdir)
os.cd(tempdir)
-- create project
os.vrunv("xmake", {"create", projname})
os.cd(projname)
-- generate compile_commands
os.vrunv("xmake", {"project", "-k", "compile_commands"})
-- test autoupdate
io.insert("xmake.lua", 1, 'add_rules("plugin.compile_commands.autoupdate", {outputdir = ".vscode", lsp = "clangd"})')
os.vrun("xmake")
-- clean up
os.cd(os.scriptdir())
os.tryrm(tempdir)
end
function test_cmake(t)
local cmake = find_tool("cmake")
if not cmake then
return t:skip("cmake not found")
end
local projname = "testproj"
local tempdir = os.tmpfile()
os.mkdir(tempdir)
os.cd(tempdir)
-- create project
os.vrunv("xmake", {"create", projname})
os.cd(projname)
-- generate compile_commands
os.vrunv("xmake", {"project", "-k", "cmake"})
-- test build
os.mkdir("build")
os.cd("build")
os.vrunv(cmake.program, {".."})
os.vrunv(cmake.program, {"--build", "."})
-- clean up
os.cd(os.scriptdir())
os.tryrm(tempdir)
end
|
0 | repos/xmake/tests/plugins | repos/xmake/tests/plugins/create/test.lua | function main ()
os.tryrm("$(tmpdir)/test_create")
os.exec("xmake create -P $(tmpdir)/test_create/test")
os.exec("xmake -P $(tmpdir)/test_create/test")
os.exec("xmake create -l c++ -P $(tmpdir)/test_create/test_cpp")
os.exec("xmake -P $(tmpdir)/test_create/test_cpp")
os.exec("xmake create -l c++ -t static -P $(tmpdir)/test_create/test_cpp2")
os.exec("xmake -P $(tmpdir)/test_create/test_cpp2")
os.exec("xmake create -l c++ -t shared -P $(tmpdir)/test_create/test_cpp3")
os.exec("xmake -P $(tmpdir)/test_create/test_cpp3")
end
|
0 | repos/xmake/tests | repos/xmake/tests/test_utils/context.lua | import("test_build")
import("test_skip")
import("test_assert")
function main(filename)
local context = { filename = filename }
table.join2(context, test_build())
table.join2(context, test_skip())
table.join2(context, test_assert())
return context
end |
0 | repos/xmake/tests | repos/xmake/tests/test_utils/test_assert.lua |
import("check")
local test_assert = { print_error = import("print_error", { anonymous = true }).main }
function test_assert:require(value)
if not value then
self:print_error(vformat("require ${green}true${reset} but got ${red}%s${reset}", value), self.filename)
end
end
function test_assert:require_not(value)
if value then
self:print_error(vformat("require ${green}false${reset} but got ${red}%s${reset}", value), self.filename)
end
end
function test_assert:are_same(actual, expected)
local r, ap, ep = check.same(actual, expected)
if not r then
self:print_error(format("expected: ${green}%s${reset}, actual ${red}%s${reset}", ep, ap), self.filename)
end
end
function test_assert:are_not_same(actual, expected)
local r, ap, ep = check.same(actual, expected)
if r then
self:print_error(format("expected: ${green}%s${reset}, actual ${red}%s${reset}", ep, ap), self.filename)
end
end
function test_assert:are_equal(actual, expected)
local r, ap, ep = check.equal(actual, expected)
if not r then
self:print_error(format("expected: ${green}%s${reset}, actual ${red}%s${reset}", ep, ap), self.filename)
end
end
function test_assert:are_not_equal(actual, expected)
local r, ap, ep = check.equal(actual, expected)
if r then
self:print_error(format("expected: ${green}%s${reset}, actual ${red}%s${reset}", ep, ap), self.filename)
end
end
test_assert._will_raise_stack = {}
function test_assert:will_raise(func, message_pattern)
table.insert(self._will_raise_stack, 1, debug.getinfo(2).func)
try
{
func,
finally
{
function (ok, error)
local funcs = { func, unpack(self._will_raise_stack) }
if ok then
self:print_error("expected raise but finished successfully", funcs)
elseif message_pattern and not error:find(message_pattern, 1, true) and not error:find(message_pattern) then
self:print_error(format("expected raise with message ${green}%s${reset} but got ${red}%s${reset}", message_pattern, error), funcs)
end
end
}
}
table.remove(self._will_raise_stack, 1)
end
function main()
return test_assert
end
|
0 | repos/xmake/tests | repos/xmake/tests/test_utils/test_skip.lua | local test_skip = { _is_skipped_tag = {true} }
function test_skip:skip(reason)
return { is_skipped = self._is_skipped_tag, reason = reason, context = self }
end
function test_skip:is_skipped(result)
return result and result.context and result.context._is_skipped_tag == result.is_skipped
end
function main()
return test_skip
end |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.