aboutsummaryrefslogtreecommitdiffstats
path: root/doc/qtcreator/src/projects/creator-only/creator-projects-generic.qdoc
blob: 4a2c4c42ab0b35d8c6d933adf86ea3a13c3c0472 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
**
****************************************************************************/

// **********************************************************************
// NOTE: the sections are not ordered by their logical order to avoid
// reshuffling the file each time the index order changes (i.e., often).
// Run the fixnavi.pl script to adjust the links to the index order.
// **********************************************************************

/*!
    \previouspage creator-projects-autotools.html
    \page creator-project-generic.html
    \nextpage creator-project-nimble.html

    \title Setting Up a Generic Project

    Generic project support allows you to use \QC as a code editor. You
    can change the way your project is built by modifying the \c make command
    in the \uicontrol{Projects} mode under \uicontrol{Build Settings}.

    When you import a project, \QC creates the following files that
    allow you to specify which files belong to your project and which include
    directories or defines you want to pass to your compiler:
    \tt{.files}, \tt{.includes}, and \tt{.config}.

    \section1 Importing a Generic Project

    To import an existing generic project:

    \list 1

        \li Select \uicontrol File > \uicontrol{New File or Project} > \uicontrol{Import Project}
            > \uicontrol{Import Existing Project}.

        \li In \uicontrol{Import Existing Project}, enter the project name
            and select the location of the project file you want to import.

           \QC automatically generates the following files in the
           project directory:

           \list

               \li  \l{Specifying Files}{.files}

               \li  \l{Specifying Include Paths and Framework Paths}{.includes}

               \li  \l{Specifying Defines}{.config}

               \li  .creator

               \li  \l{Forwarding Flags to Clang Code Model}{.cflags}

               \li  \l{Forwarding Flags to Clang Code Model}{.cxxflags}

           \endlist

    \endlist

    When the project is successfully imported, \QC creates the project
    tree in the sidebar.

    After importing a generic project into \QC, open it by selecting the
    \tt{.creator} file.

    \section1 Working with Generic Project Files

    For a generic project, you have to manually specify which files belong to
    your project and which include directories or defines you want to pass to
    your compiler.

    \section1 Specifying Files

    The list of files for a generic project is specified in the \tt{.files}
    file. When you first create a generic project, \QC adds any files it
    recognizes to your project.

    To add or remove files, edit the \tt{.files} file in \QC.
    \QC recreates your project tree when you save the \tt{.files} file.
    Alternatively, you can add and remove files or directories using the
    context menu in the project tree.

    If you frequently need to update the \tt{.files} file, you can do so
    efficiently by using a script that updates the file for you. If the file
    is modified externally, you have to restart \QC for the changes to
    take effect.

    To update the \tt{.files} on the \uicontrol Git repository use the following
    script:

    \code
    git ls-files "*.cpp" "*.h" > MyProject.files
    \endcode

    \section1 Specifying Include Paths and Framework Paths

    The include paths are specified in the \tt{.includes} file, one include
    path per line. The paths can be either absolute or relative to the
    \tt{.includes} file.

    Lines starting with "-F" are interpreted as framework paths.

    \section1 Specifying Defines

    The defines are specified in the \tt{.config} file. The \tt{.config} file is
    a regular C++ file, prepended to all your source files when they are parsed.
    Only use the \tt{.config} file to add lines as in the example below:

    \code
    #define NAME value
    \endcode

    \section1 Forwarding Flags to Clang Code Model

    The \c {.cxxflags} and \c {.cflags} files contain command line flags for the
    Clang code model on a single line.

    For example, specify the \c {-std=c++11} to set the language version
    for parsing as C++11.

    \section1 Providing Deployment Information

    If you want to run your application on an embedded Linux device, you first need to
    deploy your executable and possibly other files. \QC does that for you
    automatically if you provide the necessary information. This works the same
    way as explained for CMake \l {Deploying CMake Projects to Embedded Linux Devices}{here},
    except that you also need to include your application binary in the list.

    \section1 Creating a Run Configuration

    \QC cannot automatically determine which executable to run.

    In the \uicontrol{Projects} mode under \uicontrol{Run Settings}, define the executable
    file to run:

    \list 1

        \li Click \uicontrol Add and select \uicontrol{Custom Executable}.

        \li Define the configuration name, the location of the executable, any
            additional arguments and the working directory.

    \endlist

*/