Prepare skia for shared library build on android
authordjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 3 Jun 2013 12:10:19 +0000 (12:10 +0000)
committerdjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 3 Jun 2013 12:10:19 +0000 (12:10 +0000)
This reapplies revision 9378 after the buildbot has been updated.

R=borenet@google.com, djsollen@google.com

Review URL: https://codereview.chromium.org/15855006

git-svn-id: http://skia.googlecode.com/svn/trunk@9395 2bbb7eff-a529-9590-31e7-b0007b416f81

34 files changed:
Makefile
gyp/FileReaderApp.gyp
gyp/SampleApp.gyp
gyp/SimpleCocoaApp.gyp
gyp/SimpleiOSApp.gyp
gyp/bench.gyp
gyp/common.gypi
gyp/common_conditions.gypi
gyp/common_variables.gypi
gyp/core.gyp
gyp/debugger.gyp
gyp/effects.gyp
gyp/flags.gyp
gyp/gm.gyp
gyp/most.gyp
gyp/nacl.gyp
gyp/pathops_unittest.gyp
gyp/pdf.gyp
gyp/pixman_test.gyp
gyp/ports.gyp
gyp/sfnt.gyp
gyp/shapeops_demo.gyp
gyp/shapeops_edge.gyp
gyp/shapeops_tool.gyp
gyp/skia_base_libs.gyp [deleted file]
gyp/skia_lib.gyp [new file with mode: 0644]
gyp/tests.gyp
gyp/tools.gyp
gyp/xps.gyp
platform_tools/android/app/src/com/skia/SkiaIntentService.java
platform_tools/android/app/src/com/skia/SkiaSampleActivity.java
platform_tools/android/bin/android_setup.sh
platform_tools/android/gyp/skia_android.gypi
platform_tools/android/launcher/skia_launcher.cpp

index eb49dccd479bc2f4fa00f5a3426e53b6a0337808..a3f946f066739a1268f4afad07413aa8ef9a4f94 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -45,7 +45,7 @@ VALID_TARGETS := \
                  pathops_unittest \
                  SampleApp \
                  SkiaAndroidApp \
-                 skia_base_libs \
+                 skia_lib \
                  tests \
                  tools
 
index bcd0f0dc387de371cc9c650c8922e8874bee861e..f590ffebb3abe5f792c613dbaf734ca80082bc21 100644 (file)
@@ -18,8 +18,7 @@
         '../src/utils/mac/SkOSWindow_Mac.cpp',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
+        'skia_lib.gyp:skia_lib',
         'views.gyp:views',
         'xml.gyp:xml',
       ],
index 5531605512cd401d8cfc2069a2e08a8afd2bfdbd..59d2f84d324c21361088b2004c1faed3eaa84619 100644 (file)
         '../samplecode/SampleFontCache.cpp',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
-        'images.gyp:images',
+        'skia_lib.gyp:skia_lib',
         'views.gyp:views',
         'animator.gyp:animator',
         'xml.gyp:xml',
index 3e17ad5b9835398fbc5effdd4d7dbf446bac7cbd..6d7b9258071e4205a2c4258f203771f0cf7bd3f1 100644 (file)
@@ -25,7 +25,7 @@
 
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
+        'skia_lib.gyp:skia_lib',
         'views.gyp:views',
         'xml.gyp:xml',
       ],
index 3678e7cd1a3365121a1e3909a3ba6854106bb030..cb00f815379d33de3962eb685eaeb3d896eeddee 100644 (file)
@@ -28,9 +28,7 @@
         '../experimental/SimpleiOSApp/SimpleiOSApp-Info.plist',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
-        'images.gyp:images',
+        'skia_lib.gyp:skia_lib',
         'views.gyp:views',
         'xml.gyp:xml',
       ],
index be768f04aeb142d819cc1f1e94a166ff6ab64a41..49e6c2c103180309ef93618255d4453c7076e185 100644 (file)
@@ -17,9 +17,7 @@
         'bench.gypi'
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
-        'images.gyp:images',
+        'skia_lib.gyp:skia_lib',
         'bench_timer',
       ],
       'conditions': [
@@ -50,7 +48,7 @@
         '../src/gpu',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
+        'skia_lib.gyp:skia_lib',
       ],
       'conditions': [
         [ 'skia_os not in ["mac", "ios"]', {
index d3e1498efcb11233f0ef3b9ed2cf6f358d30bc8b..2be8bb8142500c71cd10f51b86b2fa663ea3c202 100644 (file)
         }],
       ],
     },
+    # 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',
     ],
index fda122212c74689b6dbde46407e5bbb723503b53..64e7c13594d1e40586b90bc6bec365239bf2bbc3 100644 (file)
           [ 'skia_profile_enabled == 1', {
             'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
           }],
+          [ 'skia_shared_lib', {
+            'cflags': [
+              '-fPIC',
+            ],
+            'defines': [
+              'GR_DLL=1',
+              'GR_IMPLEMENTATION=1',
+              'SKIA_DLL',
+              'SKIA_IMPLEMENTATION=1',
+            ],
+          }],
           [ 'skia_arch_type == "arm" and arm_thumb == 1', {
             'cflags': [
               '-mthumb',
index 4f9f5422c4fba2e010d8f1162f9901b8029f6a3f..ac937bd5c5b3ecdd1bbce12c31e72a2f426ba86b 100644 (file)
@@ -90,6 +90,7 @@
       'skia_osx_sdkroot%': '',
       'skia_profile_enabled%': 0,
       'skia_win_debuggers_path%': '',
+      'skia_shared_lib%': 0,
     },
 
     'conditions': [
     'skia_gpu%': '<(skia_gpu)',
     'skia_osx_sdkroot%': '<(skia_osx_sdkroot)',
     'skia_profile_enabled%': '<(skia_profile_enabled)',
+    'skia_shared_lib%': '<(skia_shared_lib)',
     'skia_static_initializers%': '<(skia_static_initializers)',
     'ios_sdk_version%': '6.0',
     'skia_win_debuggers_path%': '<(skia_win_debuggers_path)',
index 9e0792b7734be1dfced1715b21bf3fe93838eef6..d018cbea234d35a88cc615cebbf28f64b592ff91 100644 (file)
             'config/win',
           ],
         }],
+        [ 'skia_os == "android"', {
+          'sources': [
+            '../src/core/SkPaintOptionsAndroid.cpp',
+          ],
+        }],
         [ 'skia_os == "android" and skia_arch_type == "arm" and armv7 == 1', {
           # The code in SkUtilsArm.cpp can be used on an ARM-based Linux system, not only Android.
           'sources': [
           }],
         ],
       },
-      'dependencies': [
-        'opts.gyp:opts'
-      ],
     },
   ],
 }
index b935fb056d88ce5f73ee7237ef2251ce1c7e1bad..9ea300d9b25ef4c229facbdf70b937c8c5d3be6d 100644 (file)
         '../debugger/SkObjectParser.cpp',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'images.gyp:images',
-        'effects.gyp:effects',
+        'skia_lib.gyp:skia_lib',
         'bench.gyp:bench_timer',
         'tools.gyp:picture_renderer',
       ],
       'conditions': [
         [ 'skia_os == "nacl"', {
-          'dependencies': [
-            'utils.gyp:utils', # For SkBase64.h
-          ],
           'include_dirs': [
             '../src/utils',
           ],
index e110c9f0697cdbcdc9e717479c0d26fe7367c9f0..91458eb96f8e514bef697b826668b4bba87d2c9d 100644 (file)
@@ -9,7 +9,10 @@
         'effects.gypi',
       ],
       'include_dirs': [
+        '../include/config',
+        '../include/core',
         '../include/effects',
+        '../include/utils',
         '../src/core',
       ],
       'direct_dependent_settings': {
           '../include/effects',
         ],
       },
-      'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-      ],
       'sources': [
         'effects.gypi', # Makes the gypi appear in IDEs (but does not modify the build).
       ],
       'conditions': [
         ['skia_gpu == 1', {
           'include_dirs': [
+            '../include/gpu',
             '../src/gpu',
           ],
         }],
index aa83ea9e0160c6bc533f46ad2424dc02825342bd..e80b0a32b95327c0ee6eafb82f7655c02f381821 100644 (file)
@@ -10,8 +10,7 @@
         '../tools/flags/SkCommandLineFlags.cpp',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'core.gyp:core',
+        'skia_lib.gyp:skia_lib',
       ],
       'direct_dependent_settings': {
         'include_dirs': [
index fa413c37dc442811b3de3e8c7a6ced9764d33e5f..a8b15339d6df3d984f872f4abce0a6586ef587f6 100644 (file)
@@ -16,7 +16,7 @@
         '../gm/gm_expectations.cpp',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
+        'skia_lib.gyp:skia_lib',
         'core.gyp:core',
         'images.gyp:images',
         'jsoncpp.gyp:jsoncpp',
         '../src/pipe/utils/SamplePipeControllers.cpp',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
+        'skia_lib.gyp:skia_lib',
         'flags.gyp:flags',
         'gm.gyp:gm_expectations',
-        'images.gyp:images',
         'jsoncpp.gyp:jsoncpp',
         'pdf.gyp:pdf',
-        'utils.gyp:utils',
       ],
       'conditions': [
         ['skia_os == "mac"', {
index d32987f04923c89d4bbc44266f863c891a6652bc..1ad25efe39a0ae2ebc38a2ef9946f049da10cc1d 100644 (file)
@@ -10,7 +10,7 @@
       'type': 'none',
       'dependencies': [
         # The minimal set of static libraries for basic Skia functionality.
-        'skia_base_libs.gyp:skia_base_libs',
+        'skia_lib.gyp:skia_lib',
 
         'bench.gyp:bench',
         'gm.gyp:gm',
index 484570be17fae967073bc7716018ecd52a290ddd..3dd4c8ee35dd8792aa125576018566c7a08c7489 100644 (file)
@@ -5,7 +5,7 @@
       'target_name': 'nacl_interface',
       'type': 'static_library',
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
+        'skia_lib.gyp:skia_lib',
       ],
       'include_dirs': [
         # For SkThreadUtils.h
index a3ae936d927b4b5f1a525295d81c9be720eee741..c7c32ef2c9ee2bf54090d40dace2a052258db638 100644 (file)
         '../tests/Test.h',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
+        'skia_lib.gyp:skia_lib',
         'flags.gyp:flags',
-        'images.gyp:images',
-        'utils.gyp:utils',
       ],
       'conditions': [
         [ 'skia_gpu == 1', {
index 0e759142ca6ab50485670fec740174db3885674d..31b48dbe284351d383877d8462749f9e54e54e06 100644 (file)
@@ -6,7 +6,7 @@
       'type': 'static_library',
       'standalone_static_library': 1,
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
+        'skia_lib.gyp:skia_lib',
         'zlib.gyp:zlib',
       ],
       'include_dirs': [
index 64c5a9c568e03e745ede2eb87d25d2ca722ca61d..a571dd79ef17b42a20c93a554c9a8ef2bcd37e72 100644 (file)
         '../../../pixman/pixman/pixman.h',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
+        'skia_lib.gyp:skia_lib',
         'experimental.gyp:experimental',
-        'images.gyp:images',
         'pdf.gyp:pdf',
         'views.gyp:views',
         'xml.gyp:xml',
index fc9bb9ba4c5b74a471957b6a139167fb35ce0b5e..3422b8e30afe70939ad7cb08794ce4ed6a3692c3 100644 (file)
@@ -6,18 +6,17 @@
       'product_name': 'skia_ports',
       'type': 'static_library',
       'standalone_static_library': 1,
-      'dependencies': [
-        'core.gyp:core',
-        'sfnt.gyp:sfnt',
-        'utils.gyp:utils',
-      ],
       'include_dirs': [
+        '../include/config',
+        '../include/core',
         '../include/effects',
         '../include/images',
         '../include/ports',
+        '../include/utils',
         '../include/xml',
         '../src/core',
         '../src/lazy',
+        '../src/sfnt',
         '../src/utils',
       ],
       'sources': [
index 438f33e8e6d3f1c734737d5f9a96dc15a4bf7ba9..cc21b222bcb038c90921d137cda311dcb4d204fd 100644 (file)
@@ -5,10 +5,9 @@
       'product_name': 'skia_sfnt',
       'type': 'static_library',
       'standalone_static_library': 1,
-      'dependencies': [
-        'core.gyp:core',
-      ],
       'include_dirs': [
+        '../include/config',
+        '../include/core',
         '../src/sfnt',
       ],
       'sources': [
index 4537c01b7396ec84b64bae4076d27a08b6b52618..83836ee730cdf214e20aa641941c95da376e27ad 100644 (file)
@@ -69,9 +69,7 @@
         '../experimental/Intersection/TriangleUtilities.h',
      ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
-        'images.gyp:images',
+        'skia_lib.gyp:skia_lib',
         'views.gyp:views',
         'xml.gyp:xml',
       ],
index 8c67cf7991c0ad6d8c8420c50a18525cdbea8d56..e4e7d72dff55283fe379d955766f7df28336dddb 100644 (file)
         '../experimental/Intersection/thingsToDo.txt',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
-        'images.gyp:images',
+        'skia_lib.gyp:skia_lib',
       ],
       'conditions': [
         [ 'skia_gpu == 1', {
index 3b1408a5ffba622ec28eec7ece5af1fb4dd4c8f9..35caccb5ae3d9f2d810e44d4d0923c9546dc5e92 100644 (file)
         '../experimental/Intersection/AddTestOutput/main.cpp',
       ],
       'dependencies': [
-        'core.gyp:core',
-        'effects.gyp:effects',
+        'skia_lib.gyp:skia_lib',
         'experimental.gyp:experimental',
-        'images.gyp:images',
-        'ports.gyp:ports',
         'pdf.gyp:pdf',
-        'utils.gyp:utils',
       ],
       'conditions': [
         [ 'skia_gpu == 1', {
           'include_dirs': [
             '../src/gpu',
           ],
-          'dependencies': [
-            'gpu.gyp:gr',
-            'gpu.gyp:skgr',
-          ],
         }],
       ],
     },
diff --git a/gyp/skia_base_libs.gyp b/gyp/skia_base_libs.gyp
deleted file mode 100644 (file)
index 83cc7c7..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-# The minimal set of static libraries for basic Skia functionality.
-{
-  'variables': {
-    'component_libs': [
-      'core.gyp:core',
-      'opts.gyp:opts',
-      'ports.gyp:ports',
-      'utils.gyp:utils',
-    ],
-    'conditions': [
-      [ 'skia_arch_type == "x86" and skia_os != "android"', {
-        'component_libs': [
-          'opts.gyp:opts_ssse3',
-        ],
-      }],
-      [ 'arm_neon == 1', {
-        'component_libs': [
-          'opts.gyp:opts_neon',
-        ],
-      }],
-      [ 'skia_gpu', {
-        'component_libs': [
-          'gpu.gyp:gr',
-          'gpu.gyp:skgr',
-        ],
-      }],
-      [ 'skia_os == "nacl"', {
-        'component_libs': [
-          'freetype.gyp:freetype',
-        ],
-      }],
-    ],
-  },
-  'targets': [
-    {
-      'target_name': 'skia_base_libs',
-      'type': 'none',
-      'dependencies': [
-        '<@(component_libs)',
-      ],
-      'export_dependent_settings': [
-        '<@(component_libs)',
-      ],
-    },
-  ],
-}
-
-# Local Variables:
-# tab-width:2
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/gyp/skia_lib.gyp b/gyp/skia_lib.gyp
new file mode 100644 (file)
index 0000000..f85c5ad
--- /dev/null
@@ -0,0 +1,72 @@
+# The minimal set of static libraries for basic Skia functionality.
+
+{
+  'variables': {
+    'component_libs': [
+      'core.gyp:core',
+      'effects.gyp:effects',
+      'images.gyp:images',
+      'opts.gyp:opts',
+      'ports.gyp:ports',
+      'sfnt.gyp:sfnt',
+      'utils.gyp:utils',
+    ],
+    'conditions': [
+      [ 'skia_arch_type == "x86" and skia_os != "android"', {
+        'component_libs': [
+          'opts.gyp:opts_ssse3',
+        ],
+      }],
+      [ 'arm_neon == 1', {
+        'component_libs': [
+          'opts.gyp:opts_neon',
+        ],
+      }],
+      [ 'skia_gpu', {
+        'component_libs': [
+          'gpu.gyp:gr',
+          'gpu.gyp:skgr',
+        ],
+      }],
+      [ 'skia_os == "nacl"', {
+        'component_libs': [
+          'freetype.gyp:freetype',
+        ],
+      }],
+    ],
+  },
+  'targets': [
+    {
+      'target_name': 'skia_lib',
+      'conditions': [
+        [ 'skia_shared_lib', {
+          'conditions': [
+            [ 'skia_os == "android"', {
+              # The name skia will confuse the linker on android into using the system's libskia.so
+              # instead of the one packaged with the apk. We simply choose a different name to fix
+              # this.
+              'product_name': 'skia_android',
+            }, {
+              'product_name': 'skia',
+            }],
+          ],
+          'type': 'shared_library',
+        }, {
+          'type': 'none',
+        }],
+      ],
+      'dependencies': [
+        '<@(component_libs)',
+      ],
+      'export_dependent_settings': [
+        '<@(component_libs)',
+      ],
+    },
+  ],
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
index 10a4ba45e7dfb7fdd820d6c9d1c6ad0272b5ee83..557fea5a2897b3e0633225217bc759a9dd824536 100644 (file)
         '../src/pipe/utils/SamplePipeControllers.cpp',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
+        'skia_lib.gyp:skia_lib',
         'flags.gyp:flags',
         'experimental.gyp:experimental',
-        'images.gyp:images',
         'pdf.gyp:pdf',
         'tools.gyp:picture_utils',
-        'utils.gyp:utils',
-        'sfnt.gyp:sfnt',
       ],
       'conditions': [
         [ 'skia_gpu == 1', {
index ede028a0d7ff7ae7273272c80aaae7307a44061b..25aa1dbf066f91355e1e0ab759f3d1cdacf47a28 100644 (file)
@@ -37,9 +37,7 @@
         '../tools/skdiff_utils.h',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
-        'images.gyp:images',
+        'skia_lib.gyp:skia_lib',
       ],
     },
     {
@@ -55,9 +53,7 @@
         '../tools/skdiff_utils.h',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
-        'images.gyp:images',
+        'skia_lib.gyp:skia_lib',
       ],
     },
     {
         '../tools/skhello.cpp',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
+        'skia_lib.gyp:skia_lib',
         'flags.gyp:flags',
-        'images.gyp:images',
       ],
     },
     {
         '../src/utils/',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
+        'skia_lib.gyp:skia_lib',
         'flags.gyp:flags',
         'gm.gyp:gm_expectations',
-        'images.gyp:images',
         'jsoncpp.gyp:jsoncpp',
         'utils.gyp:utils',
       ],
         '../src/utils/SkLua.cpp',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
+        'skia_lib.gyp:skia_lib',
         'effects.gyp:effects',
         'utils.gyp:utils',
         'images.gyp:images',
         '../src/pipe/utils/',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
+        'skia_lib.gyp:skia_lib',
         'tools.gyp:picture_renderer',
         'tools.gyp:picture_utils',
-        'ports.gyp:ports',
         'flags.gyp:flags',
       ],
     },
         '../src/lazy/',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
+        'skia_lib.gyp:skia_lib',
         'tools.gyp:picture_utils',
         'tools.gyp:picture_renderer',
         'bench.gyp:bench_timer',
-        'ports.gyp:ports',
         'flags.gyp:flags',
       ],
     },
         '../src/utils/',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
-        'images.gyp:images',
+        'skia_lib.gyp:skia_lib',
         'tools.gyp:picture_utils',
         'flags.gyp:flags',
       ],
           },
         ],
       ],
-      'export_dependent_settings': [
-        'images.gyp:images',
-      ],
     },
     {
       'target_name': 'render_pdfs',
         '../src/utils/',
       ],
       'dependencies': [
-        'core.gyp:core',
-        'effects.gyp:effects',
-        'images.gyp:images',
+        'skia_lib.gyp:skia_lib',
         'pdf.gyp:pdf',
-        'ports.gyp:ports',
         'tools.gyp:picture_utils',
       ],
       'conditions': [
         '../tools/picture_utils.h',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
+        'skia_lib.gyp:skia_lib',
       ],
       'direct_dependent_settings': {
         'include_dirs': [
         '../tools/pinspect.cpp',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
-        'images.gyp:images',
+        'skia_lib.gyp:skia_lib',
       ],
     },
     {
         '../debugger/SkObjectParser.cpp',
       ],
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'effects.gyp:effects',
-        'images.gyp:images',
+        'skia_lib.gyp:skia_lib',
         'tools.gyp:picture_utils',
       ],
     },
index 376874205c9a44400b814439bcfa9e427c286c60..29d5e075a9ab8794b3831f34315ba1b0800d14f3 100644 (file)
@@ -6,8 +6,7 @@
       'type': 'static_library',
       'standalone_static_library': 1,
       'dependencies': [
-        'skia_base_libs.gyp:skia_base_libs',
-        'images.gyp:images',
+        'skia_lib.gyp:skia_lib',
         'sfnt.gyp:sfnt',
       ],
       'include_dirs': [
index e2707f796424460bfdd92b31a0d26449ba50d764..68d336e70ee0076ee1fea8a64e89b1f014b9a1db 100644 (file)
@@ -16,7 +16,7 @@ public class SkiaIntentService extends IntentService {
   public SkiaIntentService() {
       super("SkiaIntentService");
   }
-  
+
   @Override
   public IBinder onBind(Intent arg0) {
       return null;
@@ -25,12 +25,12 @@ public class SkiaIntentService extends IntentService {
   public void onCreate() {
       super.onCreate();
   }
-  
+
   @Override
   public void onDestroy() {
       super.onDestroy();
   }
-  
+
   @Override
   public void onHandleIntent(Intent intent) {
 
@@ -51,10 +51,11 @@ public class SkiaIntentService extends IntentService {
       String cmd = bundle.getString("args").trim();
       String[] args = cmd.split("\\s+");
       Log.d("skia", "Executing Command: " + cmd);
-          
+
       // Load the requested library
       String lib = args[0];
       try {
+          System.loadLibrary("skia_android");
           System.loadLibrary(lib);
       } catch (UnsatisfiedLinkError e) {
           Log.e("skia", "Library " + lib +
@@ -62,7 +63,7 @@ public class SkiaIntentService extends IntentService {
           SkiaReturn(-1, returnRepeats);
           throw e;
       }
-      
+
       // JNI call to run the program
       int retval = run(args);
       SkiaReturn(retval, returnRepeats);
index 4b5e7d6b7fcda18fb034be650d9e187b87c64489..62f81a58f5808086a28d6f2446f6cae8c29a4bfe 100644 (file)
@@ -42,6 +42,7 @@ public class SkiaSampleActivity extends Activity
         mSlideList = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1);
 
         try {
+            System.loadLibrary("skia_android");
             System.loadLibrary("SampleApp");
 
             LinearLayout holder = (LinearLayout) findViewById(R.id.holder);
index b955bea1cdad6157b82d98012387a57d529aee2c..e5cea6e863850b5bb1a01a7cb943fd6bad7fc043 100755 (executable)
@@ -126,6 +126,7 @@ setup_device() {
   DEFINES="${DEFINES} skia_os=android"
   DEFINES="${DEFINES} android_base=${SCRIPT_DIR}/.."
   DEFINES="${DEFINES} android_toolchain=${TOOLCHAIN_TYPE}"
+  DEFINES="${DEFINES} skia_shared_lib=1"
 
   # Setup the build variation depending on the target device
   TARGET_DEVICE="$1"
index 43c59c1d436298d9f912bbd943e92080ecb8262b..72dc942ab9472800ea26478a5f01a1f9c14b3f16 100644 (file)
@@ -4,6 +4,7 @@
       'target_name': 'CopySkiaAppDeps',
       'type': 'none',
       'dependencies': [
+        'skia_lib.gyp:skia_lib',
         'SampleApp.gyp:SampleApp',
         'bench.gyp:bench',
         'gm.gyp:gm',
@@ -56,6 +57,7 @@
             '<(PRODUCT_DIR)/lib.target/libtests.so',
             '<(PRODUCT_DIR)/lib.target/libpathops_unittest.so',
             '<(PRODUCT_DIR)/lib.target/gdbserver',
+            '<(PRODUCT_DIR)/lib.target/libskia_android.so',
           ],
         },
       ],
index 972382dc16f325188ce3717e4e44e794056ffb1e..231289d4e921d57c2ae18a44df0d491d5f4f39d4 100644 (file)
@@ -28,6 +28,29 @@ int launch_app(int (*app_main)(int, const char**), int argc,
     return (*app_main)(argc, argv);
 }
 
+void* load_library(const char** argv, const char* libraryName)
+{
+     // attempt to lookup the location of the shared libraries
+    char libraryLocation[100];
+    sprintf(libraryLocation, "%s/lib/lib%s.so", argv[0], libraryName);
+    if (!file_exists(libraryLocation)) {
+        printf("ERROR: Unable to find the appropriate library in the Skia App.\n");
+        printf("ERROR: Did you provide the correct program_name?\n");
+        usage(argv[0]);
+        return NULL;
+    }
+
+    // load the appropriate library
+    void* appLibrary = dlopen(libraryLocation, RTLD_LOCAL | RTLD_LAZY);
+    if (!appLibrary) {
+        printf("ERROR: Unable to open the shared library.\n");
+        printf("ERROR: %s", dlerror());
+        return NULL;
+    }
+
+    return appLibrary;
+}
+
 int main(int argc, const char** argv) {
 
     // check that the program name was specified
@@ -44,21 +67,16 @@ int main(int argc, const char** argv) {
         return -1;
     }
 
-    // attempt to lookup the location of the shared libraries
-    char libraryLocation[100];
-    sprintf(libraryLocation, "%s/lib/lib%s.so", appLocation, argv[1]);
-    if (!file_exists(libraryLocation)) {
-        printf("ERROR: Unable to find the appropriate library in the Skia App.\n");
-        printf("ERROR: Did you provide the correct program_name?\n");
-        usage(argv[0]);
+    // load the local skia shared library
+    void* skiaLibrary = load_library(argv, "libskia_android.so");
+    if (NULL == skiaLibrary)
+    {
         return -1;
     }
 
     // load the appropriate library
-    void* appLibrary = dlopen(libraryLocation, RTLD_LOCAL | RTLD_LAZY);
-    if (!appLibrary) {
-        printf("ERROR: Unable to open the shared library.\n");
-        printf("ERROR: %s", dlerror());
+    void* appLibrary = load_library(argv, argv[1]);
+    if (NULL == appLibrary) {
         return -1;
     }