[SOLVED] One project folder - Linux and Mac compiling
-
Is it possible to have project in one folder and share it from Linux and Mac?
Problem is .user settings!
My program compiles ok on Linux and Mac. It is possible to compile it at the same time from one folder on Linux and Mac.
But when I close Qt Creator .user settings is saved and when close Mac Qt Creator as last, I can not open it in Linux, because it wont understand Mac settings and vice versa.Example of file structure:
TestProject: ( contains all the source files and .pro file )
Build-Mac
debug ( debug object files etc. )
release ( release object files etc. )
Build-Linux
debug (debug object files etc. )
release ( release object files etc. )
Release-Mac ( release application )
Release-Linux ( release binary)Everything is working but I have to setup build directory every time I change environment.
Is any solution for this situation? I do not want to copy every change to another folder.
Thank you very much.
-
The best solution is to use two directories and keep them in sync using a version control system.
This will take some getting used to, but you won't work without version control anymore once you get past this point:-)
-
[quote author="Tobias Hunger" date="1353531639"]The best solution is to use two directories and keep them in sync using a version control system.
This will take some getting used to, but you won't work without version control anymore once you get past this point:-)[/quote]
Thank you for advice , but unfortunately I am already using mercurial and I do not want to commit something what is not working correctly on other platform. I am now developing gui with styles so basically I do not want to commit small change just to test if it looks ok on linux/mac. With setting up environment on both systems I can test it immediately. Just the opening the project after closing is annoying.
-
This is a small part of our configurations scripts which contains what you need:
@ OSWIN {
AX_GENERATED_FILES = GeneratedFiles
}
OSLIN {
AX_GENERATED_FILES = GeneratedFilesLinux
}
OSMAC {
AX_GENERATED_FILES = GeneratedFilesMacOs
}#output directories
UI_DIR = ../$$AX_GENERATED_FILES
MOC_DIR = ../$$AX_GENERATED_FILES/moc/$$AX_BUILD_TYPE
OBJECTS_DIR = ../$$AX_GENERATED_FILES/objs/$$AX_BUILD_TYPE
DESTDIR = ../$$AX_GENERATED_FILES/dest/$$AX_BUILD_TYPE
@Some time ago we had the same idea like you. We wanted compile all platforms from one directory. But after some another issues with invalid modification files check in gcc, we ended up with three different folders synced by svn.
After we do the main commit of all new code on Windows, we update our Mac/Linux machines, fix all issues at once and do one commit. Lot of our commits have only "linfix" or "macfix" flag ;-)
-
I have found solution in other topic:
http://qt-project.org/forums/viewthread/14758
Thanks!Solution is very simple: (example for testproject.pro )
- rename testproject.pro -> testproject.pri
- create testproject-linux.pro with only one line: include(testproject.pri)
- create testproject-mac.pro with the same line: include(testproject.pri)
And that's it. Everything works perfectly.
Qt Creator saves .user file as testproject-linux.pro.user in linux and testproject-mac.pro.user on mac. -
[quote author="ludek.vodicka" date="1353537542"]This is a small part of our configurations scripts which contains what you need:
[/quote]
Thank you for reply. But I do not understand what is it good for.
Now ( thanks to solution I just found ) I have this structure. Only one source folder without need of any syncing at all.
testproject ( with all the source code and pro files )
--all source files and folders
--testproject.pri
--testproject-linux.pro
--testproject-mac.pro
build-mac ( for building garbage )
--debug
--release
build-linux ( for building garbage )
--debug
--release
release
--bin
----testproject
----testproject.appEverything is done just using:
CONFIG += debug_and_release // to have separate dirs for release and debug object files.
DESTDIR = ../release/bin/testprojectBuild directories are setup upon opening project for the first time. And then it stays in .user file
I choose shadow build and for debug and release same folder ended with build-linux / build-mac
Makefiles UI, MOC stored in build-linux/build-mac
Object files are stored in build-linux/debug or release - depends on what build you choose in Qt Creator.I am now able to commit only once and only changes I have already tested on all systems I want.
Now I have solution I can work with.
-
The reason for our script was that we don't use QtCreator on all machines and sometimes we needed to compile it only from command line. Also we didn't use several .pro files but only one.
But as I wrote before, now we're building our project in different directories synchronized by SVN.