diff --git a/src/_premake_init.lua b/src/_premake_init.lua index e6e97cf3..5552ef51 100644 --- a/src/_premake_init.lua +++ b/src/_premake_init.lua @@ -644,6 +644,16 @@ tokens = true, } + api.register { + name = "pic", + scope = "config", + kind = "string", + allowed = { + "Off", + "On", + } + } + api.register { name = "platforms", scope = "project", @@ -1148,4 +1158,7 @@ targetextension ".dll" implibextension ".dll" + filter { "kind:SharedLib", "system:not Windows" } + pic "On" + filter {} diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua index 694e5412..df35b2b3 100644 --- a/src/tools/gcc.lua +++ b/src/tools/gcc.lua @@ -48,11 +48,6 @@ Fast = "-ffast-math", Strict = "-ffloat-store", }, - kind = { - SharedLib = function(cfg) - if cfg.system ~= premake.WINDOWS then return "-fPIC" end - end, - }, strictaliasing = { Off = "-fno-strict-aliasing", Level1 = { "-fstrict-aliasing", "-Wstrict-aliasing=1" }, @@ -67,6 +62,9 @@ Size = "-Os", Speed = "-O3", }, + pic = { + On = "-fPIC", + }, vectorextensions = { AVX = "-mavx", AVX2 = "-mavx2",