diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2016-06-29 11:38:18 +0200 |
---|---|---|
committer | Ivo van Dongen <info@ivovandongen.nl> | 2016-07-07 10:08:43 +0200 |
commit | 5e2847396cff58edb9fa68282b9d7f99720023ee (patch) | |
tree | c5c3dee859dbb020eca04bb93c4febdac8889284 | |
parent | 733c65b72d0b583e807ec81f44f14e5b45f9d82e (diff) | |
download | qtlocation-mapboxgl-5e2847396cff58edb9fa68282b9d7f99720023ee.tar.gz |
[android] #5456 - Fixed up test.gypi so that linker and dependent settings are conditional to the target platform.
-rw-r--r-- | platform/android/platform.gyp | 1 | ||||
-rw-r--r-- | test/test.gypi | 38 |
2 files changed, 36 insertions, 3 deletions
diff --git a/platform/android/platform.gyp b/platform/android/platform.gyp index 5d0083fde6..6aa94b95b2 100644 --- a/platform/android/platform.gyp +++ b/platform/android/platform.gyp @@ -1,5 +1,6 @@ { 'variables': { + 'target_platform': 'android', 'loop_lib': 'android', 'headless_lib': 'none', 'coverage': 0, diff --git a/test/test.gypi b/test/test.gypi index df0ad448aa..6a1daa8e1a 100644 --- a/test/test.gypi +++ b/test/test.gypi @@ -42,11 +42,11 @@ '<@(geojsonvt_cflags)', '<@(rapidjson_cflags)', '<@(pixelmatch_cflags)', - '<@(earcut_cflags)' + '<@(earcut_cflags)', ], 'ldflags': [ - '-landroid', - '<@(sqlite_ldflags)', + '<@(gtest_ldflags)', + '<@(sqlite_ldflags)', ], 'libraries': [ '<@(gtest_static_libs)', @@ -71,6 +71,11 @@ 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] } }, { 'libraries': [ '<@(libraries)', '<@(ldflags)' ], + }], + + #Android doesn't support -pthread + ['target_platform == "android"', { + 'libraries!': ['<@(gtest_ldflags)'] }] ], }, @@ -79,7 +84,34 @@ 'include_dirs': [ 'include', ], + + # Force the linker to include all the objects from the lib-test archive. Otherwise they'd + # be discarded because there are no undefined symbols to pull them in, and the resulting + # executable would run zero tests. + # + # Don't do this for android as linking this in a shared library leads to linker + # errors: "previous definition here" + + 'conditions': [ + ['OS == "mac"', { + 'xcode_settings': { + 'OTHER_LDFLAGS': [ + '-Wl,-force_load,<(PRODUCT_DIR)/libtest-lib.a', + ], + } + }, { + 'conditions': [ + ['target_platform != "android"', { + 'link_settings': { + 'ldflags': [ + '-Wl,-whole-archive <(PRODUCT_DIR)/libtest-lib.a -Wl,-no-whole-archive', + ], + }, + }] + ], + }], + ] }, }, ] |