Build and Run

  1. (Optional) Specify CMakeLists.txt as the configuration file for project build.

    Find the CMakeLists.txt file in the directory on the left of the project page, right-click the file, and choose Load CMake Project from the shortcut menu to specify it as the configuration file for project build. See Figure 1.

    Figure 1 Specifying CMakeLists.txt as the configuration file for project build
  2. On the menu bar, choose Build > Edit Configurations... to access the build configuration page. Click + to add a configuration option, as shown in Figure 2. (The configuration option marked with (default) in the list is the default one. To switch the default option to a custom option, select the custom option and click .)
    Figure 2 Edit Configurations page
    Table 1 Parameters on the Edit Configurations page

    Parameter/Icon

    Description

    Name

    Custom configuration name. The default value is Debug.

    Build type

    Configuration type. The options are Debug and Release.

    Toolchain

    Toolchain configurator, which supports local and remote build. For details about the configuration, see Toolchains.

    CMake options

    CMake option. The default value is -DCMAKE_BUILD_TYPE=Debug -DCMAKE_SKIP_RPATH=TRUE.

    Build directory

    Relative path of the build directory, which is relative to the project directory.

    Build options

    Build acceleration option.

    Environment variables

    Environment variable configuration, which can be set before project build.

  3. Select one of the following build methods on the MindStudio project page based on the actual application scenario. For details about how to switch the default configuration option, see 2.
    • Choose Build > Clean CMake Project and clear build configurations. (The Clean CMake Project function supports only local build.)
    • Choose Build > Rebuild CMake Project to use the default configurations for full build.
    • Choose Build > Build CMake Project or click on the toolbar to use the default configurations for incremental build.
  4. On the top menu bar, choose Run > Edit Configurations... or click the run configuration box on the toolbar to access the run configuration page. Then, click + in the upper left corner to create the CMake Application run configuration, as shown in Figure 4. Table 2 lists the run configuration options.

    Click OK. The preparation for build and run configuration is complete.

    Figure 3 Run configuration box
    Figure 4 Run/Edit Configurations page
    Table 2 Run configuration options

    Configuration Option

    Description

    Executable

    Select the path of the executable file used for compilation to the last level.

    Program arguments

    Run parameters.

    Working directory

    Working directory. (If a relative path is configured in the project, you need to select a relative working directory.)

    Environment variables

    Enter the path of the dynamic load library (DLL).

    You can also click , and click on the displayed page. Then, enter the path.

  5. On the top menu bar, choose Run > Run 'Project_Name' to use the saved configuration to run the project.

    If the run configuration is not saved, the run configuration page is displayed after you perform the current operation. For details about how to fill in the configuration, see 4. Click Apply to apply the configuration, and then click Run to run the configuration.