diff options
author | Mike Morris <michael.patrick.morris@gmail.com> | 2015-12-04 13:29:51 -0500 |
---|---|---|
committer | Mike Morris <michael.patrick.morris@gmail.com> | 2015-12-07 15:48:34 -0800 |
commit | d467ae6e7867044b8d7b466776fb37089292c52b (patch) | |
tree | 730ee0656e6bf9f0dff33346f07acd800e83ab25 /deps/gyp/test/toolsets | |
parent | 59ef8da69549cf6308078c6f656affba96e9439e (diff) | |
download | qtlocation-mapboxgl-d467ae6e7867044b8d7b466776fb37089292c52b.tar.gz |
[core] upgrade gyp to git commit 6fb8bd8
https://chromium.googlesource.com/external/gyp/+/6fb8bd829f0ca8fd432fd85ede788b6881c4f09f
Diffstat (limited to 'deps/gyp/test/toolsets')
-rwxr-xr-x | deps/gyp/test/toolsets/gyptest-toolsets.py | 31 | ||||
-rw-r--r-- | deps/gyp/test/toolsets/main.cc | 13 | ||||
-rw-r--r-- | deps/gyp/test/toolsets/toolsets.cc | 11 | ||||
-rw-r--r-- | deps/gyp/test/toolsets/toolsets.gyp | 62 | ||||
-rw-r--r-- | deps/gyp/test/toolsets/toolsets_shared.cc | 11 |
5 files changed, 128 insertions, 0 deletions
diff --git a/deps/gyp/test/toolsets/gyptest-toolsets.py b/deps/gyp/test/toolsets/gyptest-toolsets.py new file mode 100755 index 0000000000..f80fce70a2 --- /dev/null +++ b/deps/gyp/test/toolsets/gyptest-toolsets.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that toolsets are correctly applied +""" +import os +import sys +import TestGyp + +if sys.platform.startswith('linux'): + + test = TestGyp.TestGyp(formats=['make', 'ninja']) + + oldenv = os.environ.copy() + try: + os.environ['GYP_CROSSCOMPILE'] = '1' + test.run_gyp('toolsets.gyp') + finally: + os.environ.clear() + os.environ.update(oldenv) + + test.build('toolsets.gyp', test.ALL) + + test.run_built_executable('host-main', stdout="Host\nShared: Host\n") + test.run_built_executable('target-main', stdout="Target\nShared: Target\n") + + test.pass_test() diff --git a/deps/gyp/test/toolsets/main.cc b/deps/gyp/test/toolsets/main.cc new file mode 100644 index 0000000000..bc47da9978 --- /dev/null +++ b/deps/gyp/test/toolsets/main.cc @@ -0,0 +1,13 @@ +/* Copyright (c) 2009 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include <stdio.h> + +const char *GetToolset(); +const char *GetToolsetShared(); + +int main(void) { + printf("%s\n", GetToolset()); + printf("Shared: %s\n", GetToolsetShared()); +} diff --git a/deps/gyp/test/toolsets/toolsets.cc b/deps/gyp/test/toolsets/toolsets.cc new file mode 100644 index 0000000000..a45fa029cb --- /dev/null +++ b/deps/gyp/test/toolsets/toolsets.cc @@ -0,0 +1,11 @@ +/* Copyright (c) 2009 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +const char *GetToolset() { +#ifdef TARGET + return "Target"; +#else + return "Host"; +#endif +} diff --git a/deps/gyp/test/toolsets/toolsets.gyp b/deps/gyp/test/toolsets/toolsets.gyp new file mode 100644 index 0000000000..3bc3a784ea --- /dev/null +++ b/deps/gyp/test/toolsets/toolsets.gyp @@ -0,0 +1,62 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'target_conditions': [ + ['_toolset=="target"', {'defines': ['TARGET']}] + ] + }, + 'targets': [ + { + 'target_name': 'toolsets', + 'type': 'static_library', + 'toolsets': ['target', 'host'], + 'sources': [ + 'toolsets.cc', + ], + }, + { + 'target_name': 'host-main', + 'type': 'executable', + 'toolsets': ['host'], + 'dependencies': ['toolsets', 'toolsets_shared'], + 'sources': [ + 'main.cc', + ], + }, + { + 'target_name': 'target-main', + 'type': 'executable', + 'dependencies': ['toolsets', 'toolsets_shared'], + 'sources': [ + 'main.cc', + ], + }, + # This tests that build systems can handle a shared library being build for + # both host and target. + { + 'target_name': 'janus', + 'type': 'shared_library', + 'toolsets': ['target', 'host'], + 'sources': [ + 'toolsets.cc', + ], + 'cflags': [ '-fPIC' ], + }, + { + 'target_name': 'toolsets_shared', + 'type': 'shared_library', + 'toolsets': ['target', 'host'], + 'target_conditions': [ + # Ensure target and host have different shared_library names + ['_toolset=="host"', {'product_extension': 'host'}], + ], + 'sources': [ + 'toolsets_shared.cc', + ], + 'cflags': [ '-fPIC' ], + }, + ], +} diff --git a/deps/gyp/test/toolsets/toolsets_shared.cc b/deps/gyp/test/toolsets/toolsets_shared.cc new file mode 100644 index 0000000000..794af2c0bd --- /dev/null +++ b/deps/gyp/test/toolsets/toolsets_shared.cc @@ -0,0 +1,11 @@ +/* Copyright (c) 2013 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +const char *GetToolsetShared() { +#ifdef TARGET + return "Target"; +#else + return "Host"; +#endif +} |