Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: docs/linux_eclipse_dev.md

Issue 2866573003: Minor clean ups to linux_eclipse_dev.md (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Linux Eclipse Dev 1 # Linux Eclipse Dev
2 2
3 Eclipse can be used on Linux (and probably Windows and Mac) as an IDE for 3 Eclipse can be used on Linux (and probably Windows and Mac) as an IDE for
4 developing Chromium. It's unpolished, but here's what works: 4 developing Chromium. It's unpolished, but here's what works:
5 5
6 * Editing code works well (especially if you're used to it or Visual Studio). 6 * Editing code works well (especially if you're used to it or Visual Studio).
7 * Navigating around the code works well. There are multiple ways to do this 7 * Navigating around the code works well. There are multiple ways to do this
8 (F3, control-click, outlines). 8 (F3, control-click, outlines).
9 * Building works fairly well and it does a decent job of parsing errors so 9 * Building works fairly well and it does a decent job of parsing errors so
10 that you can click and jump to the problem spot. 10 that you can click and jump to the problem spot.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 Before you start setting up your work space - here are a few hints: 59 Before you start setting up your work space - here are a few hints:
60 60
61 * Don't put your checkout on a remote file system (e.g. NFS filer). It's too 61 * Don't put your checkout on a remote file system (e.g. NFS filer). It's too
62 slow both for building and for Eclipse. 62 slow both for building and for Eclipse.
63 * Make sure there is no file system link in your source path because Ninja 63 * Make sure there is no file system link in your source path because Ninja
64 will resolve it for a faster build and Eclipse / GDB will get confused. 64 will resolve it for a faster build and Eclipse / GDB will get confused.
65 (Note: This means that the source will possibly not reside in your user 65 (Note: This means that the source will possibly not reside in your user
66 directory since it would require a link from filer to your local 66 directory since it would require a link from filer to your local
67 repository.) 67 repository.)
68 * You may want to start Eclipse from the source root. To do this you can add
69 an icon to your task bar as launcher. It should point to a shell script
70 which will set the current path to your source base, and then start Eclipse.
71 The result would probably look like this:
72
73 ```shell
74 ~/.bashrc
75 cd /usr/local/google/chromium/src
76 export PATH=/home/skuhne/depot_tools:/usr/local/google/goma/goma:/opt/eclips e:/usr/local/symlinks:/usr/local/scripts:/usr/local/sbin:/usr/local/bin:/usr/sbi n:/usr/bin:/sbin:/bin
77 /opt/eclipse/eclipse -vm /usr/bin/java
78 ```
79
80 (Note: Things work fine for me without launching Eclipse from a special
81 directory. jamescook@chromium.org 2012-06-1)
82 68
83 ### Run Eclipse & Set your workspace 69 ### Run Eclipse & Set your workspace
84 70
85 Run eclipse/eclipse in a way that your regular build environment (export CC, 71 Run eclipse/eclipse in a way that your regular build environment (export CC,
86 CXX, etc...) will be visible to the eclipse process. 72 CXX, etc...) will be visible to the eclipse process.
87 73
88 Set the Workspace to be a directory on a local disk (e.g. 74 Set the Workspace to be a directory on a local disk (e.g.
89 `/work/workspaces/chrome`). Placing it on an NFS share is not recommended -- 75 `/work/workspaces/chrome`). Placing it on an NFS share is not recommended --
90 it's too slow and Eclipse will block on access. Don't put the workspace in the 76 it's too slow and Eclipse will block on access. Don't put the workspace in the
91 same directory as your checkout. 77 same directory as your checkout.
92 78
93 ### Install the C Development Tools ("CDT") 79 ### Install the C Development Tools ("CDT")
94 80
95 1. From the Help menu, select Install New Software... 81 1. From the Help menu, select Install New Software...
96 1. Select the 'Workd with' URL for the CDT 82 1. Select the 'Work with' URL for the CDT
97 If it's not there you can click Add... and add it. 83 If it's not there you can click Add... and add it.
98 See https://eclipse.org/cdt/downloads.php for up to date versions, 84 See https://eclipse.org/cdt/downloads.php for up to date versions,
99 e.g. with CDT 8.7.0 for Eclipse Mars, use 85 e.g. with CDT 8.7.0 for Eclipse Mars, use
100 http://download.eclipse.org/tools/cdt/releases/8.7 86 http://download.eclipse.org/tools/cdt/releases/8.7
101 1. Googlers: We have a local mirror, but be sure you run prodaccess before 87 1. Googlers: We have a local mirror, but be sure you run prodaccess before
102 trying to use it. 88 trying to use it.
103 1. Select & install the Main and Optional features. 89 1. Select & install the Main and Optional features.
104 1. Restart Eclipse 90 1. Restart Eclipse
105 1. Go to Window > Open Perspective > Other... > C/C++ to switch to the C++ 91 1. Go to Window > Open Perspective > Other... > C/C++ to switch to the C++
106 perspective (window layout). 92 perspective (window layout).
107 1. Right-click on the "Java" perspective in the top-right corner and select 93 1. Right-click on the "Java" perspective in the top-right corner and select
108 "Close" to remove it. 94 "Close" to remove it.
109 95
110 ### Create your project(s) 96 ### Create your project(s)
111 97
112 First, turn off automatic workspace refresh and automatic building, as Eclipse 98 First, turn off automatic workspace refresh and automatic building, as Eclipse
113 tries to do these too often and gets confused: 99 tries to do these too often and gets confused:
114 100
115 1. Open Window > Preferences 101 1. Open Window > Preferences
116 1. Search for "workspace" 102 1. Search for "workspace"
117 1. Turn off "Build automatically" 103 1. Turn off "Build automatically"
118 1. Turn off "Refresh using native hooks or polling" 104 1. Turn off "Refresh using native hooks or polling"
119 1. Click "Apply" 105 1. Click "Apply"
120 106
121 Chromium uses C++11, so tell the indexer about it. Otherwise it will get
122 confused about things like std::unique_ptr.
123
124 1. Open Window > Preferences > C/C++ > Build > Settings > Discovery >
125 CDT GCC Build-in Compiler Settings
126 1. In the text box entitled Command to get compiler specs append "-std=c++11"
127
128 Create a single Eclipse project for everything: 107 Create a single Eclipse project for everything:
129 108
130 1. From the File menu, select New > Project... 109 1. From the File menu, select New > Project...
131 1. Select C/C++ Project > Makefile Project with Existing Code 110 1. Select C/C++ Project > Makefile Project with Existing Code
132 1. Name the project the exact name of the directory: "src" 111 1. Name the project the exact name of the directory: "src" (or "WebKit" if you
133 1. Provide a path to the code, like /work/chromium/src 112 mainly work in Blink and want a faster experience)
113 1. Provide a path to the code, like /work/chromium/src (or
114 /work/chromium/src/third_party/WebKit)
134 1. Select toolchain: Linux GCC 115 1. Select toolchain: Linux GCC
135 1. Click Finish. 116 1. Click Finish.
136 117
118 Chromium uses C++11, so tell the indexer about it. Otherwise it will get
119 confused about things like std::unique_ptr.
120
121 1. Right-click on "src" and select "Properties..."
122 1. Navigate to C/C++ General > Preprocess Include Paths, Macros etc. >
123 Providers
124 1. Select CDT GCC Built-in Compiler Settings
125 1. In the text box entitled Command to get compiler specs append "-std=c++11"
126 (leaving out the quotes)
127
137 Chromium has a huge amount of code, enough that Eclipse can take a very long 128 Chromium has a huge amount of code, enough that Eclipse can take a very long
138 time to perform operations like "go to definition" and "open resource". You need 129 time to perform operations like "go to definition" and "open resource". You need
139 to set it up to operate on a subset of the code. 130 to set it up to operate on a subset of the code.
140 131
141 In the Project Explorer on the left side: 132 In the Project Explorer on the left side:
142 133
143 1. Right-click on "src" and select "Properties..." 134 1. Right-click on "src" and select "Properties..."
144 1. Open Resource > Resource Filters 135 1. Open Resource > Resource Filters
145 1. Click "Add..." 136 1. Click "Add Filter..."
146 1. Add the following filter: 137 1. Add the following filter:
147 * Include only 138 * Include only
148 * Files, all children (recursive) 139 * Files, all children (recursive)
149 * Name matches 140 * Name matches
150 `.*\.(c|cc|cpp|h|mm|inl|idl|js|json|css|html|gyp|gypi|grd|grdp|gn|gni|mo jom)` 141 `.*\.(c|cc|cpp|h|mm|inl|idl|js|json|css|html|gyp|gypi|grd|grdp|gn|gni|mo jom)`
151 regular expression 142 regular expression
152 1. Add another filter: 143 1. Add another filter:
153 * Exclude all 144 * Exclude all
154 * Folders 145 * Folders
155 * Name matches `out_.*|\.git|\.svn|LayoutTests` regular expression 146 * Name matches `out_.*|\.git|LayoutTests` regular expression
156 * If you aren't working on WebKit, adding `|WebKit` will remove more 147 * If you aren't working on WebKit, adding `|WebKit` will remove more
157 files 148 files
158 1. Click "OK" 149 1. Click "Apply and Close"
159 150
160 Don't exclude the primary "out" directory, as it contains generated header files 151 Don't exclude the primary "out" directory, as it contains generated header files
161 for things like string resources and Eclipse will miss a lot of symbols if you 152 for things like string resources and Eclipse will miss a lot of symbols if you
162 do. 153 do.
163 154
164 Eclipse will refresh the workspace and start indexing your code. It won't find 155 Eclipse will refresh the workspace and start indexing your code. It won't find
165 most header files, however. Give it more help finding them: 156 most header files, however. Give it more help finding them:
166 157
167 1. Open Window > Preferences 158 1. Open Window > Preferences
168 1. Search for "Indexer" 159 1. Search for "Indexer"
169 1. Turn on "Allow heuristic resolution of includes" 160 1. Turn on "Allow heuristic resolution of includes"
170 1. Select "Use active build configuration" 161 1. Select "Use active build configuration"
171 1. Set Cache limits > Index database > Limit relative... to 20% 162 1. Set Cache limits > Index database > Limit relative... to 20%
172 1. Set Cache limits > Index database > Absolute limit to 256 MB 163 1. Set Cache limits > Index database > Absolute limit to 256 MB
173 1. Click "OK" 164 1. Click "Apply and Close"
174 165
175 Now the indexer will find many more include files, regardless of which approach 166 Now the indexer will find many more include files, regardless of which approach
176 you take below. 167 you take below.
177 168
178 #### Optional: Manual header paths and symbols 169 #### Optional: Manual header paths and symbols
179 170
180 You can manually tell Eclipse where to find header files, which will allow it to 171 You can manually tell Eclipse where to find header files, which will allow it to
181 create the source code index before you do a real build. 172 create the source code index before you do a real build.
182 173
183 1. Right-click on "src" and select "Properties..." 174 1. Right-click on "src" and select "Properties..."
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 ### Optional: Accurate symbol information 272 ### Optional: Accurate symbol information
282 273
283 If setup properly, Eclipse can do a great job of semantic navigation of C++ code 274 If setup properly, Eclipse can do a great job of semantic navigation of C++ code
284 (showing type hierarchies, finding all references to a particular method even 275 (showing type hierarchies, finding all references to a particular method even
285 when other classes have methods of the same name, etc.). But doing this well 276 when other classes have methods of the same name, etc.). But doing this well
286 requires the Eclipse knows correct include paths and pre-processor definitions. 277 requires the Eclipse knows correct include paths and pre-processor definitions.
287 After fighting with with a number of approaches, I've found the below to work 278 After fighting with with a number of approaches, I've found the below to work
288 best for me. 279 best for me.
289 280
290 1. From a shell in your src directory, run 281 1. From a shell in your src directory, run
291 `gn gen --ide=eclipse out/Debug_gn/' (replacing Debug_gn with the output dir ectory you normally use when building). 282 `gn gen --ide=eclipse out/Debug/` (replacing Debug with the output directory you normally use when building).
292 1. This generates <project root>/out/Debug_gn/eclipse-cdt-settings.xml whic h 283 1. This generates <project root>/out/Debug/eclipse-cdt-settings.xml which
293 is used below. 284 is used below.
294 1. This creates a single list of include directories and preprocessor 285 1. This creates a single list of include directories and preprocessor
295 definitions to be used for all source files, and so is a little 286 definitions to be used for all source files, and so is a little
296 inaccurate. Here are some tips for compensating for the limitations: 287 inaccurate. Here are some tips for compensating for the limitations:
297 1. If you care about blink, move 'third\_party/WebKit/Source' to the 288 1. If you care about blink, move 'third\_party/WebKit/Source' to the
298 top of the list to better resolve ambiguous include paths (eg. 289 top of the list to better resolve ambiguous include paths (eg.
299 `config.h`). 290 `config.h`).
300 1. Import paths and symbols 291 1. Import paths and symbols
301 1. Right click on the project and select Properties > C/C++ General > Paths 292 1. Right click on the project and select Properties > C/C++ General > Paths
302 and Symbols 293 and Symbols
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 sure the editor is not maximized inside Eclipse, i.e. you should see more 384 sure the editor is not maximized inside Eclipse, i.e. you should see more
394 subwindows around. 385 subwindows around.
395 386
396 ### Additional tips 387 ### Additional tips
397 388
398 1. Mozilla's 389 1. Mozilla's
399 [Eclipse CDT guide](https://developer.mozilla.org/en-US/docs/Eclipse_CDT) 390 [Eclipse CDT guide](https://developer.mozilla.org/en-US/docs/Eclipse_CDT)
400 is helpful: 391 is helpful:
401 1. For improved performance, I use medium-granularity projects (eg. one for 392 1. For improved performance, I use medium-granularity projects (eg. one for
402 WebKit/Source) instead of putting all of 'src/' in one project. 393 WebKit/Source) instead of putting all of 'src/' in one project.
403 1. For working in Blink (which uses WebKit code style), feel free to use
404 [this](https://drive.google.com/file/d/0B2LVVIKSxUVYM3R6U0tUa1dmY0U/view?usp =sharing)
405 code-style formatter XML profile
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698