init
This commit is contained in:
70
mingw-windows/conanfile.py
Normal file
70
mingw-windows/conanfile.py
Normal file
@@ -0,0 +1,70 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.files import copy
|
||||
import os
|
||||
|
||||
class MinGWQtConan(ConanFile):
|
||||
name = "qt"
|
||||
version = "5.14.2"
|
||||
|
||||
# Notice we keep build_type so Conan can generate
|
||||
# isolated Debug and Release packages upon user request.
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
|
||||
# We do not build anything, we just package the pre-compiled folders
|
||||
def build(self):
|
||||
pass
|
||||
|
||||
def package(self):
|
||||
# We know the absolute path of the local MinGW installation
|
||||
bin_path = r"C:\Qt\Qt5.14.2\5.14.2\mingw73_64"
|
||||
self.output.info(f"Packaging {bin_path}...")
|
||||
|
||||
# Copy bin, lib, include, mkspecs, plugins, qml, etc.
|
||||
copy(self, "*", src=bin_path, dst=self.package_folder, keep_path=True)
|
||||
|
||||
# Create bin/qt.conf to avoid hardcoded absolute paths!
|
||||
# This makes qmake, windeployqt, and qtcreator fully independent
|
||||
# of the original "C:\Qt\Qt5.14.2\..." installation paths.
|
||||
qt_conf_path = os.path.join(self.package_folder, "bin", "qt.conf")
|
||||
with open(qt_conf_path, "w", encoding="utf-8") as f:
|
||||
f.write("[Paths]\n")
|
||||
f.write("Prefix = ..\n")
|
||||
f.write("ArchData = .\n")
|
||||
f.write("Data = .\n")
|
||||
f.write("Documentation = doc\n")
|
||||
f.write("Headers = include\n")
|
||||
f.write("Libraries = lib\n")
|
||||
f.write("LibraryExecutables = bin\n")
|
||||
f.write("Binaries = bin\n")
|
||||
f.write("Plugins = plugins\n")
|
||||
f.write("Imports = imports\n")
|
||||
f.write("Qml2Imports = qml\n")
|
||||
f.write("Translations = translations\n")
|
||||
f.write("Settings = .\n")
|
||||
f.write("Examples = examples\n")
|
||||
f.write("Tests = tests\n")
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.bindirs = ["bin"]
|
||||
self.cpp_info.libdirs = ["lib"]
|
||||
self.cpp_info.includedirs = ["include"]
|
||||
# CMake config files provided by Qt will be registered here
|
||||
self.cpp_info.builddirs = ["lib/cmake", "lib/cmake/Qt5", "mkspecs"]
|
||||
|
||||
qt_dir = self.package_folder
|
||||
qt_plugin_path = os.path.join(self.package_folder, "plugins")
|
||||
qml2_import_path = os.path.join(self.package_folder, "qml")
|
||||
|
||||
# Set environment variables so QtCreator auto-detects dynamically
|
||||
self.buildenv_info.define_path("QTDIR", qt_dir)
|
||||
self.buildenv_info.define_path("QT_PLUGIN_PATH", qt_plugin_path)
|
||||
self.buildenv_info.define_path("QML2_IMPORT_PATH", qml2_import_path)
|
||||
|
||||
self.runenv_info.define_path("QTDIR", qt_dir)
|
||||
self.runenv_info.define_path("QT_PLUGIN_PATH", qt_plugin_path)
|
||||
self.runenv_info.define_path("QML2_IMPORT_PATH", qml2_import_path)
|
||||
|
||||
self.buildenv_info.prepend_path("PATH", os.path.join(self.package_folder, "bin"))
|
||||
self.runenv_info.prepend_path("PATH", os.path.join(self.package_folder, "bin"))
|
||||
|
||||
self.cpp_info.set_property("cmake_build_modules", ["lib/cmake/Qt5/Qt5Config.cmake"])
|
||||
Reference in New Issue
Block a user