|
155 | 155 | Creating an Image File
|
156 | 156 | -----------------------
|
157 | 157 | Because the file is written to the standard output stream, you'll need to redirect it to an image
|
158 |
| -file. Typically this is done from the command-line by using the `>` redirection operator, like so: |
| 158 | +file. Typically this is done from the command-line by using the `>` redirection operator. |
| 159 | + |
| 160 | +On Windows, you'd get the debug build from CMake running this command: |
| 161 | + |
| 162 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 163 | + cmake -B build |
| 164 | + cmake --build build |
| 165 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 166 | + |
| 167 | +Then run your newly-built program like so: |
| 168 | + |
| 169 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 170 | + build\Debug\inOneWeekend.exe > image.ppm |
| 171 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 172 | + |
| 173 | +Later, it will be better to run optimized builds for speed. In that case, you would build like this: |
| 174 | + |
| 175 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 176 | + cmake --build build --config release |
| 177 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 178 | + |
| 179 | +and would run the optimized program like this: |
159 | 180 |
|
160 | 181 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
161 | 182 | build\Release\inOneWeekend.exe > image.ppm
|
162 | 183 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
163 | 184 |
|
164 |
| -(This example assumes that you are building with CMake, using the same approach as the |
| 185 | +The examples above assume that you are building with CMake, using the same approach as the |
165 | 186 | `CMakeLists.txt` file in the included source. Use whatever build environment (and language) you're
|
166 |
| -comfortable with.) |
| 187 | +most comfortable with. |
167 | 188 |
|
168 |
| -This is how things would look on Windows with CMake. On Mac or Linux, it might look like this: |
| 189 | +On Mac or Linux, release build, you would launch the program like this: |
169 | 190 |
|
170 | 191 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
171 | 192 | build/inOneWeekend > image.ppm
|
|
0 commit comments