From c660b69ea4fa30ef89c48500fb030fef5bc6da6b Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 11 Apr 2024 22:46:05 +0800 Subject: improve tinycc toolchain #4962 --- xmake/toolchains/tinycc/xmake.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'xmake/toolchains/tinycc/xmake.lua') diff --git a/xmake/toolchains/tinycc/xmake.lua b/xmake/toolchains/tinycc/xmake.lua index 21bb7be08..6ca46172f 100644 --- a/xmake/toolchains/tinycc/xmake.lua +++ b/xmake/toolchains/tinycc/xmake.lua @@ -20,22 +20,14 @@ -- define toolchain toolchain("tinycc") - - -- set homepage + set_kind("standalone") set_homepage("https://bellard.org/tcc/") set_description("Tiny C Compiler") - -- mark as standalone toolchain - set_kind("standalone") - - -- check toolchain on_check(function (toolchain) - - -- imports import("core.project.config") import("lib.detect.find_tool") - -- find tcc local paths = {toolchain:bindir()} local sdkdir = toolchain:sdkdir() if sdkdir then @@ -55,10 +47,7 @@ toolchain("tinycc") end end) - -- on load on_load(function (toolchain) - - -- imports import("core.project.config") -- add march flags @@ -91,4 +80,15 @@ toolchain("tinycc") toolchain:add("linkdirs", path.join(installdir, "lib")) end end + local sdkdir = package:sdkdir() + if os.isdir(sdkdir) then + local includedir = path.join(sdkdir, "include") + if os.isdir(includedir) then + toolchain:add("sysincludedirs", includedir) + end + local libdir = path.join(sdkdir, "lib") + if os.isdir(libdir) then + toolchain:add("linkdirs", libdir) + end + end end) -- cgit v1.3.1