Skip to content

Commit 93bfd72

Browse files
Simple failing C++/CX example
1 parent d2183b3 commit 93bfd72

File tree

9 files changed

+39
-0
lines changed

9 files changed

+39
-0
lines changed

.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build --verbose_failures

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.1.0

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
bazel-*
2+
*.sublime-project
3+
*.sublime-workspace

BUILD

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
cc_library(
2+
name = "cppcx_example",
3+
srcs = ["Example.cpp",],
4+
copts = [
5+
"/std:c++17",
6+
"/ZW",
7+
# "/AI \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Tools\\MSVC\\14.25.28610\\lib\\x86\\store\\references\"",
8+
# "/AI \"C:\\Program Files (x86)\\Windows Kits\\10\\unionmetadata\\10.0.18362.0\"",
9+
],
10+
)

Example.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <memory>
2+
3+
namespace cppcx_example {
4+
5+
public ref class Foo sealed {
6+
public:
7+
Foo() { }
8+
property Platform::IBox<double>^ Bar;
9+
};
10+
11+
}

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Example of failing Bazel build with C++/CX enabled.
2+
3+
Run `build_simple.cmd` to see first error, which suggests setting
4+
`LIBPATH` to help find the .winmd files needed or using \AI flags.
5+
6+
Run `build_vcvarsall_libpath.cmd` to see error after getting `LIBPATH` set
7+
appropriately by calling `vcvarsall.bat` and passing
8+
`action_env=LIBPATH`. May need to tweek this script
9+
to match the location of `vcvarsall.bat` on your system.

WORKSPACE

Whitespace-only changes.

build_simple.cmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bazel build :cppcx_example

build_vcvarsall_libpath.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Auxiliary\\Build\\vcvarsall.bat" x64 uwp
2+
3+
bazel build :cppcx_example --action_env=LIBPATH

0 commit comments

Comments
 (0)