Search & research
name: xmake-pascal
description: Use when building Pascal projects with xmake —
xmake-pascal
Use when building Pascal projects with xmake — `.pas`/`.pp`/`.lpr` sources, FreePascal (`fpc`) / Delphi toolchain, binary and shared-library targets.
xmake-io · Static checks on file
Installation
Read the source and dependencies before running a command. Copying does not install or execute anything.
npx skills add xmake-io/xmake-skills --skill xmake-pascalAbout this skill
name: xmake-pascal
description: Use when building Pascal projects with xmake — .pas/.pp/.lpr sources, FreePascal (fpc) / Delphi toolchain, binary and shared-library targets.
Building Pascal with Xmake
Xmake supports Pascal (via FreePascal fpc) since v2.5.8.
1. Minimal project
add_rules("mode.debug", "mode.release")
target("hello")
set_kind("binary")
add_files("src/main.pas")
Recognized extensions: .pas, .pp, .lpr.
2. Target kinds
target("app") set_kind("binary")
target("mylib") set_kind("shared") -- .so / .dll
target("staticlib") set_kind("static") -- .a / .lib
Shared library example:
target("mylib")
set_kind("shared")
add_files("src/lib.pas")
3. Flags
target("app")
add_files("src/*.pas")
add_pcflags("-O3", "-Xs") -- fpc flags (strip symbols)
4. Toolchain
xmake f --toolchain=fpc # FreePascal
xmake f --toolchain=fpc --sdk=/opt/fpc-3.2
Pitfalls
- Project file format.
.lpris the standard program entry for Lazarus projects — use it as theadd_filesentry, not unit files. - Unit dependency ordering.
fpchandles unit deps itself; don't enumerate dependencies manually unless you have a reason. - Cross-compile. FreePascal supports many targets but the config is fpc-specific; see FreePascal docs for
-T<target>/-P<arch>.
When to branch out
- Target basics →
xmake-targets - Cross-compile →
xmake-cross-compilation