LMMS / lmms

Cross-platform music production software
https://lmms.io
GNU General Public License v2.0
8.14k stars 1.01k forks source link

Setting up QtCreator (Guide + Scripts) #4934

Open JohannesLorenz opened 5 years ago

JohannesLorenz commented 5 years ago

Motivation

It's important to have your IDE setup correctly before coding the first line. It will:

Everyone can use their favourite IDE, but QtCreator is one of the most popular, and it's practical for dealing with Qt code. It's not worth for every programmer to

No one wants to mess around with that for every branch. It's probably also annoying for LMMS beginners to say: "Welcome to LMMS, before you code, please spend 2 hours getting your IDE ready". They might prefer a "Hello, just run generate-project.sh and start coding immediatelly".

That is why we should make it as easy as possible to set this up.

Proposals

  1. How to load a project a. One way is to use QtCreator's CMake importer. That usually works flawless, but the file tree can look a bit unordered. QtCreator with CMake b. We could also autogenerate project files using a script. Questions:
    1. I wonder what language should be used - should it work on Windows (@justnope) ?
    2. Compiling LMMS requires a few autogenerated headers in the build directory. Should the project file be bound to a configuration (like "build/")? QtCreator with project files
  2. How to keep coding conventions? a. QtCreator allows importing XML code style files. We should deliver one. b. You can use clang-format to re-format existing files ( #4690 ), but you'll rarely need this.

Summary

Maybe something like this?

data/IDE/qt-creator/README.md
data/IDE/qt-creator/generate-project.sh
data/IDE/qt-creator/code-style.xml
musikBear commented 5 years ago

good beginning/ first issue :+1

tresf commented 5 years ago

@JohannesLorenz can you explain what these auto-config scripts are for and an example of another project that use scripts for setup?

For example, I'm familiar with the ability for Java projects with IntelliJ IDEA to run tasks at start, but when the environment is missing stuff, it's not really much better than just placing it into the build logic (e.g. cmake, or in the case of Java, maven or ant.).

I think setting up the code editor is not a two-hour task, but rather a 2-minute task. I feel the gap is mostly in formatting (as we've identified in other bug reports) as well as non-IDE aware CMakeLists but even then the learning curve is just lack of familiarity. Working to improve this is tricky. For example, Qt5 is provided with Qt Creator, but we try to find it anyway. I've started to address the Qt5 detection scenario here (superseded -- in part -- by MSVC commits to master/work from others) but the general idea is that the project can be complied by CLI or IDE equally and that the assumption of a Qt runtime that's provided by the IDE should be automatic and transparent to the average user looking to hack at a few lines of code.

Using Qt Creator can be summarized with videos that can also save a bunch of time. So far, the only attempts I've seen to do this was done by @curlymorphic. Here are the tutorials:

http://youtu.be/XTWnQPGL9xs http://youtu.be/3OzGXfm6fqE

What I think is important is that a good idea today is better than a great idea tomorrow. If Qt Creator is to be embraced, put something in the wiki helping others. As people start to use it, it can be improved.

@cubician (renamed or deleted his github apparently) is our official YouTube tutorial maker, perhaps he's interested in making an updated version of @curlymorphic videos.

JohannesLorenz commented 5 years ago

(I was mostly referring to the Linux situation, I can't speak for the other OSes)

Initially, you have to run qmake and then patch variables:

This patching is already complicated. Also, when you switch branches (I do multiple times a day), you can

That's why I'm writing a WIP generator script that

More stuff can be done. E.g. patching the .pro.user file, such that it sets the following automatically

tresf commented 5 years ago

I've never had to do these things described. Running qmake seems like the wrong way though.

JohannesLorenz commented 5 years ago

Did you maybe import the CMakeLists instead?

tresf commented 5 years ago

Yes, of course.

JohannesLorenz commented 5 years ago

I found it confusing when importing CMakeLists (see the images above) - the additional CMake tree level, and finding out that the sources are in "src/lmmsobjs/". Maybe I'll get used to it...

What do others use?

tresf commented 5 years ago

I see the lmmsobjs folder structure a terrible argument to move away from an off-the-shelf solution that is used by millions.

JohannesLorenz commented 5 years ago

I'm not getting QtCreator set up properly with CMake. If I use a CMake project, hold the mouse over Effect::processAudioBuffer and press ctrl+shift+u, it shows usages in include and plugins, but not in core. Does that work for you?

rubiefawn commented 5 years ago

Just saw this. I'll take a look at those videos and work on understanding using QtCreator enough to make a tutorial.

JohannesLorenz commented 4 years ago

@iansannar how far are you with the tutorial? :smile:

JohannesLorenz commented 4 years ago

I'll make a video tutorial now, unless anyone else wants to do it (or has already done it).