AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified Apache-2.0 Self-run

Xmake Cuda

skill-xmake-io-xmake-skills-xmake-cuda · by xmake-io

Use when building CUDA projects with xmake — `.cu` sources, `--cuda=` / `--cuda_sdkver=` SDK pinning, GPU architecture selection, device linking (`build.cuda.devlink`), and mixing CUDA with C++ targets.

No reviews yet
0 installs
7 views
0.0% view→install

Install

$ agentstack add skill-xmake-io-xmake-skills-xmake-cuda

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-xmake-io-xmake-skills-xmake-cuda)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Xmake Cuda? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Building CUDA with Xmake

Xmake detects CUDA automatically and handles device code + host code compilation, dependency scanning, and device linking.

1. Minimal project

xmake create -P test -l cuda
cd test
xmake
add_rules("mode.debug", "mode.release")

target("test")
    set_kind("binary")
    add_files("src/*.cu")

2. Target kinds

target("app")         set_kind("binary")
target("staticcuda")  set_kind("static")
target("sharedcuda")  set_kind("shared")

3. SDK / version selection

xmake f --cuda=/usr/local/cuda-12.2                 -- specific install
xmake f --cuda=12.2                                 -- version; looks up default install
xmake f --cuda_sdkver=11.8                          -- v3.0.5+, per-project SDK version
xmake f --cuda_sdkver=11.x                          -- any 11.x
xmake f --cuda_sdkver=auto                          -- auto-detect (default)

Persist globally:

xmake g --cuda=/usr/local/cuda-12.2

4. GPU architecture

target("app")
    add_files("src/*.cu")
    add_cugencodes("sm_70", "sm_86", "sm_90")          -- compile for these archs
    add_cugencodes("native")                           -- just the host GPU

add_cugencodes takes sm_XX strings or native. Multiple calls accumulate; xmake emits -gencode=arch=compute_XX,code=sm_XX per entry.

5. Device linking

Device-linking is automatic for binary and shared targets:

target("app")
    set_kind("binary")
    add_files("src/*.cu")
    -- device link runs automatically

Disable it (rarely needed):

set_policy("build.cuda.devlink", false)

static targets — manual device link

Static libraries are not device-linked by default. If a downstream binary has no .cu files but depends on a static cuda lib, you'll hit "undefined reference to __device_..." errors. Fix by opting in:

target("cudalib")
    set_kind("static")
    add_files("src/*.cu")
    add_values("cuda.build.devlink", true)         -- force device link for this static target

6. Mixing CUDA with C++

target("app")
    set_kind("binary")
    set_languages("c++17")
    add_files("src/*.cpp", "src/*.cu")
    add_cugencodes("sm_80")

Host code in .cpp and device code in .cu mix freely in one target. Xmake invokes nvcc for .cu and the normal C++ compiler for .cpp.

7. Flags

target("app")
    add_files("src/*.cu")
    add_cuflags("--use_fast_math", "-lineinfo")       -- nvcc flags
    add_cuflags("-Xcompiler=-fPIC", {force = true})   -- flags passed to host compiler via nvcc

add_cuflags = nvcc (cuda compiler) flags. For flags that must reach the host compiler (gcc/clang/msvc), use -Xcompiler=....

8. Cross-compile / Jetson / Tegra

xmake f -p linux -a arm64 --cuda=/usr/local/cuda-cross-aarch64
xmake

Point --cuda at a cross CUDA SDK. Jetson deployment targets generally set -a arm64.

Pitfalls

  • sm_xx vs compute capability. sm_86 means "Ampere RTX 30xx". add_cugencodes takes the binary code name, not the compute cap number.
  • Static lib with no device link. Undefined device-symbol errors at final link. add_values("cuda.build.devlink", true) on the static target.
  • Mixing hosts. Every .cu file gets compiled through nvcc, which calls the host compiler. If you mix toolchains (clang + nvcc that expects gcc), you hit header incompatibilities. Stick with the nvcc-supported host compiler for the CUDA version.
  • CUDA version vs host compiler version. Each CUDA release supports a specific range of gcc/clang/MSVC. Check NVIDIA's docs — "gcc 13 unsupported by CUDA 11.8" is a common surprise.
  • Too many sm_ targets. Each add_cugencodes entry doubles compile time. List only the GPUs you actually target.

When to branch out

  • Cross-compile generic plumbing → xmake-cross-compilation
  • Target basics, host C++ compilation → xmake-targets
  • Policies (including build.cuda.devlink) → xmake-policy

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.