Doc: Update info about importing generic projcts

Move the topic from Build Systems to How To: Manage Projects.

Task-number: QTCREATORBUG-29361
Change-Id: Ia91ef716a2907c9ae9296852ca137d3fa1f3e4c1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Leena Miettinen
2023-12-14 17:05:17 +01:00
parent ac9c0ecb99
commit 3f24752247
4 changed files with 58 additions and 80 deletions

View File

@@ -42,7 +42,7 @@
\c{qmake -project} and \l{Open projects}{open} that in \QC. \c{qmake -project} and \l{Open projects}{open} that in \QC.
Typically, you cannot compile such projects without manual changes. Typically, you cannot compile such projects without manual changes.
\li Manually create an ad-hoc project file for a \li Manually create an ad-hoc project file for a
\l{Setting Up a Generic Project}{generic project} and \l{Import an existing project}{generic project} and
open that in \QC. open that in \QC.
Typically, you cannot compile such projects without manual changes. Typically, you cannot compile such projects without manual changes.
\endlist \endlist

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2022 The Qt Company Ltd. // Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
// ********************************************************************** // **********************************************************************
@@ -11,25 +11,19 @@
\page creator-project-generic.html \page creator-project-generic.html
\previouspage creator-reference.html \previouspage creator-reference.html
\ingroup creator-reference-build-systems \ingroup creator-how-to-projects
\title Setting Up a Generic Project \title Import an existing project
\brief \QC supports generic projects, so you can import existing projects Import existing projects that do not use CMake, qmake, or one of the other
that do not use qmake or CMake. This enables you to use \QC as a directly supported build tools to use \QC as a code editor and to fully
code editor and to fully control the steps and commands used to control the steps and commands for building the project.
build the project. To change the way the project is built, change the \c make command
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}. in the \uicontrol{Projects} mode under \uicontrol{Build Settings}.
When you import a project, \QC creates the following files that With the following files, you can specify which files belong to your project
allow you to specify which files belong to your project and which include and which include directories or defines to pass to your compiler:
directories or defines you want to pass to your compiler: \c {.files}, \c {.includes}, and \c {.config}.
\tt{.files}, \tt{.includes}, and \tt{.config}.
\section1 Importing a Generic Project
To import an existing generic project: To import an existing generic project:
@@ -42,62 +36,54 @@
and select the location of the project file you want to import. and select the location of the project file you want to import.
\QC automatically generates the following files in the \QC automatically generates the following files in the
project directory: project directory and shows them in the \l Projects view:
\list \list
\li \l{Specifying Files}{.files} \li \c {.files}
\li \l{Specifying Include Paths and Framework Paths}{.includes} \li \c {.includes}
\li \l{Specifying Defines}{.config} \li \c {.config}
\li .creator \li \c .creator
\li \l{Forwarding Flags to Clang Code Model}{.cflags} \li \c {.cflags}
\li \l{Forwarding Flags to Clang Code Model}{.cxxflags} \li \c {.cxxflags}
\endlist \endlist
\endlist \endlist
When the project is successfully imported, \QC creates the project The \c .creator file is considered the \e {project file}, so you need to open
tree in the sidebar. it when you want to open the project later.
After importing a generic project into \QC, open it by selecting the \section1 Specify files
\tt{.creator} file.
\section1 Working with Generic Project Files
For a generic project, you have to manually specify which files belong to 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 project in the \c {.files} file. When you import a generic project,
your compiler. \QC adds any files it recognizes to your project.
\section1 Specifying Files To add or remove files, edit the \c {.files} file in \QC. \QC updates the
contents of \uicontrol Projects when you save the \c {.files} file.
Or, use the context menu in \uicontrol Projects to add and remove files or
directories.
The list of files for a generic project is specified in the \tt{.files} \section2 Use a script
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. If you frequently need to update the \c {.files} file, use a script. If the
\QC recreates your project tree when you save the \tt{.files} file. file is modified externally, you have to close and reopen the project for the
Alternatively, you can add and remove files or directories using the changes to take effect.
context menu in the project tree.
If you frequently need to update the \tt{.files} file, you can do so To update the \c {.files} file in the \uicontrol Git repository, use the
efficiently by using a script that updates the file for you. If the file following script:
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 \code
git ls-files "*.cpp" "*.h" > MyProject.files git ls-files "*.cpp" "*.h" > MyProject.files
\endcode \endcode
\section2 Precompiled Headers \section2 Precompiled headers
To use precompiled headers in a generic project, add the \c pch tag after To use precompiled headers in a generic project, add the \c pch tag after
a file path in the \c .files file, separated by the pipe character (|). a file path in the \c .files file, separated by the pipe character (|).
@@ -107,55 +93,47 @@
src/pch.h|pch src/pch.h|pch
\endcode \endcode
\section1 Specifying Include Paths and Framework Paths \section1 Specify include paths and framework paths
The include paths are specified in the \tt{.includes} file, one include Specify include paths in the \c {.includes} file, one include
path per line. The paths can be either absolute or relative to the path per line. The paths can be either absolute or relative to the
\tt{.includes} file. \c {.includes} file.
Lines starting with "-F" are interpreted as framework paths. Lines starting with \c -F are interpreted as framework paths.
\section1 Specifying Defines \section1 Specify defines
The defines are specified in the \tt{.config} file. The \tt{.config} file is Specify defines in the \c {.config} file. It is
a regular C++ file, prepended to all your source files when they are parsed. 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: Only use the \c {.config} file to add lines as in the example below:
\code \code
#define NAME value #define NAME value
\endcode \endcode
\section1 Forwarding Flags to Clang Code Model \section1 Forward flags to Clang code model
The \c {.cxxflags} and \c {.cflags} files have command-line flags for the The \c {.cxxflags} and \c {.cflags} files have command-line flags for the
Clang code model on a single line. Clang code model on a single line.
For example, specify the \c {-std=c++11} to set the language version For example, add the \c {-std=c++11} line to set the language version
for parsing as C++11. for parsing as C++11.
\section1 Providing Deployment Information \section1 Provide deployment information
If you want to run your application on a remote Linux device, To run an application on a remote Linux device,
you first need to deploy your executable and possibly other files. you first need to deploy your executable and possibly other files.
\QC does that for you automatically if you enter the necessary \QC does that for you automatically if you enter the necessary
information. This works the same way as explained for CMake in information. This works the same way as explained for CMake in
\l {Deploying to Remote Linux}, \l {Deploying to Remote Linux},
except that you also need to include your application binary in the list. except that you also need to include your application binary in the list.
\section1 Creating a Run Configuration \section1 Create a run configuration
\QC cannot automatically determine which executable to run. \QC cannot automatically determine which executable to run, so you must
set the executable in \uicontrol {Projects} > \uicontrol {Run} >
In the \uicontrol{Projects} mode under \uicontrol{Run Settings}, define the executable \uicontrol Add > \uicontrol {Custom 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
\sa {Specify a custom executable to run}, {Use project wizards},
{Configuring Projects}
*/ */

View File

@@ -109,11 +109,11 @@
\title Specify a custom executable to run \title Specify a custom executable to run
If you use \l{Meson} or the If you use \l{Meson} or the \l{Import an existing project}
\l{Setting Up a Generic Project}{generic project type}, or want {generic project type}, or want to run a custom desktop executable,
to run a custom desktop executable, create a \uicontrol {Custom Executable} create a \uicontrol {Custom Executable} run configuration for your
run configuration for your project. For example, when working on a library, project. For example, when working on a library, you can run a test
you can run a test application that links against the library. application that links against the library.
To specify a custom executable to run: To specify a custom executable to run:
@@ -125,5 +125,5 @@
file to run. file to run.
\endlist \endlist
\sa {Configure projects for running} \sa {Configure projects for running}, {Import an existing project}
*/ */

View File

@@ -81,7 +81,7 @@
\QC also changes corresponding include statements accordingly. \QC also changes corresponding include statements accordingly.
\li Remove existing files. \li Remove existing files.
\if defined(qtcreator) \if defined(qtcreator)
\li Remove existing directories from \l{Setting Up a Generic Project} \li Remove existing directories from \l{Import an existing project}
{generic projects}. {generic projects}.
\li Add existing files and directories. \li Add existing files and directories.
\li Add libraries. For more information, see \li Add libraries. For more information, see