diff options
Diffstat (limited to 'third_party/python/gyp/test/win/precompiled')
5 files changed, 84 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/win/precompiled/gyptest-all.py b/third_party/python/gyp/test/win/precompiled/gyptest-all.py new file mode 100644 index 0000000000..9fb5e62edf --- /dev/null +++ b/third_party/python/gyp/test/win/precompiled/gyptest-all.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 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 precompiled headers can be specified. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja'], workdir='workarea_all') + test.run_gyp('hello.gyp') + test.build('hello.gyp', 'hello') + test.run_built_executable('hello', stdout="Hello, world!\nHello, two!\n") + test.up_to_date('hello.gyp', test.ALL) + test.pass_test() diff --git a/third_party/python/gyp/test/win/precompiled/hello.c b/third_party/python/gyp/test/win/precompiled/hello.c new file mode 100644 index 0000000000..ffb47bf822 --- /dev/null +++ b/third_party/python/gyp/test/win/precompiled/hello.c @@ -0,0 +1,14 @@ +/* Copyright (c) 2011 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. */ + +// Note the abscence of a stdio.h include. This will be inserted because of the +// precompiled header. + +extern int hello2(); + +int main(void) { + printf("Hello, world!\n"); + hello2(); + return 0; +} diff --git a/third_party/python/gyp/test/win/precompiled/hello.gyp b/third_party/python/gyp/test/win/precompiled/hello.gyp new file mode 100644 index 0000000000..5f82c53593 --- /dev/null +++ b/third_party/python/gyp/test/win/precompiled/hello.gyp @@ -0,0 +1,28 @@ +# Copyright (c) 2012 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': [ + { + 'target_name': 'hello', + 'type': 'executable', + 'sources': [ + 'hello.c', + 'hello2.c', + 'precomp.c', + ], + 'msvs_precompiled_header': 'stdio.h', + 'msvs_precompiled_source': 'precomp.c', + + # Required so that the printf actually causes a build failure + # if the pch isn't included. + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '3', + 'WarnAsError': 'true', + }, + }, + }, + ], +} diff --git a/third_party/python/gyp/test/win/precompiled/hello2.c b/third_party/python/gyp/test/win/precompiled/hello2.c new file mode 100644 index 0000000000..d6d53111fb --- /dev/null +++ b/third_party/python/gyp/test/win/precompiled/hello2.c @@ -0,0 +1,13 @@ +/* Copyright (c) 2011 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. */ + +// Unlike hello.c, this file specifies the headers. + +#include <windows.h> +#include <stdio.h> + +int hello2() { + printf("Hello, two!\n"); + return 0; +} diff --git a/third_party/python/gyp/test/win/precompiled/precomp.c b/third_party/python/gyp/test/win/precompiled/precomp.c new file mode 100644 index 0000000000..517c61a36b --- /dev/null +++ b/third_party/python/gyp/test/win/precompiled/precomp.c @@ -0,0 +1,8 @@ +/* Copyright (c) 2011 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. */ + +// The precompiled header does not have to be the first one in the file. + +#include <windows.h> +#include <stdio.h> |