aboutsummaryrefslogtreecommitdiffhomepage
path: root/site
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2016-11-11 11:39:44 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-11 17:34:36 +0000
commit38af9438d7b7fa838aff2931d9afb4dd4a82549d (patch)
tree6e6b5484bf2e6d1bd880eacffd395dd4c55b158d /site
parent64dded3d95be625b65120a91ed29dd58112489d3 (diff)
GN: build Lua tools when skia_use_lua.
When we opt into Lua, this builds SampleLua into SampleApp, and the lua_app and lua_pictures tools. I've tested this builds with and without skia_use_system_lua on my Mac laptop and Linux desktop. I've made lua_pictures.cpp's flags static to avoid conflicts with flags in SkCommonFlags.cpp. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4699 DOCS_PREVIEW= https://skia.org/?cl=4699 Change-Id: I8176fd51d8a38746e7d730cfcce66da42b9a015a Reviewed-on: https://skia-review.googlesource.com/4699 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'site')
-rw-r--r--site/user/special/lua.md42
1 files changed, 15 insertions, 27 deletions
diff --git a/site/user/special/lua.md b/site/user/special/lua.md
index 448d8b9b13..b8a9cd5c9b 100644
--- a/site/user/special/lua.md
+++ b/site/user/special/lua.md
@@ -1,38 +1,35 @@
Skia Lua Bindings
=================
-**Warning: The following has only been tested on Linux, but it will likely
-work for any Unix.**
+**Warning: The following has only been tested on Mac and Linux, but it will
+likely work for any Unix.**
Prerequisites
-------------
-This assumes one already has Skia building normally. If not, refer to the
-quick start guides. In addition to that, you will need Lua 5.2 installed on
-your system in order to use the bindings.
-
-Building lua requires the readline development library. If missing this can be installed (on Ubuntu) by executing:
-
- * `apt-cache search libreadline` to see the available libreadline libraries
- * `sudo apt-get install libreadline6 libreadline6-dev` to actually install the libraries
+This assumes you already have Skia building normally. If not, refer to [How to
+build Skia](../build).
Build
-----
-The build process starts the same way as described in the quick starts, but
-before using gyp or make, do this instead:
-
- $ export GYP_DEFINES="skia_shared_lib=1"
- $ make tools
+To build Lua support into Skia tools, set the GN argument `skia_use_lua` to `true`.
+Optionally, set `skia_use_system_lua`. Then re-run GN.
-This tells Skia to build as a shared library, which enables a build of another shared library called 'skia.so' that exposes Skia bindings to Lua.
Try It Out
----------
-Once the build is complete, use the same terminal:
+The tools `lua_app` and `lua_pictures` should now be available when you compile,
+and `SampleApp` should now have a `Lua` sample.
+
+
+To-Do
+-----
+
+Skia had a feature that let it be imported as an .so by Lua.
+This feature is not yet supported by GN, but would have looked something like this:
- $ cd out/Debug/
$ lua
Lua 5.2.0 Copyright (C) 1994-2011 Lua.org, PUC-Rio
@@ -43,12 +40,3 @@ Once the build is complete, use the same terminal:
> canvas = doc:beginPage(72*8.5, 72*11)
> canvas:drawText('Hello Lua', 300, 300, paint)
> doc:close()
-
-The key part to loading the bindings is `require 'skia'` which tells lua to look
-for 'skia.so' in the current directory (among many others) and provides the
-bindings. 'skia.so' in turn will load 'libskia.so' from the current directory or
-in our case the lib.target directory. 'libskia.so' is what contains the native
-skia code. The script shown above uses skia to draw Hello Lua in red text onto
-a pdf that will be outputted into the current folder as 'test.pdf'. Go ahead and
-open 'test.pdf' to confirm that everything is working.
-