summaryrefslogtreecommitdiff
path: root/tests/projects/linux/driver/hello_cross/xmake.lua
diff options
context:
space:
mode:
authorririyeye <[email protected]>2026-04-23 10:39:33 +0800
committerririyeye <[email protected]>2026-04-23 10:39:33 +0800
commit7b2c43757d8d51997087f14d24716e384db21b1d (patch)
tree548f05262f7d51974fd7cd1090dac728d9a3962f /tests/projects/linux/driver/hello_cross/xmake.lua
parentc110d46d8cbb7ce929a98c58fc43668431f9fbe8 (diff)
test add linux driver cross compile example
Add a minimal platform.linux.module sample that documents custom linux headers/builddir usage for cross toolchains and verifies the new cross-build workflow. Made-with: Cursor
Diffstat (limited to 'tests/projects/linux/driver/hello_cross/xmake.lua')
-rw-r--r--tests/projects/linux/driver/hello_cross/xmake.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/projects/linux/driver/hello_cross/xmake.lua b/tests/projects/linux/driver/hello_cross/xmake.lua
new file mode 100644
index 000000000..c5372de0b
--- /dev/null
+++ b/tests/projects/linux/driver/hello_cross/xmake.lua
@@ -0,0 +1,21 @@
+set_plat("linux")
+
+option("linux-headers", {showmenu = true, description = "Set kernel headers/source tree path."})
+option("linux-builddir", {showmenu = true, description = "Set kernel build/output tree path."})
+
+-- Example:
+-- xmake f -p linux -a arm64 --cc=/path/to/aarch64-linux-gnu-gcc \
+-- --ld=/path/to/aarch64-linux-gnu-ld \
+-- --linux-headers=/path/to/linux \
+-- --linux-builddir=/path/to/linux-out
+
+target("hello")
+ add_rules("platform.linux.module")
+ add_files("src/*.c")
+ set_license("GPL-2.0")
+ if has_config("linux-headers") then
+ set_values("linux.driver.linux-headers", get_config("linux-headers"))
+ end
+ if has_config("linux-builddir") then
+ set_values("linux.driver.linux-builddir", get_config("linux-builddir"))
+ end