diff options
| author | ruki <[email protected]> | 2026-01-25 22:00:34 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-25 22:00:34 +0800 |
| commit | 6fcf5e669360703422288e26d16f47ca4cda7ade (patch) | |
| tree | 14530619ff8519f7aa90afed9aa26763a6d3917a /xmake/modules/core/tools/fpc.lua | |
| parent | c3989a33c7644a43d4c3cc5567e4e117785bc67d (diff) | |
| parent | 998581c1cc5af94486d9f631a64e7721a3f84031 (diff) | |
Merge pull request #7260 from xmake-io/fpc
Improve fpc
Diffstat (limited to 'xmake/modules/core/tools/fpc.lua')
| -rw-r--r-- | xmake/modules/core/tools/fpc.lua | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/xmake/modules/core/tools/fpc.lua b/xmake/modules/core/tools/fpc.lua index 18298cd6c..c08fcef14 100644 --- a/xmake/modules/core/tools/fpc.lua +++ b/xmake/modules/core/tools/fpc.lua @@ -102,14 +102,56 @@ function nf_frameworkdir(self, frameworkdir) return {"-k-F", path.translate(frameworkdir)} end +-- make the includedir flag +function nf_includedir(self, includedir) + return {"-Fi" .. path.translate(includedir)} +end + +-- make the define flag +function nf_define(self, macro) + return {"-d" .. macro} +end + +-- make the undefine flag +function nf_undefine(self, macro) + return {"-u" .. macro} +end + +-- make the language flag +function nf_language(self, language) + local mode = { + pascal = "-Mfpc", + fpc = "-Mfpc", + objfpc = "-Mobjfpc", + delphi = "-Mdelphi", + macpas = "-Mmacpas", + isopas = "-Miso", + extendedpascal = "-Mextendedpascal", + delphiunicode = "-Mdelphiunicode", + } + return mode[language:lower()] +end + +-- make the exception flag +-- considering this applies to all dialects, +-- make this only accept on/off +function nf_exception(self, exp) + return {exp == "off" and "-Sx-" or "-Sx"} +end + -- make the build arguments list -function buildargv(self, sourcefiles, targetkind, targetfile, flags) - return self:program(), table.join(flags, "-o" .. targetfile, sourcefiles) +function buildargv(self, sourcefiles, targetkind, targetfile, flags, opt) + opt = opt or {} + local extraflags = {} + local objectdir = opt.target and opt.target:objectdir() + if objectdir then + table.insert(extraflags, "-FU" .. path.translate(objectdir)) + end + return self:program(), table.join(flags, extraflags, "-o" .. targetfile, sourcefiles) end -- build the target file -function build(self, sourcefiles, targetkind, targetfile, flags) +function build(self, sourcefiles, targetkind, targetfile, flags, opt) os.mkdir(path.directory(targetfile)) - os.runv(buildargv(self, sourcefiles, targetkind, targetfile, flags)) + os.runv(buildargv(self, sourcefiles, targetkind, targetfile, flags, opt)) end - |
