visual studio – How to Specify Directory Structure in Qt Pro to vs Project


I tried to build vs projects from pro files using qmke, but something strange happened
In Qt Creator, the directory structure is as follows:

qt-product-root:

main_app_directory
├── all.pro
└── main
├── main.pro
└──  header file
|   ├── pcmdatabuffer
|   |   └── pcmdatabufer.h
|   ├── plot
|   |    └── plot.h
|   └── widget.h
└──  Srouces file
├── pcmdatabuffer
|   └── pcmdatabufer.cpp
├── plot
|    └── plot.cpp
├── main.cpp
└── widget.cpp

The Visual Studio project generated by qmake is as follows:

main_app_directory
├── header file
|   ├── pcmdatabuffer.h
|   ├── plot.h
|   └── widget.h
└── Srouces file
└── pcmdatabufer.cpp
├── plot.cpp
├── widget.cpp
└── main.cpp

this is my all.pro:

TEMPLATE = subdirs

CONFIG  = debug_and_release \
build_all

CONFIG  = ordered

SUBDIRS = main

this is my main.pro:

PROJECT_NAME = first
TARGET = $${PROJECT_NAME}
TEMPLATE = app

HEADERS  = $$PWD/widget.h \
$$PWD/audiothread.h \
pcmdatabuffer/pcmdatabuffer.h \
plot/plot.h

SOURCES  = $$PWD/widget.cpp \
$$PWD/main.cpp  \
$$PWD/audiothread.cpp \
pcmdatabuffer/pcmdatabuffer.cpp

FORMS  = $$PWD/widget.ui

CONFIG  = qt \
warn_on \
debug_and_release \
build_all \
c  14

QT  = widgets core gui

TARGET_SUFFIX =
BUILD_TYPE = release
build_pass:CONFIG(debug, debug | release) {
TARGET_SUFFIX = _dbg
BUILD_TYPE = debug
TARGET = $$join(TARGET, , , $${TARGET_SUFFIX})
DEFINES  = _DEBUG \
DEBUG
}

OBJECTS_DIR = $$quote($$OUT_PWD/../tmp/$${TARGET})
DESTDIR = $$quote($$OUT_PWD/../bin/$${BUILD_TYPE})

include($$PWD/../Component/ffmpeg/ffmpeg.pri)
include($$PWD/../Common/qcustomplot/qcustomplot.pri)

This seems to be related to the generated.vcxproj.filters in the contents of the file

<ItemGroup> <ClInclude Include="pcmdatabuffer/pcmdatabuffer.h">
 <Filter>Header Files</Filter> 

Determines the display effect of the file on visual stuid, does the qt pro file have relevant fields that can be controlled? I hope it is the following effect:

<ItemGroup> <ClInclude Include="plot/plot.h"> 
<Filter>Header Files/plot</Filter> 

Why did the directory structure change?

I want the generated vs project directory structure to remain the same

Leave a Reply

Your email address will not be published. Required fields are marked *