Skip to content

Commit 1ce982d

Browse files
authored
Pramake: added example for using a custom configuration (#4313)
* Pramake: added example for using a custom configuration * Clarification
1 parent 1d27b3a commit 1ce982d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

reference/tools/premake/premake.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,40 @@ The ``Premake`` build helper is affected by these ``[conf]`` variables:
5757
- ``tools.build:verbosity`` which accepts one of ``quiet`` or ``verbose`` and sets the ``--quiet`` flag in ``Premake.configure()``
5858

5959
- ``tools.compilation:verbosity`` which accepts one of ``quiet`` or ``verbose`` and sets the ``--verbose`` flag in ``Premake.build()``
60+
61+
Extra configuration
62+
-------------------
63+
64+
By default, typical Premake configurations are ``Release`` and ``Debug``.
65+
This configurations could vary depending on the used Premake script.
66+
67+
For example,
68+
69+
.. code-block:: lua
70+
71+
workspace "MyProject"
72+
configurations { "Debug", "Release", "DebugDLL", "ReleaseDLL" }
73+
74+
If you wish to use a different configuration than ``Release`` or ``Debug``, you can override the configuration from the ``Premake`` generator.
75+
76+
If the project also have dependencies, you will also need to override the
77+
``configuration`` property of the ``PremakeDeps`` generator accordingly, with the same value.
78+
79+
.. code-block:: python
80+
81+
class MyRecipe(Conanfile):
82+
...
83+
def _premake_configuration(self):
84+
return str(self.settings.build_type) + ("DLL" if self.options.shared else "")
85+
86+
def generate(self):
87+
deps = PremakeDeps(self)
88+
deps.configuration = self._premake_configuration
89+
deps.generate()
90+
tc = PremakeToolchain(self)
91+
tc.generate()
92+
93+
def build(self):
94+
premake = Premake(self)
95+
premake.configure()
96+
premake.build(workspace="MyProject", configuration=self._premake_configuration)

0 commit comments

Comments
 (0)