Skip to content

Commit

Permalink
Update docs/clion.md
Browse files Browse the repository at this point in the history
- Replaced 'Building, Running, and Debugging' section
  - Previously, this section was incomplete and only described how to
build chromium.
  - Added instructions to run and visually debug as well.
  - Updated build instructions to support debugging.
- Simplified recommended CMakeLists.txt file
- Simplified instructions for creating a desktop entry
- Increased recommended VM option Xmx from 5g to 10g
- Marked optional steps as optional
- Punctuation fixes
- Added link to clion.md to docs/README.md

Change-Id: Id0514b1498517e0c10fafb1a9639aeda44717921
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1976280
Commit-Queue: manuk hovanesian <manukh@chromium.org>
Reviewed-by: Tommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726546}
  • Loading branch information
manukh authored and Commit Bot committed Dec 19, 2019
1 parent 1c5743c commit 080b47e
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 125 deletions.
7 changes: 4 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ used when committed.

### Integrated Development Environment (IDE) Set Up Guides
* [Android Studio](android_studio.md) - Android Studio for Android builds
* [Atom](atom.md) - Atom multi-platform code editor
* [CLion](clion.md) - CLion IDE, supports GUI debugging.
* [Eclipse for Android](eclipse.md) - Eclipse for Android
* [Eclipse for Linux](linux_eclipse_dev.md) - Eclipse for other platforms
(This guide was written for Linux, but is probably usable on Windows/MacOS
as well)
* [Qt Creator](qtcreator.md) - Using Qt Creator as an IDE or GUI debugger
* [Setting up Visual Studio Code](vscode.md) - Visual Studio Code
* [EMACS Notes](emacs.md) - EMACS commands/styles/tool integrations
* [Atom](atom.md) - Atom multi-platform code editor
* [Qt Creator](qtcreator.md) - Using Qt Creator as an IDE or GUI debugger
* [Visual Studio Code](vscode.md) - Visual Studio Code

### Git
* [Git Cookbook](git_cookbook.md) - A collection of git recipes for common
Expand Down
105 changes: 105 additions & 0 deletions docs/clion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# CLion Dev

CLion is an IDE

Prerequisite:
[Checking out and building the chromium code base](README.md#Checking-Out-and-Building)

[TOC]

## Setting up CLion
1. Install CLion
- Googlers only: See
[go/intellij-getting-started](https://goto.google.com/intellij-getting-started)
for installation and license authentication instructions

1. Run CLion
1. Increase CLion's memory allocation

This step will help performance with large projects
1. Option 1
1. At the startup dialogue, in the bottom right corner, click
`Configure`
1. Setup `Edit Custom VM Options`:
```
-Xss2m
-Xms1g
-Xmx10g
...
```
1. (Optional) Setup `Edit Custom Properties`:
```
idea.max.intellisense.filesize=12500
```
1. Option 2; 2017 and prior versions may not include the options to setup
your `VM Options` and `Properties` in the `configure` menu. Instead:
1. `Create New Project`
1. `Help` > `Edit Custom VM Options`
1. (Optional) `Help` > `Edit Custom Properties`
## Chromium in CLion
1. Import project
- At the startup dialog, select `Import Project` and select your `chromium`
directory; this should be the parent directory to `src`. Selecting `src`
instead would result in some CLion IDE files appearing in your repository.
1. (Optional) Modify the `CMakeLists.txt` file
1. Open the `CMakeLists.txt` file
1. Replace the `include_directories` with the following. This will help
with navigating between files.
```
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
```
1. (Optional) Replace the `add_executable` files to include a single file.
Doing this might improve CLion performance. Leaving at least 1 file is
required in order for CLion to provide code completion, navigation, etc.
The file should now look like:
```
cmake_minimum_required(VERSION 3.10)
project(chromium)
set(CMAKE_CXX_STANDARD 14)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
add_executable(chromium src/components/omnibox/browser/document_provider.cc)
```
## Building, Running, and Debugging within CLion
1. Edit the `custom build targets` settings
1. `ctrl+shift+a` > `custom build targets`
1. Click the `+` button to create a new target.
1. Click the `...` button next to the `Build` field
1. Click the `+` button in the new panel
1. Configure the fields:
```
Program: <absolute path to depot_tools/ninja>
Arguments: -C src/out/Default -j 1000 chrome
```
1. (Optional) Repeat for Debug or other build configurations.
1. Create a run configuration
1. `Run` > `Edit Configurations`
1. Click `+` in the top left and select `Custom Build Application`
1. Set the `Target` field to one of the targets configured in step 1
1. Click 'Select other` option for the `Executable` field and select the
chrome build e.g. `out/Default/chrome`
1. (Optional) Repeat for Debug or other build configurations. The built
targets and executables should match; i.e. don't build `out/Debug `but
execute `out/Default/chrome`.
1. `Run` > `Run` (`shift+f10`) or `Run` > `Debug` (`shift+f9`) (screenshot)
![debugging screenshot](images/clion_gui_debugging.png)
## Optional Steps
### Create terminal cli or desktop entry
To make it easier to startup CLion or open individual files:
1. Open the actions menu (`ctrl+shift+a`)
1. Type `create desktop entry` and press `enter`
1. Open the actions menu and enter `create command-line launcher`
### Mark directories as `Library Files`
To speed up CLion, optionally mark directories such as `src/third_party` as
`Library Files`
1. Open the `Project` navigation (`alt+1`)
1. Select and right click the directories > `Mark directory as` >
`Library Files`
1. See `https://blog.jetbrains.com/clion/2015/12/mark-dir-as/` for more details
122 changes: 0 additions & 122 deletions docs/clion_dev.md

This file was deleted.

Binary file added docs/images/clion_gui_debugging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 080b47e

Please sign in to comment.