Unified development environment, QT Pro to vs Engineering's handy tool

Source: Internet
Author: User
Tags tagname

QT Engineering to VS Engineering scripting tools

Problem Description:

When multiple people are developing with VS with Qt Creator, they sometimes encounter converting pro files to vcxproj files, transferring them to other PCs, and compiling or linking errors with the VS compilation project.

Solution:

First, unify the development environment, such as using VS2010 and Qt5.5.1.

Second, configure the QTDIR environment variable, which is the installation path for Qt creator, such as "C:\Qt\Qt5.5.1\5.5\msvc2010" (win10 operating system).

Finally, use the Qmake tool to convert Pro files to vcxproj files. Replace the vcxproj file with the environment variable qtdir wherever it refers to the QT creator installation path.

The following batch commands need to be copied and saved as a *.bat file. In the Pro directory, double-click Run to implement the features described above.

:: The function of this script is to convert the QT Pro file under the current folder and its subfolders to the VS Vcxproj file,
:: And replace the absolute path of QT in the generated vcxproj file with the QTDIR environment variable
@echo off
If "%qtdir%" = = "" (
    @echo "QTDIR" environment variable is not configured
    Pause
    Exit
)
Set bootdir=%cd%
Set Tagname=temp
Set Tagsubex=bat
Set file=%tagname%.%tagsubex%
@echo%cd%
FOR/R%%i in (*.pro) do (
    @echo%%i
    Call:create%%i
)
Pause
CD%bootdir%
Set Delfile=del.bat
REM set/a flag=0
echo @echo off>%delfile%
rem Echo Set flag=^0>>%delfile%
Echo for/r%%%%j in (*%file%) Do (>>%delfile%
echo Call:d elete%%%%j>>%delfile%
echo) >>%delfile%
rem Echo set/a flag+=^1>>%delfile%
Echo:d elete>>%delfile%
Echo del%%1>>%delfile%
Call%delfile%
CD%bootdir%
Del%delfile%
Exit
: Wait
If%flag% equ 1 (
@echo flag=%flag%
Pause
Del%delfile%
Exit
) Else (
@echo This is working
Pause
Goto wait
)
: Create
CD%~DP1
echo @echo off>%file%
Echo Set expqtdir=%%qtdir%%>>%file%
Echo%%QTDIR%%\BIN\QMAKE-TP vc>>%file%
Echo Set tagex=vcxproj>>%file%
Echo for/r%%%%j in (*.vcxproj) do (>>%file%
Echo Call:replace%%%%j>>%file%
echo) >>%file%
Echo:replace>>%file%
Echo setlocal enabledelayedexpansion>>%file%
Echo Ren%%1 a.%%tagex%%>>%file%
echo for/f "tokens=*"%%%%s in (a.%%tagex%%) do (>>%file%
Echo Set var=%%%%s>>%file%
Echo Set var=!var:%%expqtdir%%=%%%%qtdir%%%%!>>%file%
Echo Echo!var!^>^>b.%%tagex%%>>%file%
echo) >>%file%
Echo del%%~nx1>>%file%
Echo Ren b.%%tagex%%%%~nx1>>%file%
Echo del a.%%tagex%%>>%file%
Echo endlocal>>%file%
Echo exit>>%file%
Start%file%
: Continue

  

Unified development environment, QT Pro to vs Engineering's handy tool

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.