Compiling QT VS project cross platform
-
Hello,
Please accept my apologies for the newbie question; I never compiled any apps cross platform.
There is a project I am working on, setup using VS 2019 with QT integration. My question is how would I compile this for MAC/Linux for example? (everything written using QT 6 only, no other dependencies).
Do I need to create a separate project or can I use this existing one?
Please advise.
-
Hi,
Currently you can't cross-compile to macOS, this requires a machine for it.
For Linux, might be able to leverage MinGW.
However with the current release of WSL, you might not need to do cross-compiling.
But in any case, you do not need several projects.
-
@SGaist said in Compiling QT VS project cross platform:
Hi,
Currently you can't cross-compile to macOS, this requires a machine for it.
For Linux, might be able to leverage MinGW.
However with the current release of WSL, you might not need to do cross-compiling.
But in any case, you do not need several projects.
Thank you, appreciate the feedback. I understand about macOS; that's fine. However for Linux, I do have WSL installed (using it for other stuff; no UI though).
You mention I can keep my existing VS project and compile with MinGW, do you have any tips/instructions that I could use?
-
One thing to clear, are you using a VS project or a qmake/cmake based project to manage your application ?
If the former, then no, not directly. You should move to one of the larger taking into account that Qt has switched to cmake for its 6 series.
With that you will be able to build your application across different platforms.
-
@SGaist said in Compiling QT VS project cross platform:
One thing to clear, are you using a VS project or a qmake/cmake based project to manage your application ?
If the former, then no, not directly. You should move to one of the larger taking into account that Qt has switched to cmake for its 6 series.
With that you will be able to build your application across different platforms.
I am using a VS solution with QT addon and QT6. Do you think I can keep the VS solution and compile for Linux as well?
-
@Mecanik said in Compiling QT VS project cross platform:
Do you think I can keep the VS solution and compile for Linux as well?
No, a .vcproj is MSVC specific. Use a proper build system like cmake or qmake to create the appropriate Makefiles (or VS solutions).
-
@Christian-Ehrlicher said in Compiling QT VS project cross platform:
@Mecanik said in Compiling QT VS project cross platform:
Do you think I can keep the VS solution and compile for Linux as well?
No, a .vcproj is MSVC specific. Use a proper build system like cmake or qmake to create the appropriate Makefiles (or VS solutions).
Thanks, that's what I imagined. So how about me using a QT project file instead? That would allow me to use MinGW and compile for both Windows/Linux, am I correct?
-
@Mecanik said in Compiling QT VS project cross platform:
So how about me using a QT project file instead?
I don't know what you mean with 'QT project file' - if it's a .pro - file then you're using qmake which is fine (as I said above).
-
@Christian-Ehrlicher said in Compiling QT VS project cross platform:
@Mecanik said in Compiling QT VS project cross platform:
So how about me using a QT project file instead?
I don't know what you mean with 'QT project file' - if it's a .pro - file then you're using qmake which is fine (as I said above).
Yep, that's what I meant - qmake. Thanks!
I suppose same thing applies for macOS, I can install QT on my mac and compile using qmake?
-
@Mecanik said in Compiling QT VS project cross platform:
I can install QT on my mac and compile using qmake?
Yes
-
@Mecanik said in Compiling QT VS project cross platform:
@Christian-Ehrlicher said in Compiling QT VS project cross platform:
@Mecanik said in Compiling QT VS project cross platform:
So how about me using a QT project file instead?
I don't know what you mean with 'QT project file' - if it's a .pro - file then you're using qmake which is fine (as I said above).
Yep, that's what I meant - qmake. Thanks!
I suppose same thing applies for macOS, I can install QT on my mac and compile using qmake?
Awesome, thank you all!