KDevelop4/Manual/Sessions and projects: Difference between revisions
m (fix link) |
(Marked this version for translation) |
||
Line 2: | Line 2: | ||
<translate> | <translate> | ||
== Sessions and projects: The basics of KDevelop == | == Sessions and projects: The basics of KDevelop == <!--T:1--> | ||
<!--T:2--> | |||
In this section, we will go over some of the terminology of how '''KDevelop''' sees the world and how it structures work. In particular, we introduce the concept of '''sessions''' and '''projects''' and explain how you can set up the projects you want to work on in '''KDevelop'''. | In this section, we will go over some of the terminology of how '''KDevelop''' sees the world and how it structures work. In particular, we introduce the concept of '''sessions''' and '''projects''' and explain how you can set up the projects you want to work on in '''KDevelop'''. | ||
</translate><span id="Terminology"></span><translate> | </translate><span id="Terminology"></span><translate> | ||
=== Terminology === | === Terminology === <!--T:3--> | ||
<!--T:4--> | |||
'''KDevelop''' has the concept of '''sessions''' and '''projects'''. A session contains all projects that have something to do with each other. For the examples that follow, assume you are the developer of both a library and an application that uses it. You can think of the core KDE libraries as the former and '''KDevelop''' as the latter. Another example: Let's say you are a Linux kernel hacker but you are also working on a device driver for Linux that hasn't been merged into the kernel tree yet. | '''KDevelop''' has the concept of '''sessions''' and '''projects'''. A session contains all projects that have something to do with each other. For the examples that follow, assume you are the developer of both a library and an application that uses it. You can think of the core KDE libraries as the former and '''KDevelop''' as the latter. Another example: Let's say you are a Linux kernel hacker but you are also working on a device driver for Linux that hasn't been merged into the kernel tree yet. | ||
<!--T:5--> | |||
So taking the latter as an example, you would have a session in '''KDevelop''' that has two projects: the Linux kernel and the device driver. You will want to group them into a single session (rather than having two sessions with a single project each) because it will be useful to be able to see the kernel functions and data structures in '''KDevelop''' whenever you write source code for the driver — for example so that you can get kernel function and variable names auto-expanded, or so that you can see kernel function documentation while hacking on the device driver. | So taking the latter as an example, you would have a session in '''KDevelop''' that has two projects: the Linux kernel and the device driver. You will want to group them into a single session (rather than having two sessions with a single project each) because it will be useful to be able to see the kernel functions and data structures in '''KDevelop''' whenever you write source code for the driver — for example so that you can get kernel function and variable names auto-expanded, or so that you can see kernel function documentation while hacking on the device driver. | ||
<!--T:6--> | |||
Now imagine you also happen to be a KDE developer. Then you would have a second session that contains KDE as a project. You could in principle have just one session for all of this, but there is no real reason for this: in your KDE work, you don't need to access kernel or device driver functions; and you don't want KDE class names autoexpanded while working working on the Linux kernel. Finally, building some of the KDE libraries is independent of re-compiling the Linux kernel (whereas whenever you compile the device driver it would also be good to re-compile the Linux kernel if some of the kernel header files have changed). | Now imagine you also happen to be a KDE developer. Then you would have a second session that contains KDE as a project. You could in principle have just one session for all of this, but there is no real reason for this: in your KDE work, you don't need to access kernel or device driver functions; and you don't want KDE class names autoexpanded while working working on the Linux kernel. Finally, building some of the KDE libraries is independent of re-compiling the Linux kernel (whereas whenever you compile the device driver it would also be good to re-compile the Linux kernel if some of the kernel header files have changed). | ||
<!--T:7--> | |||
Finally, another use for sessions is if you work both on the current development version of a project, as well as on a branch: in that case, you don't want '''KDevelop''' to confuse classes that belong to mainline and the branch, so you'd have two sessions, with the same set of projects but from different directories (corresponding to different development branches). | Finally, another use for sessions is if you work both on the current development version of a project, as well as on a branch: in that case, you don't want '''KDevelop''' to confuse classes that belong to mainline and the branch, so you'd have two sessions, with the same set of projects but from different directories (corresponding to different development branches). | ||
</translate><span id="Setting up a session and importing an existing project"></span><translate> | </translate><span id="Setting up a session and importing an existing project"></span><translate> | ||
=== Setting up a session and importing an existing project === | === Setting up a session and importing an existing project === <!--T:8--> | ||
<!--T:9--> | |||
Let's stick with the Linux kernel and device driver example — you may want to substitute your own set of libraries or projects for these two examples. To create a new session that contains these two projects go to the <menuchoice>Session -> Start new session</menuchoice> menu at the top left (or, if this is the first time you use '''KDevelop''': simply use the default session you get on first use, which is empty). Next, go to the <menuchoice>Project</menuchoice> menu to create the Linux kernel as a project inside this session. To to this, follow these steps: | Let's stick with the Linux kernel and device driver example — you may want to substitute your own set of libraries or projects for these two examples. To create a new session that contains these two projects go to the <menuchoice>Session -> Start new session</menuchoice> menu at the top left (or, if this is the first time you use '''KDevelop''': simply use the default session you get on first use, which is empty). Next, go to the <menuchoice>Project</menuchoice> menu to create the Linux kernel as a project inside this session. To to this, follow these steps: | ||
<!--T:10--> | |||
<ul> | <ul> | ||
<li> Go to <menuchoice>Projects -> Fetch project</menuchoice> to import a project | <li> Go to <menuchoice>Projects -> Fetch project</menuchoice> to import a project | ||
Line 43: | Line 50: | ||
</translate><span id="Setting up an application as a second project"></span><translate> | </translate><span id="Setting up an application as a second project"></span><translate> | ||
=== Setting up an application as a second project === | === Setting up an application as a second project === <!--T:11--> | ||
<!--T:12--> | |||
The next thing you want to do is set up other projects in the | The next thing you want to do is set up other projects in the | ||
same session. In the example above, you would want to add the device driver as the second project, which you can do using exactly the same steps. | same session. In the example above, you would want to add the device driver as the second project, which you can do using exactly the same steps. | ||
<!--T:13--> | |||
If you have multiple applications or libraries, simply repeat the steps to add | If you have multiple applications or libraries, simply repeat the steps to add | ||
more and more projects to your session. | more and more projects to your session. | ||
Line 53: | Line 62: | ||
</translate><span id="Creating projects from scratch"></span><translate> | </translate><span id="Creating projects from scratch"></span><translate> | ||
=== Creating projects from scratch === | === Creating projects from scratch === <!--T:14--> | ||
<!--T:15--> | |||
There is of course also the possibility that you want to start a new project from scratch. This can be done using the <menuchoice>Projects -> New from template</menuchoice> menu item. The details of what options this offers to you are described elsewhere in this manual. | There is of course also the possibility that you want to start a new project from scratch. This can be done using the <menuchoice>Projects -> New from template</menuchoice> menu item. The details of what options this offers to you are described elsewhere in this manual. | ||
<!--T:16--> | |||
{{Prevnext2 | {{Prevnext2 | ||
| prevpage=Special:MyLanguage/Kdevelop4/Manual/What_is_KDevelop? | nextpage=Special:MyLanguage/KDevelop4/Manual/Working_with_source_code | | prevpage=Special:MyLanguage/Kdevelop4/Manual/What_is_KDevelop? | nextpage=Special:MyLanguage/KDevelop4/Manual/Working_with_source_code | ||
Line 63: | Line 74: | ||
}} | }} | ||
<!--T:17--> | |||
[[Category:Development]] | [[Category:Development]] | ||
</translate> | </translate> |
Revision as of 19:32, 18 May 2011
Sessions and projects: The basics of KDevelop
In this section, we will go over some of the terminology of how KDevelop sees the world and how it structures work. In particular, we introduce the concept of sessions and projects and explain how you can set up the projects you want to work on in KDevelop.
Terminology
KDevelop has the concept of sessions and projects. A session contains all projects that have something to do with each other. For the examples that follow, assume you are the developer of both a library and an application that uses it. You can think of the core KDE libraries as the former and KDevelop as the latter. Another example: Let's say you are a Linux kernel hacker but you are also working on a device driver for Linux that hasn't been merged into the kernel tree yet.
So taking the latter as an example, you would have a session in KDevelop that has two projects: the Linux kernel and the device driver. You will want to group them into a single session (rather than having two sessions with a single project each) because it will be useful to be able to see the kernel functions and data structures in KDevelop whenever you write source code for the driver — for example so that you can get kernel function and variable names auto-expanded, or so that you can see kernel function documentation while hacking on the device driver.
Now imagine you also happen to be a KDE developer. Then you would have a second session that contains KDE as a project. You could in principle have just one session for all of this, but there is no real reason for this: in your KDE work, you don't need to access kernel or device driver functions; and you don't want KDE class names autoexpanded while working working on the Linux kernel. Finally, building some of the KDE libraries is independent of re-compiling the Linux kernel (whereas whenever you compile the device driver it would also be good to re-compile the Linux kernel if some of the kernel header files have changed).
Finally, another use for sessions is if you work both on the current development version of a project, as well as on a branch: in that case, you don't want KDevelop to confuse classes that belong to mainline and the branch, so you'd have two sessions, with the same set of projects but from different directories (corresponding to different development branches).
Setting up a session and importing an existing project
Let's stick with the Linux kernel and device driver example — you may want to substitute your own set of libraries or projects for these two examples. To create a new session that contains these two projects go to the
menu at the top left (or, if this is the first time you use KDevelop: simply use the default session you get on first use, which is empty). Next, go to the menu to create the Linux kernel as a project inside this session. To to this, follow these steps:- Go to to import a project
- You then have multiple options to start a new project in the current session, depending on where the source files should come from: You can just point KDevelop at an existing directory, or you can ask KDevelop to get the sources from a repository. Let's look at these options in turns:
- If you want to work with a project that's already on your hard drive then just select as source and choose the as the directory in which your project resides. This could be a directory into which you unpackaged a tar file that you downloaded, or it could be a directory into which you checked out a version of the project using a version control system (e.g. git or subversion).
- Alternatively, assuming you wanted to work with the current development sources of deal.II and don't already have a version checked out:
- In the dialog box, under , choose to use , , or one of the other choices
- Choose a working directory as destination into which the sources should be checked out
- Choose an URL for the location of the repository where the source files can be obtained
- Hit
du -sk /path/to/KDevelop/project
to see how much data has already been downloaded.NoteThe problem with the progress bar has been reported as KDevelop bug 256832.NoteIn this process, I also get the error message You need to specify a valid location for the project which can be safely ignored. . This can take quite a long while; depending on the speed of your connection and the size of the project. Unfortunately, in KDevelop 4.2.x the progress bar does not actually show anything, but you can track progress by periodically looking at the output of the command line command
- It asks you to select a KDevelop project file in this directory. Since you probably don't have one yet, simply hit
- Hit again
- KDevelop will then ask you to choose a project manager. If this project uses standard Unix make files, choose the custom makefile project manager
- KDevelop will then start to parse the entire project. Again, it will take quite a while to go through all files and index classes etc. At the bottom right of the main window, there is a progress bar on the bottom right that shows how long this process has come along. (If you have several processor cores, you can accelerate this process by going to the menu item, then selecting on the left, and increasing the number of threads for background parsing on the right.)
Setting up an application as a second project
The next thing you want to do is set up other projects in the same session. In the example above, you would want to add the device driver as the second project, which you can do using exactly the same steps.
If you have multiple applications or libraries, simply repeat the steps to add more and more projects to your session.
Creating projects from scratch
There is of course also the possibility that you want to start a new project from scratch. This can be done using the
menu item. The details of what options this offers to you are described elsewhere in this manual.