Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 Skia's Stable C API | 1 Skia's Stable C API |
| 2 =================== | 2 =================== |
| 3 | 3 |
| 4 <div style="text-align:center"> | 4 <div style="text-align:center"> |
| 5 <strong>EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL<br> | 5 <strong>EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL<br> |
| 6 DO NOT USE — FOR INTERNAL TESTING ONLY</strong> | 6 DO NOT USE — FOR INTERNAL TESTING ONLY</strong> |
| 7 </div> | 7 </div> |
| 8 | 8 |
| 9 Several issues hinder the development of a stable ABI (application | 9 Several issues hinder the development of a stable ABI (application |
| 10 binary interface) for Skia: | 10 binary interface) for Skia: |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 return 0; | 101 return 0; |
| 102 } | 102 } |
| 103 | 103 |
| 104 <a href="https://fiddle.skia.org/c/6c6c01438d9c3d80e9c22e606359432e"><img src="h ttps://fiddle.skia.org/i/6c6c01438d9c3d80e9c22e606359432e_raster.png" alt=""></a > | 104 <a href="https://fiddle.skia.org/c/6c6c01438d9c3d80e9c22e606359432e"><img src="h ttps://fiddle.skia.org/i/6c6c01438d9c3d80e9c22e606359432e_raster.png" alt=""></a > |
| 105 | 105 |
| 106 Cmake example | 106 Cmake example |
| 107 ------------- | 107 ------------- |
| 108 | 108 |
| 109 The following proof-of-concept workflow currently works on MacOS and Ubuntu | 109 The following proof-of-concept workflow currently works on MacOS and Ubuntu |
| 110 | 110 |
| 111 1. Aquire Skia (you may have already done this): | 111 1. Aquire, compile, and install Skia as a shared library: |
| 112 | 112 |
| 113 <!--?prettify lang=sh?--> | 113 <!--?prettify lang=sh?--> |
| 114 | 114 |
| 115 cd [Wherever you want skia src code] | 115 prefix="$HOME" # or /usr/local or wherever |
|
mtklein
2015/09/03 16:32:06
This seems too complicated to be a clear example.
hal.canary
2015/09/03 21:05:24
I like not depending on ninja.
I want to demonstr
| |
| 116 git clone 'https://skia.googlesource.com/skia' | 116 cd $(mktemp -d "${TMPDIR:-/tmp}/skia.XXXXXXXXXX") |
| 117 SKIA_DIR="$PWD/skia" | 117 git clone --depth 1 'https://skia.googlesource.com/skia' |
| 118 cmake -DCMAKE_INSTALL_PREFIX:PATH="$prefix" skia/cmake -G Ninja | |
| 119 ninja skia | |
| 120 ninja install | |
| 118 | 121 |
| 119 2. Compile Skia (outside of source) as a shared library: | 122 2. Compile, link, and run the example program: |
| 120 | 123 |
| 121 <!--?prettify lang=sh?--> | 124 <!--?prettify lang=sh?-->hal2 |
|
mtklein
2015/09/03 16:32:06
hal2?
hal.canary
2015/09/03 21:05:23
argh! that's the name of an emacs macro I have!
| |
| 122 | 125 |
| 123 cd [Wherever you want skia build files] | 126 cc -o skia-c-example -I "$prefix/include" \ |
|
mtklein
2015/09/03 16:32:06
Similarly,
cc -o skia-c-example ../experimental/c
| |
| 124 mkdir build_skia | 127 skia/experimental/c-api-example/skia-c-example.c \ |
| 125 cd build_skia | 128 "$prefix"/lib/libskia.* -Wl,-rpath -Wl,"$prefix/lib" |
| 126 SKIA_BUILD="$PWD" | |
| 127 cmake "$SKIA_DIR/cmake" -G Ninja && ninja | |
| 128 | |
| 129 3. Compile, link, and run the example program: | |
| 130 | |
| 131 <!--?prettify lang=sh?--> | |
| 132 | |
| 133 cd [Wherever you want the example] | |
| 134 mkdir skia_c_example | |
| 135 cd skia_c_example | |
| 136 cp "$SKIA_DIR/experimental/c-api-example/skia-c-example.c" . | |
| 137 cc -c -I "$SKIA_DIR/include/c" skia-c-example.c -o skia-c-example.o | |
| 138 c++ skia-c-example.o \ | |
| 139 "$SKIA_BUILD"/libskia.* -Wl,-rpath -Wl,"$SKIA_BUILD" \ | |
| 140 -o skia-c-example | |
| 141 ./skia-c-example | 129 ./skia-c-example |
| 142 [ $(uname) = Darwin ] && open skia-c-example.png | 130 [ $(uname) = Darwin ] && open skia-c-example.png |
| 143 [ $(uname) = Linux ] && xdg-open skia-c-example.png | 131 [ $(uname) = Linux ] && xdg-open skia-c-example.png |
| OLD | NEW |