bkaradzic / GENie

GENie - Project generator tool
Other
902 stars 167 forks source link

Add a "late" linkoptions #416

Open codecat opened 5 years ago

codecat commented 5 years ago

In the scripting reference for GENie it is mentioned that you can use pkg-config-style linker options. Which is great, but in practice it doesn't really work if you're using static libraries, because objects get placed after the link options, which means that commands like wx-config are ran too early, and the project won't be able to link against wx.

A possible solution to this would be some kind of "late" linkoptions function, which would let me add linkoptions some place after the project's object files.

I noticed #125 solved a similar problem, but that doesn't particularly work with things like wx-config.

codecat commented 5 years ago

I have found a workaround for this myself, but perhaps it's still worth looking into in the future - instead of just passing the output of wx-config to the linker options, I parse the output, find the included static libraries, and add those with link instead of linkoptions. eg:

for i, v in ipairs(libFlags) do
    if v:sub(1, 1) ~= '-' then
        links(v)
    else
        linkoptions(v)
    end
end

Not the nicest or cleanest solution, but it works.

flamendless commented 3 years ago

@codecat how do you do that exactly? I think this is what i also need to link gtk using pkg-config

codecat commented 3 years ago

Sorry this issue was a long time ago, I don't know the details of it anymore. I've also mostly switched over to Premake5 myself.

flamendless commented 3 years ago

@codecat i see. I'll try premake5 then