[Question] Cross platform compiler condition
-
wrote on 30 Aug 2022, 04:10 last edited by
Hi, would like to ask the list of compiler condition so that the compiler knows what headers are related for the platform
Android = Q_WS_ANDROID ?? is this correct ? if yes how about other platform thanks
iOS
Mac
Windows
Linux -
Hi, would like to ask the list of compiler condition so that the compiler knows what headers are related for the platform
Android = Q_WS_ANDROID ?? is this correct ? if yes how about other platform thanks
iOS
Mac
Windows
Linux@jhayar Not sure I understood your question.
Take a look at https://doc.qt.io/qt-6/qmake-language.html "Platform Scope Values". -
wrote on 30 Aug 2022, 08:21 last edited by jhayar
hi thanks for the reply ,
but my concern is not the platform condition in .pro filewhat i'm asking is the compiler options in .cpp file
example below
#ifndef ANDROID
include <android/related/files.h>
#elseif IOS
include <ios/releated/files.h>thanks :)
-
hi thanks for the reply ,
but my concern is not the platform condition in .pro filewhat i'm asking is the compiler options in .cpp file
example below
#ifndef ANDROID
include <android/related/files.h>
#elseif IOS
include <ios/releated/files.h>thanks :)
@jhayar Use scopes and DEFINES:
win32:DEFINES += USE_MY_STUFF -
wrote on 30 Aug 2022, 11:29 last edited by
@jsulm said in [Question] Cross platform compiler condition:
@jhayar Use scopes and DEFINES:
win32:DEFINES += USE_MY_STUFFHi , is this for cpp file ?
-
@jsulm said in [Question] Cross platform compiler condition:
@jhayar Use scopes and DEFINES:
win32:DEFINES += USE_MY_STUFFHi , is this for cpp file ?
-
wrote on 30 Aug 2022, 11:58 last edited by
@jsulm said in [Question] Cross platform compiler condition:
@jhayar No, see https://doc.qt.io/qt-6/qmake-variable-reference.html#defines
hi , if that is not on the c++ level, that is not what i'm looking for
i'm looking for something like this

is there something similar on that ?
so when i run the compiler, it will compile according to the platform defined ?
Thanks :)
-
@jsulm said in [Question] Cross platform compiler condition:
@jhayar No, see https://doc.qt.io/qt-6/qmake-variable-reference.html#defines
hi , if that is not on the c++ level, that is not what i'm looking for
i'm looking for something like this

is there something similar on that ?
so when i run the compiler, it will compile according to the platform defined ?
Thanks :)
@jhayar Please read the documentation!
What I posted is EXACTLY what you are looking for!
This in pro file:win32:DEFINES += USE_MY_STUFFmeans you can do in cpp file:
#ifdef USE_MY_STUFF -
@jhayar Please read the documentation!
What I posted is EXACTLY what you are looking for!
This in pro file:win32:DEFINES += USE_MY_STUFFmeans you can do in cpp file:
#ifdef USE_MY_STUFFwrote on 30 Aug 2022, 14:00 last edited by@jsulm said in [Question] Cross platform compiler condition:
@jhayar Please read the documentation!
What I posted is EXACTLY what you are looking for!
This in pro file:win32:DEFINES += USE_MY_STUFFmeans you can do in cpp file:
#ifdef USE_MY_STUFFgot this thanks will check it again thanks :)
-
@jsulm said in [Question] Cross platform compiler condition:
@jhayar Please read the documentation!
What I posted is EXACTLY what you are looking for!
This in pro file:win32:DEFINES += USE_MY_STUFFmeans you can do in cpp file:
#ifdef USE_MY_STUFFgot this thanks will check it again thanks :)
wrote on 30 Aug 2022, 14:27 last edited by@jhayar
Just so you know: Qt's.pro'sDEFINESgenerates-D<symbol>argument to the compiler for each entry in it. SoDEFINES += USE_MY_STUFFmeans-DUSE_MY_STUFFwill be added on the command line, to satisfy any#ifdef USE_MY_STUFF. And of course the leadingwin32:means it only does this if the target inwin32. -
Hi,
You have the full list of macros here in Qt's documentation.
-
Hi,
You have the full list of macros here in Qt's documentation.
4/12