Skip to content

Instantly share code, notes, and snippets.

@nrbnlulu
Created August 28, 2023 07:46
Show Gist options
  • Save nrbnlulu/3559bf4d06449e5cde720b7aa17a2770 to your computer and use it in GitHub Desktop.
Save nrbnlulu/3559bf4d06449e5cde720b7aa17a2770 to your computer and use it in GitHub Desktop.
conanfile for qt6
from __future__ import annotations
import contextlib
import glob
import os
import subprocess
from functools import cached_property
from pathlib import Path
from conan import ConanFile
from conan.tools.cmake import CMake
from conan.tools.cmake import cmake_layout
from conan.tools.cmake import CMakeDeps
from conan.tools.cmake import CMakeToolchain
ConanBool = [True, False]
__version__: str = "0.133.1"
os.environ.setdefault("NOT_ON_C3I", "1")
class T5HOBRecipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
name = "t5hob"
license = "MIT"
description = "t5hob native client with qt qml"
version = __version__
build_policy = "missing"
options = {"verbose": ConanBool, "test": ConanBool}
default_options = {
"verbose": False,
"test": False,
}
exports_sources = "CMakeLists.txt", "include/*", "pyproject.toml"
def requirements(self) -> None:
self.requires("qt/6.5.0")
def configure(self) -> None:
self.options["qt/*"].qtpositioning = True
self.options["qt/*"].qtquickcontrols2 = True
self.options["qt/*"].qtdeclarative = True
self.options["qt/*"].qtlocation = True
self.options["qt/*"].qtwebsockets = True
self.options["qt/*"].widgets = False
self.options["qt/*"].qtshadertools = True
def layout(self) -> None:
cmake_layout(self)
@property
def should_test(self) -> bool:
return False
def generate(self) -> None:
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.cache_variables["T5HOB_TESTING"] = self.should_test
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.libs = ["5hob"] # checks that can link against this lib name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment