summaryrefslogtreecommitdiffstats
path: root/third_party/python/gyp/test/library_dirs/subdir
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/python/gyp/test/library_dirs/subdir')
-rw-r--r--third_party/python/gyp/test/library_dirs/subdir/README.txt1
-rw-r--r--third_party/python/gyp/test/library_dirs/subdir/hello.cc11
-rw-r--r--third_party/python/gyp/test/library_dirs/subdir/mylib.cc9
-rw-r--r--third_party/python/gyp/test/library_dirs/subdir/mylib.h12
-rw-r--r--third_party/python/gyp/test/library_dirs/subdir/test-win.gyp60
-rw-r--r--third_party/python/gyp/test/library_dirs/subdir/test.gyp68
6 files changed, 161 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/library_dirs/subdir/README.txt b/third_party/python/gyp/test/library_dirs/subdir/README.txt
new file mode 100644
index 0000000000..4031ded85f
--- /dev/null
+++ b/third_party/python/gyp/test/library_dirs/subdir/README.txt
@@ -0,0 +1 @@
+Make things live in a subdirectory, to make sure that DEPTH works correctly.
diff --git a/third_party/python/gyp/test/library_dirs/subdir/hello.cc b/third_party/python/gyp/test/library_dirs/subdir/hello.cc
new file mode 100644
index 0000000000..5dbbd48d34
--- /dev/null
+++ b/third_party/python/gyp/test/library_dirs/subdir/hello.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.
+
+#include <iostream>
+#include "mylib.h"
+
+int main() {
+ std::cout << "Hello " << my_foo(99) << std::endl;
+ return 0;
+}
diff --git a/third_party/python/gyp/test/library_dirs/subdir/mylib.cc b/third_party/python/gyp/test/library_dirs/subdir/mylib.cc
new file mode 100644
index 0000000000..654f3d0e6c
--- /dev/null
+++ b/third_party/python/gyp/test/library_dirs/subdir/mylib.cc
@@ -0,0 +1,9 @@
+// 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.
+
+#include "mylib.h"
+
+std::string my_foo(int x) {
+ return std::string("world");
+}
diff --git a/third_party/python/gyp/test/library_dirs/subdir/mylib.h b/third_party/python/gyp/test/library_dirs/subdir/mylib.h
new file mode 100644
index 0000000000..84b4022e7b
--- /dev/null
+++ b/third_party/python/gyp/test/library_dirs/subdir/mylib.h
@@ -0,0 +1,12 @@
+// 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.
+
+#ifndef TEST_LIBRARY_DIRS_SUBDIR_MYLIB_H
+#define TEST_LIBRARY_DIRS_SUBDIR_MYLIB_H
+
+#include <string>
+
+std::string my_foo(int);
+
+#endif // TEST_LIBRARY_DIRS_SUBDIR_MYLIB_H
diff --git a/third_party/python/gyp/test/library_dirs/subdir/test-win.gyp b/third_party/python/gyp/test/library_dirs/subdir/test-win.gyp
new file mode 100644
index 0000000000..033b6f7fdd
--- /dev/null
+++ b/third_party/python/gyp/test/library_dirs/subdir/test-win.gyp
@@ -0,0 +1,60 @@
+# 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.
+
+{
+ 'targets': [
+ {
+ # This creates a static library and puts it in a nonstandard location for
+ # libraries-search-path-test.
+ 'target_name': 'mylib',
+ 'type': 'static_library',
+ 'standalone_static_library': 1,
+ # This directory is NOT in the default library search locations. It also
+ # MUST be passed in on the gyp command line:
+ #
+ # -D abs_path_to_secret_library_location=/some_absolute_path
+ #
+ # The gyptest itself (../gyptest-library-dirs.py) provides this.
+ 'product_dir': '<(abs_path_to_secret_library_location)',
+ 'sources': [
+ 'mylib.cc',
+ ],
+ },
+ {
+ 'target_name': 'libraries-search-path-test-lib-suffix',
+ 'type': 'executable',
+ 'dependencies': [
+ # It is important to NOT list the mylib as a dependency here, because
+ # some build systems will track it down based on its product_dir,
+ # such that the link succeeds even without the library_dirs below.
+ #
+ # The point of this weird structuring is to ensure that 'library_dirs'
+ # works as advertised, such that just '-lmylib' (or its equivalent)
+ # works based on the directories that library_dirs puts in the library
+ # link path.
+ #
+ # If 'mylib' was listed as a proper dependency here, the build system
+ # would find it and link with its path on disk.
+ #
+ # Note that this implies 'mylib' must already be built when building
+ # 'libraries-search-path-test' (see ../gyptest-library-dirs.py).
+ #
+ #'mylib',
+ ],
+ 'sources': [
+ 'hello.cc',
+ ],
+ # Note that without this, the mylib library would not be found and
+ # successfully linked.
+ 'library_dirs': [
+ '<(abs_path_to_secret_library_location)',
+ ],
+ 'link_settings': {
+ 'libraries': [
+ '-lmylib.lib',
+ ],
+ },
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/library_dirs/subdir/test.gyp b/third_party/python/gyp/test/library_dirs/subdir/test.gyp
new file mode 100644
index 0000000000..f83d7f2bf1
--- /dev/null
+++ b/third_party/python/gyp/test/library_dirs/subdir/test.gyp
@@ -0,0 +1,68 @@
+# 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.
+
+{
+ 'targets': [
+ {
+ # This creates a static library and puts it in a nonstandard location for
+ # libraries-search-path-test.
+ 'target_name': 'mylib',
+ 'type': 'static_library',
+ 'standalone_static_library': 1,
+ # This directory is NOT in the default library search locations. It also
+ # MUST be passed in on the gyp command line:
+ #
+ # -D abs_path_to_secret_library_location=/some_absolute_path
+ #
+ # The gyptest itself (../gyptest-library-dirs.py) provides this.
+ 'product_dir': '<(abs_path_to_secret_library_location)',
+ 'sources': [
+ 'mylib.cc',
+ ],
+ },
+ {
+ 'target_name': 'libraries-search-path-test',
+ 'type': 'executable',
+ 'dependencies': [
+ # It is important to NOT list the mylib as a dependency here, because
+ # some build systems will track it down based on its product_dir,
+ # such that the link succeeds even without the library_dirs below.
+ #
+ # The point of this weird structuring is to ensure that 'library_dirs'
+ # works as advertised, such that just '-lmylib' (or its equivalent)
+ # works based on the directories that library_dirs puts in the library
+ # link path.
+ #
+ # If 'mylib' was listed as a proper dependency here, the build system
+ # would find it and link with its path on disk.
+ #
+ # Note that this implies 'mylib' must already be built when building
+ # 'libraries-search-path-test' (see ../gyptest-library-dirs.py).
+ #
+ #'mylib',
+ ],
+ 'sources': [
+ 'hello.cc',
+ ],
+ # Note that without this, the mylib library would not be found and
+ # successfully linked.
+ 'library_dirs': [
+ '<(abs_path_to_secret_library_location)',
+ ],
+ 'link_settings': {
+ 'conditions': [
+ ['OS=="linux"', {
+ 'libraries': [
+ '-lmylib',
+ ],
+ }, { # else
+ 'libraries': [
+ '<(STATIC_LIB_PREFIX)mylib<(STATIC_LIB_SUFFIX)',
+ ],
+ }],
+ ], # conditions
+ },
+ },
+ ],
+}