enable shared lib support in linux for lua
R=bungeman@google.com, reed@google.com
Review URL: https://codereview.chromium.org/16099014
git-svn-id: http://skia.googlecode.com/svn/trunk@9703 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gyp/common.gypi b/gyp/common.gypi
index 05fdbf4..54c14cd 100644
--- a/gyp/common.gypi
+++ b/gyp/common.gypi
@@ -45,15 +45,6 @@
}],
],
},
- # Validate the 'skia_os' setting against 'skia_shared_lib', because shared
- # library build is only supported on Android.
- 'variables': {
- 'conditions': [
- [ 'skia_os != "android" and skia_shared_lib', {
- 'error': '<!(Skia shared lib build only currently supported on Android.)',
- }],
- ],
- },
'includes': [
'common_conditions.gypi',
],
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index 54e4ad6..3a49f14 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -149,6 +149,17 @@
'-Wno-c++11-extensions'
],
'conditions' : [
+ [ 'skia_shared_lib', {
+ 'cflags': [
+ '-fPIC',
+ ],
+ 'defines': [
+ 'GR_DLL=1',
+ 'GR_IMPLEMENTATION=1',
+ 'SKIA_DLL',
+ 'SKIA_IMPLEMENTATION=1',
+ ],
+ }],
[ 'skia_warnings_as_errors', {
'cflags': [
'-Werror',
diff --git a/gyp/tools.gyp b/gyp/tools.gyp
index d960cdc..de1d8e9 100644
--- a/gyp/tools.gyp
+++ b/gyp/tools.gyp
@@ -24,6 +24,15 @@
'skhello',
'skimage',
],
+ 'conditions': [
+ ['skia_shared_lib',
+ {
+ 'dependencies': [
+ 'sklua', # This can only be built if skia is built as a shared library
+ ],
+ },
+ ],
+ ],
},
{
'target_name': 'skdiff',
@@ -97,6 +106,7 @@
'utils.gyp:utils',
],
},
+
{
'target_name': 'lua_app',
'type': 'executable',
@@ -312,6 +322,40 @@
},
],
'conditions': [
+ ['skia_shared_lib',
+ {
+ 'targets': [
+ {
+ 'target_name': 'sklua',
+ 'product_name': 'skia',
+ 'product_prefix': '',
+ 'product_dir': '<(PRODUCT_DIR)/',
+ 'type': 'shared_library',
+ 'sources': [
+ '../src/utils/SkLuaCanvas.cpp',
+ '../src/utils/SkLua.cpp',
+ ],
+ 'include_dirs': [
+ '../third_party/lua/src/',
+ ],
+ 'dependencies': [
+ 'lua.gyp:lua',
+ 'pdf.gyp:pdf',
+ 'skia_lib.gyp:skia_lib',
+ ],
+ 'conditions': [
+ ['skia_os != "win"',
+ {
+ 'ldflags': [
+ '-Wl,-rpath,\$$ORIGIN,--enable-new-dtags',
+ ],
+ },
+ ],
+ ],
+ },
+ ],
+ },
+ ],
['skia_win_debuggers_path and skia_os == "win"',
{
'targets': [
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index aabb236..296229b 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -949,3 +949,8 @@
REG_CLASS(L, SkRRect);
REG_CLASS(L, SkTypeface);
}
+
+extern "C" int luaopen_skia(lua_State* L) {
+ SkLua::Load(L);
+ return 0;
+}