PremakeDeps

警告

此功能为实验性功能,可能会有破坏性更改。有关更多信息,请参阅 Conan 稳定性 部分。

PremakeDeps 是 Premake 的依赖生成器。

PremakeDeps 生成器可以在 conanfile 中通过名称使用

conanfile.py
class Pkg(ConanFile):
    generators = "PremakeDeps"
conanfile.txt
[generators]
PremakeDeps

并且它也可以在 conanfile 的 generate() 方法中完全实例化

from conan import ConanFile
from conan.tools.premake import PremakeDeps

class App(ConanFile):
    settings = "os", "arch", "compiler", "build_type"
    requires = "zlib/1.2.11"

    def generate(self):
        bz = PremakeDeps(self)
        bz.generate()

生成的文件

当使用 PremakeDeps 生成器时,每次调用 conan install 都会生成一个 include('conandeps.premake5.lua'),可以在项目中包含和使用

-- premake5.lua

include('conandeps.premake5.lua')

workspace "HelloWorld"
    conan_setup()
    configurations { "Debug", "Release" }
    platforms { "x86_64" }