Qt-project as a git-submodule for another Qt-project - qt

I have a Qt-application. It has a .pro file with TEMPLATE = app. One of the project's subfolders is a git-submodule to another Qt project: a collection of libraries, which has it's own .pro file with TEMPLATE = subdirs.
Graphically it looks like:
project/
app.pro (TEMPLATE = app)
stuff/
libs/ <-- git-submodule
libs.pro (TEMPLATE = subdirs)
lib1/
lib1.pro (TEMPLATE = lib)
lib2/
lib2.pro (TEMPLATE = lib)
libs as a standalone project compiles well and produces .lib files.
But in this case I want somehow include libs.pro to a project as a subdir although app.pro's TEMPLATE is not subdirs but app. Maybe that is why my attempts to write something like SUBDIRS += askelib to app.pro had no effect.
All in all my aim is to get .lib files inside build folder of app.pro.
I emphasize that libs is a git-submodule because nothing should be changed inside libs project to achieve my goal.
I know that it probably should work if I change app.pro's TEMPLATE to subdirs. But that's not what I really want to do because it will make things more difficult since project hierarchy then will achieve another nesting level:
subdirs_proj/
app/
libs/
instead of
app/
libs/
EDIT:
To clerify my reasons:
My aim is to make a project tree as clearer as it can be. Like you clone a project from github, enter into it's directory and see app.pro at the top level. And everything is clear, easy and beautiful. And not like you see a strange subdirs.pro at the top but the actual project is in app subdirectory and you also have posibility to confuse main application subfolder with a library subfolder in case if their names are not so obvious as app and libs but something like torpedo and helios. Hope my thought is clear :)

You already have your answer: make the top-level project a subdir project.
I do not understand why you want to avoid that and why you find it confusing.
IMHO, having an app project that has subdirs is more confusing than having a subdir project that has subdirs.
And I don't think removing a folder level compensate for having subdirs in an app .pro. Think about a new developer coming on the project, if he sees TEMPLATE=app he will assume you only build a single project, but it is not. Meaning that your project is not "clear, easy and beautiful" and completely violates the principle of least astonishment.
I regularly have projects that have the following architecture:
project-a/project-a.pro (subdirs)
/cli-app/cli-app.pro (app)
/gui-app/gui-app.pro (app)
/core-lib/core-lib.pro (lib)
/3rd-party/3rd-party.pro (subdirs)
/3rd-party/somelib/somelib.pro (lib)
I find it clearer than messing with the project type to remove a folder level. And if you are afraid developers will not know what each sub folder is, maybe you should throw some README files explaining what is what.
Also you can take a look at the Qt project itself, it has many .pro files and not once you have an app project that contains subdirs. And I think it is rather clear, in particular for such a big project.

Related

Generate doxygen documentation using Qt project file

How can I tell doxygen to (only) use the files that are in my Qt project file when generating the documentation?
Reason for asking: I'm using a folder structure where a 'common' folder holds files that are used by some (not all) Qt projects I'm working on. Like this:
projects
MyProject
common_files
SubProject_A
SubProject_B
Both SubProject folders will have a Doxyfile and both projects will use some files from the common_files folder.
I know one way to achieve my goal (getting the documentation for just the files used in my project) is to manually add all files in the INPUT setting from the doxygen configuration file. But that would mean I'll have to change the Doxyfile every time I add or delete a file to/from my project.
Doxygen should be able to filter the files needed for the documentation from the .pro file. But how?

Getting an all-white screen on deploying Qt Quick demo app Minehunt

To test the deployment process I am trying to deploy the included demo app Minehunt. I am able to get it to run, no crashing or errors, but the screen is all white.
I believe this generally means that I am missing plugins. Dependency walker reports no problems, and I even tried including ALL the plugins from the Qt MingW plugins directory, but no such luck.
Here is what I am including so far; Can anyone advise what else I need to add to get it to run?
Your dlls don't look bad at all. I think, too, that it's your plugins. Even if they are there, there is a good chance, that your program don't find them. Qt is a bit picky where to look by default. You might try qt.conf. This is a small textfile you must create in the folder where your executable lies. It contains the path to your Qt plugins.
For instance, in one of my projects I have the followin folder layout:
Appfolder
plugin
qt
plugins
imageformats
sqldrivers
myapp.exe
qt.conf
...many dlls...
Then I added a qt.conf file to the Appfolder, which has the following content:
[Paths]
Plugins = plugins/qt/plugins
My program is Qt 4, but I don't think this aspect of plugin deployment changed in Qt5.
All my qt dlls are in qt. And I add the following PATH: SET PATH=.\plugins;.\plugins\qt;%PATH%. Works like a charm on any Windows I ever tried.
Edit:
I then created a .bat file, which does:
SET PATH=.\plugins;.\plugins\qt;%PATH%
cd Appfolder
start myapp
This was an ugly quick fix, which I did not have the time to replace with something better, yet.
If application runs and shows blank screen then that usually indicates two things :
All the dependencies (dlls) are probably present and detected properly.
Most probably whats missing is the presence of qml files at the correct location.
In your main.cpp check the path of qml file which you would have given, and see if relatively that folder is present at the same location corresponding to your executable.
Also, instead of running the executable by double clicking, run it through the command line. It might print some messages if it is not able to locate some images/files/other dependencies etc according to the specified paths.
Edit 1 :
Add this flag in the .pro file :
CONFIG += console
It will give the exact debug message in a console once you run the application.

Where do I put my skin files for a desktop libgdx project

I'm using libgdx for a desktop game/prototype and I want to start getting into UI design.
I followed the answer here: Default Skin LibGDX? to download the necessary skin files but I'm not sure where in my project to put the ui directory with these files. I have tried to put it right in the project directory along side libs and src, so there's libs, src, ui, Referenced Libraries, and JRE System Library but when I reference the Skin with new Skin("ui/uiskin.json") it is throwing a filenotfound exception. Should this be down in my com. package in the project viewer in Eclipse?
I understand for an Android app you use the asset folder, but I don't have one in my project since it's a desktop app, even if I were to just add it.. I still don't know at which level unfortunately. This is probably really simple.
Thanks in advance.
The skin files are being looked up as "internal" files. On Android, this will look through the Android asset directory and CLASSPATH, but with the Desktop backend, only CLASSPATH will be searched.
To be consistent with the way things generally work in Libgdx, create a directory called assets next to the src and libs directories in your desktop project. Then put your ui directory inside assets. This isn't strictly necessary (see below) but will make your project a bit more compatible with other Libgdx code and projects. With an Android project the desktop assets directory is normally linked to the Android assets directory, but without an Android project you should create a regular directory.
If you used the Libgdx Libgdx "setup tool" the desktop project's assets directory should already be on the CLASSPATH. If not, you will also need to add this assets directory to your CLASSPATH: Right click on the project -> Properties -> Java Build Path -> Source tab -> Add Folder ... -> Select the assets directory.
To be clear, if you don't want to mirror the Libgdx conventions above, you just need to make sure the directory containing your skin files is on the CLASSPATH, then they will be found as "internal" Libgdx files (for example, you could add the ui directory directly to the CLASSPATH, and then look the files up without the explicit ui/ prefix).

How to add .fsh/.vsh shader files to Xcode so they are added to Copy Bundle Resources phase automatically?

Whenever I add a new .fsh or .vsh OpenGL ES 2.0 shader file to my project's resources, the file is added to the Compile Sources build phase where it doesn't belong. I then have to manually remove it from that phase, and manually add it to the Copy Bundle Resources build phase.
Is there any way I can tell Xcode to add files with the extension .fsh and .vsh automatically to the Copy Bundle Resources build phase?
Or is it possible to create a Build Rule that has the same effect as adding the shaders to the Copy Bundle Resources build phase?
I would prefer a solution that works for all users of the Xcode project/workspace, rather than a setting or system change each Xcode user would have to play individually.
Following is a workaround I found. If anyone has any other solutions I'd still appreciate the answer.
What you do to get the shaders into the Copy Bundle Resources build phase automatically is simply to put all the shaders in a common folder (or folder tree). I named the folder "Shaders". Then when adding the Shaders folder select Create folder references for any added folders.
As folder references the files are automatically assumed to be Bundle Resources by Xcode. You just need to be careful not to place any unwanted files into that folder respectively clean up the folder before making a release build. Also loading the shaders requires to use the path to the shader files, ie "Shaders/Examples/Blur.fsh".
My workaround is that I go to File > New File > Others > Empty files and name them as shader.vertsh and shader.fragsh.
I guess Xcode automatically adds files with dot 3/4 extensions to compile phase.
And in case you're missing the Syntax Highlighting, change the File type to 'OpenGL Shading Language Source':

git + Flash Builder workflow: how do I set it up so git works smoothly?

I'm using git to track a project I'm developing in Flash Builder, and I'm wondering the best way to go about having it track it, especially regarding Flash Builder generated files, Compiler generated files, and source files that aren't necessarily flex files.
I had it set up to ignore all of the flash builder .project & debugging directories via .gitignore:
.actionScriptProperties
.flexProperties
.metadata
.project
.settings
bin-debug
and also treating any swf/swc files as binaries via .gitattributes
*.swf -crlf -diff -merge
*.swc -crlf -diff -merge
One issue with this setup is checking out this project and using
it in Flash Builder from scratch:
Flash Builder doesn't like it when
you have a project folder without
the .project files. Only way to
import the source into Flash Builder is to:
Create a new Flex Application
Smother the template files it
created (specifially APP_NAME.mxml)
with a git clone.
Where do I put libraries? From a git perspective, I'd like to have them in the lib folder of the repo so when someone clones the repo, everything just works, but from a local file system perspective I'd like to store all my libraries in a single location and use Flash Builder to reference them, as I may update the library or download a later version. Maybe I should put the libraries in their own repo and load them as a git module? This way I don't need to manually remember to update my Y library files in all X projects that are using them, edit: they will simply update when I update each projects' submodules.
And what about external swfs/flex modules? I've was sticking external swf files in the bin-debug folder for now so the SWFLoader class can find them, but because I'm .gitignoring the bin-debug folder, they don't come with the repo when it's cloned.
One final issue is where to keep the files for the server. Do I have them in a separate repo? I'm using php VOs' with AMFPHP so it's good to be able to edit the php files alongside my actionscript files in Flash Builder... but they don't belong in the project src folder.
The current solution I'm using is:
Creating a 'server' folder in the project root
Pointing an apache virtualhost at it
Setting the run/debug settings to http://APP_NAME.localhost
Then using the server folder as a replacement for bin-debug when the files get exported
The problem with this is I've got a big mess of compiler generated files, and non-AS source files in my server folder. It just doesn't seem like an elegant solution.
How do you set up git to work with flash builder smoothly? Could all this be resolved with multiple git repos/Flash Builder projects, or an ANT script or something?
Thanks.
I've found a good solution which avoids all of the horror of having untracked files and keeping a massive .ignore list:
CLEAN your projects before you git commit.
Simple as that.
Whether it be by Flash Builder or by ant, you should have the ability to clean anyway, so if you simply clean before you commit, the problem of generated files is solved. Duh.
In fact you could probably set it up as a git hook or something.
Typically for eclipse projects with any SCM, I initially check in everything including .projects, etc., but maybe except bin-debug in your case. Then just make sure that anybody who checks out the project never checks back in those .xxx files. For instance, when I use perforce, I first check out the .xxx files to a changelist that I never check in. Then check out the rest to a separate changelist.
Another tip is to use user defined library variables when working with build paths, etc.

Resources