add_defines("XXX") if is_plat("linux", "macosx") then add_defines("YYY") end 我们通过is_plat()判断,如果当前编译目标平台是linux或者macosx,那么target会额外增加-DYYY宏定义。 全局配置 我们在target("demo")下面的所有配置,都属于demo这个target子域,并不是全局的,所以你会看到通常配置上都加了缩进,...
if is_plat("macosx", "iphoneos", "android", "linux") then end 否则如果用lua的原生语法的话,虽然也可以,但是会很臃肿,例如: if is_plat("macosx") or is_plat("iphoneos") or is_plat("android") or is_plat("linux") then end 除了is_xxx系列,像:add_xxxs这种后缀有s的复数api,都是可以传...
if is_plat("macosx") then add_extsources("brew::sfml/sfml-all") end on_component("graphics", function (package, component) -- ... component:add("extsources", "brew::sfml/sfml-graphics") end) 默认的全局组件配置 除了通过指定组件名的方式,配置特定组件,如果我们没有指定组件名,默认就是全局...
on_component("window",function(package, component)locale =package:config("shared")and""or"-s"component:add("links","sfml-window".. e)ifpackage:is_plat("windows","mingw")andnotpackage:config("shared")thencomponent:add("syslinks","opengl32","gdi32","user32","advapi32")endend) ... ...
if package:is_plat("windows", "mingw") and not package:config("shared") then component:add("links", "freetype") component:add("syslinks", "opengl32", "gdi32", "user32", "advapi32") end end) on_component("window", function (package, component) ...
end)on_component("window",function(package,component)local e=package:config("shared")and""or"-s"component:add("links","sfml-window"..e)ifpackage:is_plat("windows","mingw")and notpackage:config("shared")thencomponent:add("syslinks","opengl32","gdi32","user32","advapi32")end ...
add_files("src/main.cpp")ifis_plat("linux","macosx")thenadd_syslinks("pthread","m","dl")endifis_plat("macosx")thenadd_frameworks("Foundation","CoreFoundation")endadd_linkorders("framework::Foundation","png16","foo") add_linkorders("dl","linkgroup::syslib") ...
if is_plat("macosx") then add_extsources("brew::sfml/sfml-all") end on_component("graphics", function (package, component) -- ... component:add("extsources", "brew::sfml/sfml-graphics") end) 默认的全局组件配置 除了通过指定组件名的方式,配置特定组件,如果我们没有指定组件名,默认就是全局...
end)rule("mode.release")after_load(function(target)ifis_mode("release")thenifnot target:get("symbols")and target:targetkind()~="shared"thentarget:set("symbols","hidden")endifnot target:get("optimize")thenifis_plat("android","iphoneos")thentarget:set("optimize","smallest")elsetarget:set(...
is_plat()判断平台. 多个目标,是单独的. 全局设置,放在最外面. -- 全局设置 add_defines("TEST") //加宏 if is_arch("arm64", "armv7") then add_defines("ARM") end 1. 2. 3. 4. 5. 6. 可用target_end()强制结束target子域,切回全局域. ...