Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # PDFium | 1 # PDFium |
| 2 | 2 |
| 3 ## News | 3 ## News |
| 4 | 4 |
| 5 As of 2016-02-04, the XFA branch is deprecated. Instead, see | |
| 6 [the section on configuration](#BuildConfig) below. | |
| 7 | |
| 8 As of 2016-04-28, the Visual Studio toolchain from depot_tools is used as the | 5 As of 2016-04-28, the Visual Studio toolchain from depot_tools is used as the |
| 9 default Windows toolchain for Googlers. Please set DEPOT_TOOLS_WIN_TOOLCHAIN=0 | 6 default Windows toolchain for Googlers. Please set DEPOT_TOOLS_WIN_TOOLCHAIN=0 |
| 10 if you need to use the system toolchain. See | 7 if you need to use the system toolchain. See |
| 11 [Windows development subsection](#WinDev) for details. | 8 [Windows development subsection](#WinDev) for details. |
| 12 | 9 |
| 13 | 10 |
|
Tom Sepez
2016/05/04 17:34:07
Add a news item for GN change. I think a 90 day l
dsinclair
2016/05/04 17:38:50
Done. Also added a bit for when GYP will go away.
| |
| 14 ## Prerequisites | 11 ## Prerequisites |
| 15 | 12 |
| 16 Get the chromium depot tools via the instructions at | 13 Get the chromium depot tools via the instructions at |
| 17 http://www.chromium.org/developers/how-tos/install-depot-tools (this provides | 14 http://www.chromium.org/developers/how-tos/install-depot-tools (this provides |
| 18 the gclient utilty needed below). | 15 the gclient utilty needed below). |
| 19 | 16 |
| 20 Also install Python, Subversion, and Git and make sure they're in your path. | 17 Also install Python, Subversion, and Git and make sure they're in your path. |
| 21 | 18 |
| 19 | |
| 22 ###<a name="WinDev"></a> Windows development | 20 ###<a name="WinDev"></a> Windows development |
| 23 | 21 |
| 24 PDFium uses a similar Windows toolchain as Chromium: | 22 PDFium uses a similar Windows toolchain as Chromium: |
| 25 | 23 |
| 26 #### Open source contributors | 24 #### Open source contributors |
| 27 Visual Studio 2015 Update 2 or later is highly recommended. | 25 Visual Studio 2015 Update 2 or later is highly recommended. |
| 28 | 26 |
| 29 Run `set DEPOT_TOOLS_WIN_TOOLCHAIN=0`, or set that variable in your global | 27 Run `set DEPOT_TOOLS_WIN_TOOLCHAIN=0`, or set that variable in your global |
| 30 environment. | 28 environment. |
| 31 | 29 |
| 32 Compilation is done through ninja, **not** Visual Studio. | 30 Compilation is done through ninja, **not** Visual Studio. |
| 33 | 31 |
| 32 | |
| 34 #### Google employees | 33 #### Google employees |
| 35 | 34 |
| 36 Run: `download_from_google_storage --config` and follow the | 35 Run: `download_from_google_storage --config` and follow the |
| 37 authentication instructions. **Note that you must authenticate with your | 36 authentication instructions. **Note that you must authenticate with your |
| 38 @google.com credentials**. Enter "0" if asked for a project-id. | 37 @google.com credentials**. Enter "0" if asked for a project-id. |
| 39 | 38 |
| 40 Once you've done this, the toolchain will be installed automatically for | 39 Once you've done this, the toolchain will be installed automatically for |
| 41 you in [the step](#GenBuild) below. | 40 you in [the step](#GenBuild) below. |
| 42 | 41 |
| 43 The toolchain will be in `depot_tools\win_toolchain\vs_files\<hash>`, and windbg | 42 The toolchain will be in `depot_tools\win_toolchain\vs_files\<hash>`, and windbg |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 56 ``` | 55 ``` |
| 57 mkdir repo | 56 mkdir repo |
| 58 cd repo | 57 cd repo |
| 59 gclient config --unmanaged https://pdfium.googlesource.com/pdfium.git | 58 gclient config --unmanaged https://pdfium.googlesource.com/pdfium.git |
| 60 gclient sync | 59 gclient sync |
| 61 cd pdfium | 60 cd pdfium |
| 62 ``` | 61 ``` |
| 63 | 62 |
| 64 ##<a name="GenBuild"></a> Generate the build files | 63 ##<a name="GenBuild"></a> Generate the build files |
| 65 | 64 |
| 66 We use the GYP library to generate the build files. | 65 We use GN to generate the build files and |
| 66 [Ninja](http://martine.github.io/ninja/) (also included with the depot\_tools | |
| 67 checkout) to execute the build files. | |
| 67 | 68 |
| 68 At this point, you have two options. The first option is to use the [Ninja] | 69 ``` |
| 69 (http://martine.github.io/ninja/) build system (also included with the | 70 gn gen out/Debug |
| 70 depot\_tools checkout). This is the default as of mid-September, 2015. | 71 ``` |
| 71 Previously, the second option (platform-specific build files) was the default. | |
| 72 Most PDFium developers use Ninja, as does our [continuous build system] | |
| 73 (http://build.chromium.org/p/client.pdfium/). | |
| 74 | |
| 75 * On Windows: `build_gyp\gyp_pdfium` | |
| 76 * For all other platforms: `build_gyp/gyp_pdfium` | |
| 77 | |
| 78 The second option is to generate platform-specific build files, i.e. Makefiles | |
| 79 on Linux, sln files on Windows, and xcodeproj files on Mac. To do so, set the | |
| 80 GYP\_GENERATORS environment variable appropriately (e.g. "make", "msvs", or | |
| 81 "xcode") before running the above command. | |
| 82 | 72 |
| 83 ###<a name="BuildConfig"></a> Selecting build configuration | 73 ###<a name="BuildConfig"></a> Selecting build configuration |
| 84 | 74 |
| 85 PDFium may be built either with or without JavaScript support, and with | 75 PDFium may be built either with or without JavaScript support, and with |
| 86 or without XFA forms support. Both of these features are enabled by | 76 or without XFA forms support. Both of these features are enabled by |
| 87 default. Also note that the XFA feature requires JavaScript. | 77 default. Also note that the XFA feature requires JavaScript. |
| 88 | 78 |
| 89 To build without XFA, set `pdf_enable_xfa=0` before running `gyp_pdfium`. | 79 The build settings are configured by setting the GN arguments. |
| 90 To build without JavaScript, set `pdf_enable_v8=0 pdf_enable_xfa=0` before | |
| 91 running `gyp_pdfium`. For example | |
| 92 ``` | |
| 93 GYP_DEFINES='pdf_enable_v8=0 pdf_enable_xfa=0' build_gyp/gyp_pdfium | |
| 94 ``` | |
| 95 gives the smallest possible build configuration. | |
| 96 | |
| 97 ### Using goma (Googlers only) | |
| 98 | |
| 99 If you would like to build using goma, pass `use_goma=1` to `gyp_pdfium`. If | |
| 100 you installed goma in a non-standard location, you will also need to set | |
| 101 `gomadir`. e.g. | |
| 102 | 80 |
| 103 ``` | 81 ``` |
| 104 build_gyp/gyp_pdfium -D use_goma=1 -D gomadir=path/to/goma | 82 gn args out/Debug |
| 83 ``` | |
| 84 | |
| 85 Below are the available options which can be enabled. | |
| 86 | |
| 87 ``` | |
| 88 use_goma = true # Googlers only. | |
| 89 is_debug = true # Enable debugging features. | |
| 90 | |
| 91 pdf_use_skia = false # Set true to enable experimental skia backend. | |
| 92 | |
| 93 pdf_enable_xfa = true # Set false to remove XFA support (implies JS support). | |
| 94 pdf_enable_v8 = true # Set false to remove Javascript support. | |
| 95 pdf_is_standalone = true # Set for a non-embedded build. | |
| 96 | |
| 97 clang_use_chrome_plugins = false # Currently must be false | |
| 105 ``` | 98 ``` |
| 106 | 99 |
|
Tom Sepez
2016/05/04 17:34:07
Add section about how to set an arg with an exampl
dsinclair
2016/05/04 17:38:50
Better? The above is how you set the args, wrote s
| |
| 107 ## Building the code | 100 ## Building the code |
| 108 | 101 |
| 109 If you used Ninja, you can build the sample program by: `ninja -C out/Debug | 102 If you used Ninja, you can build the sample program by: `ninja -C out/Debug |
| 110 pdfium_test` You can build the entire product (which includes a few unit | 103 pdfium_test` You can build the entire product (which includes a few unit |
| 111 tests) by: `ninja -C out/Debug`. | 104 tests) by: `ninja -C out/Debug`. |
| 112 | 105 |
| 113 If you're not using Ninja, then building is platform-specific. | |
| 114 | |
| 115 * On Linux: `make pdfium_test` | |
| 116 * On Mac: `open build_gyp/all.xcodeproj` | |
| 117 * On Windows: open build_gyp\all.sln | |
| 118 | 106 |
| 119 ## Running the sample program | 107 ## Running the sample program |
| 120 | 108 |
| 121 The pdfium\_test program supports reading, parsing, and rasterizing the pages of | 109 The pdfium\_test program supports reading, parsing, and rasterizing the pages of |
| 122 a .pdf file to .ppm or .png output image files (windows supports two other | 110 a .pdf file to .ppm or .png output image files (windows supports two other |
| 123 formats). For example: `out/Debug/pdfium_test --ppm path/to/myfile.pdf`. Note | 111 formats). For example: `out/Debug/pdfium_test --ppm path/to/myfile.pdf`. Note |
| 124 that this will write output images to `path/to/myfile.pdf.<n>.ppm`. | 112 that this will write output images to `path/to/myfile.pdf.<n>.ppm`. |
| 125 | 113 |
| 126 ## Testing | 114 ## Testing |
| 127 | 115 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 148 There are several mailing lists that are setup: | 136 There are several mailing lists that are setup: |
| 149 | 137 |
| 150 * [PDFium](https://groups.google.com/forum/#!forum/pdfium) | 138 * [PDFium](https://groups.google.com/forum/#!forum/pdfium) |
| 151 * [PDFium Reviews](https://groups.google.com/forum/#!forum/pdfium-reviews) | 139 * [PDFium Reviews](https://groups.google.com/forum/#!forum/pdfium-reviews) |
| 152 * [PDFium Bugs](https://groups.google.com/forum/#!forum/pdfium-bugs) | 140 * [PDFium Bugs](https://groups.google.com/forum/#!forum/pdfium-bugs) |
| 153 | 141 |
| 154 Note, the Reviews and Bugs lists are typically read-only. | 142 Note, the Reviews and Bugs lists are typically read-only. |
| 155 | 143 |
| 156 ## Bugs | 144 ## Bugs |
| 157 | 145 |
| 158 We will be using this | 146 We use this |
| 159 [bug tracker](https://code.google.com/p/pdfium/issues/list), but for security | 147 [bug tracker](https://code.google.com/p/pdfium/issues/list), but for security |
| 160 bugs, please use [Chromium's security bug template] | 148 bugs, please use [Chromium's security bug template] |
| 161 (https://code.google.com/p/chromium/issues/entry?template=Security%20Bug) | 149 (https://code.google.com/p/chromium/issues/entry?template=Security%20Bug) |
| 162 and add the "Cr-Internals-Plugins-PDF" label. | 150 and add the "Cr-Internals-Plugins-PDF" label. |
| 163 | 151 |
| 164 ## Contributing code | 152 ## Contributing code |
| 165 | 153 |
| 166 For contributing code, we will follow | 154 For contributing code, we will follow |
| 167 [Chromium's process](http://dev.chromium.org/developers/contributing-code) | 155 [Chromium's process](http://dev.chromium.org/developers/contributing-code) |
| 168 as much as possible. The main exceptions is: | 156 as much as possible. The main exceptions is: |
| 169 | 157 |
| 170 1. Code has to conform to the existing style and not Chromium/Google style. | 158 1. Code has to conform to the existing style and not Chromium/Google style. |
| 171 | 159 |
| 172 ## Branches | |
| 173 | |
| 174 Prior to 2016-02-04, there existed an actively developed origin/xfa branch. | |
| 175 The origin/xfa branch is now an evolutionary dead-end. Everything you need | |
| 176 to build either with or without the XFA feature is on origin/master. | |
| 177 | |
| OLD | NEW |