How to link Q project to other compilers
-
For example if planning UI in Qt and processing in ICC(Intel compiler) or NVCC(Nvidia,Cuda,OpenAcc etc).
Some initial ideas>
Linking Qt UI to library file built with other compiler?
Configuring to use 2 compilers and somehow joining to single binary(to build UI part with GCC, Mingw, or msvc and processing part with NVCC)?
Communication over (socket networking or interprocessor) and doing seperate projects built with dif compilers?
-
Hi and welcome to devnet,
For CUDA for example, if you are using qmake, check the Adding Compilers topic from qmake's documentation.
As for mixing compilers, you can't mix and match compilers on Windows for C++ projects.
-
@SGaist OS does not have to be windows, Could be Linux or other.
Goal is easyest solution to implement.
Not much data back and forth during task.
For example getting openAcc or Cuda to work with Qt+GCC+Linux was not easy and found very little online support compared to NVCC.
Not many features supported or documented officialy either.
-
I am not entirely sure how much you want to mix and match. If you just have a single compiler for C++ and another for CUDA then @SGaist already provides good solutions.
I have never used any build system to compile different C++ files with different compilers. This is very easy if you use libraries for the different parts and each library only uses a single compiler. (BTW, even on Windows the Intel compiler is compatible with MSVC and I believe all compilers except for MinGW, as well.)
An ugly solution would be to use different file endings, like .cpp and .cxx, to separate files to different compilers. Then it would be moderately easy to assign one compiler per file endings. (Same way @SGaist suggested for CUDA code.)
My best bet is to use CMake. You'd be able to have two separate lists of C++ files. I don't have the experience with CMake. But, I would expect that there is a way to assign one compiler per file list. Most likely this is quite close to having two separate libraries and link those.
I'd also be able to come up with some interesting FASTBuild project where it would be quite easy to build up the dependencies based on two file lists. However, getting started with your first full-blown FASTBuild project is not easy. I took the FASTBuild project for FASTBuild itself as a starting point. We are using FASTBuild to compile a Qt-based project on Windows (more compilers would need to be added for Linux and macOS). A set of scripts to convert a qmake-based project to FASTBuild can be found on GIThub: https://github.com/SimonSchroeder/QMake2Fastbuild
This is easy to extend for additional compilers with a separate list of files.