This commit is contained in:
bing
2026-04-02 14:07:03 +08:00
commit 2e610a492d
19 changed files with 395 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
@echo off
call "%~dp0/conanbuildenv-debug-x86_64.bat"

View File

@@ -0,0 +1,30 @@
@echo off
chcp 65001 > nul
@echo off
setlocal
echo @echo off > "%~dp0/deactivate_conanbuildenv-debug-x86_64.bat"
echo echo Restoring environment for conanbuildenv-debug-x86_64.bat >> "%~dp0/deactivate_conanbuildenv-debug-x86_64.bat"
for %%v in (PATH) do (
set foundenvvar=
for /f "delims== tokens=1,2" %%a in ('set') do (
if /I "%%a" == "%%v" (
echo set "%%a=%%b">> "%~dp0/deactivate_conanbuildenv-debug-x86_64.bat"
set foundenvvar=1
)
)
if not defined foundenvvar (
echo set %%v=>> "%~dp0/deactivate_conanbuildenv-debug-x86_64.bat"
)
)
endlocal
if defined PATH (
set "PATH=C:\Qt\Qt5.14.2\Tools\mingw730_64\bin;%PATH%"
) else (
set "PATH=C:\Qt\Qt5.14.2\Tools\mingw730_64\bin"
)

View File

@@ -0,0 +1,30 @@
@echo off
chcp 65001 > nul
@echo off
setlocal
echo @echo off > "%~dp0/deactivate_conanbuildenv-release-x86_64.bat"
echo echo Restoring environment for conanbuildenv-release-x86_64.bat >> "%~dp0/deactivate_conanbuildenv-release-x86_64.bat"
for %%v in (PATH) do (
set foundenvvar=
for /f "delims== tokens=1,2" %%a in ('set') do (
if /I "%%a" == "%%v" (
echo set "%%a=%%b">> "%~dp0/deactivate_conanbuildenv-release-x86_64.bat"
set foundenvvar=1
)
)
if not defined foundenvvar (
echo set %%v=>> "%~dp0/deactivate_conanbuildenv-release-x86_64.bat"
)
)
endlocal
if defined PATH (
set "PATH=C:\Qt\Qt5.14.2\Tools\mingw730_64\bin;%PATH%"
) else (
set "PATH=C:\Qt\Qt5.14.2\Tools\mingw730_64\bin"
)

68
msvc-windows/conanfile.py Normal file
View File

@@ -0,0 +1,68 @@
from conan import ConanFile
from conan.tools.files import copy
import os
class MsvcQtConan(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 MSVC 2017 installation
bin_path = r"C:\Qt\Qt5.14.2\5.14.2\msvc2017_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!
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 for automation and QtCreator
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"])

View File

@@ -0,0 +1,2 @@
@echo off
call "%~dp0/conanrunenv-debug-x86_64.bat"

View File

@@ -0,0 +1,24 @@
@echo off
chcp 65001 > nul
@echo off
setlocal
echo @echo off > "%~dp0/deactivate_conanrunenv-debug-x86_64.bat"
echo echo Restoring environment for conanrunenv-debug-x86_64.bat >> "%~dp0/deactivate_conanrunenv-debug-x86_64.bat"
for %%v in () do (
set foundenvvar=
for /f "delims== tokens=1,2" %%a in ('set') do (
if /I "%%a" == "%%v" (
echo set "%%a=%%b">> "%~dp0/deactivate_conanrunenv-debug-x86_64.bat"
set foundenvvar=1
)
)
if not defined foundenvvar (
echo set %%v=>> "%~dp0/deactivate_conanrunenv-debug-x86_64.bat"
)
)
endlocal

View File

@@ -0,0 +1,24 @@
@echo off
chcp 65001 > nul
@echo off
setlocal
echo @echo off > "%~dp0/deactivate_conanrunenv-release-x86_64.bat"
echo echo Restoring environment for conanrunenv-release-x86_64.bat >> "%~dp0/deactivate_conanrunenv-release-x86_64.bat"
for %%v in () do (
set foundenvvar=
for /f "delims== tokens=1,2" %%a in ('set') do (
if /I "%%a" == "%%v" (
echo set "%%a=%%b">> "%~dp0/deactivate_conanrunenv-release-x86_64.bat"
set foundenvvar=1
)
)
if not defined foundenvvar (
echo set %%v=>> "%~dp0/deactivate_conanrunenv-release-x86_64.bat"
)
)
endlocal

View File

@@ -0,0 +1,2 @@
@echo off
call "%~dp0\deactivate_conanbuildenv-debug-x86_64.bat"

View File

@@ -0,0 +1,2 @@
@echo off
call "%~dp0\deactivate_conanrunenv-debug-x86_64.bat"