premake/premake-core

[gmake2] Add specific support for std library

Ouverte

#2 165 ouverte le 28 nov. 2023

 (8 commentaires) (0 réaction) (0 personne assignée)C (651 forks)auto 404
enhancementgood first issue

Métriques du dépôt

Stars
 (3 621 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

Currently, on Linux, if I want to steer off from my system's default "libstdc++" and specify a different standard library implementation (often a must when using a compiler that isn't GCC to prevent compilation errors due to the compiler not being able to compile with libstdc++) I must do the following:

buildoptions "-stdlib=libc++"
linkoptions "-stdlib=libc++"

Because in my actual project I will be using clang, this will tell the compiler and linker to use the std library from the llvm-project itself which will have optimal compatibility with the compiler. I found there are no shorter or other premake settings for achieving a similar result so it must be done manually via buildoptions and linkoptions

What problem will this solve? The goal of this feature request is to have shorter Premake5 config files via specific premake5 config options that will convert the verbose buildoptions and linkoptions to one shorter setting.

What might be a solution? A solution that could be ideal would be one option that supports either a predefined list of the most popular std libraries or any input it receives. For example:

Premake5.lua

library="libc++"

This setting will convert the input to the required build and link option without the user having to spend too much time on the task. I lost a good amount of minutes because my project failed to link only to learn I was missing the "link option".

What other alternatives have you already considered? There are no solutions apart from using the most basic build and link option settings

Anything else we should know? This should only be an issue to tackle on gmake2 for Linux systems, I don't think on macos such a problem would ever arise but I personally do not know since I am not a macos user. This would not be an uncommon Premake5 setting as there are many other Premake5 settings that convert simple inputs to trivial settings in the final makefile.

The simplest I can think of is the "symbols" Premake5 settings which depending on the input might only add an "-S" to the final build options.

Guide contributeur