Skip to content

Platform: add a cplusplus requirement to XAudio #35268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2021

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Jan 5, 2021

In some cases when building the XAudio module, we would end up going
down C++ paths:

C:\Program Files (x86)\Windows Kits\10\/Include/10.0.17763.0/um/xaudio2.h:61:26: error: 'uuid' attribute is not supported in C
    interface __declspec(uuid("2B02E3CF-2E0B-4ec3-BE45-1B2A3FE7210D")) IXAudio2;
                             ^
<module-includes>:29:10: note: in file included from <module-includes>:29:
         ^

Although this works with newer SDKs, it does not work with older SDKs.
Filter out the module for the time being with a requirement on C++.
This should be possible to use with -enable-cxx-interop.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

In some cases when building the `XAudio` module, we would end up going
down C++ paths:

```
C:\Program Files (x86)\Windows Kits\10\/Include/10.0.17763.0/um/xaudio2.h:61:26: error: 'uuid' attribute is not supported in C
    interface __declspec(uuid("2B02E3CF-2E0B-4ec3-BE45-1B2A3FE7210D")) IXAudio2;
                             ^
<module-includes>:29:10: note: in file included from <module-includes>:29:
         ^
```

Although this works with newer SDKs, it does not work with older SDKs.
Filter out the module for the time being with a requirement on `C++`.
This should be possible to use with `-enable-cxx-interop`.
@compnerd
Copy link
Member Author

compnerd commented Jan 5, 2021

@swift-ci please smoke test

@compnerd
Copy link
Member Author

compnerd commented Jan 5, 2021

CC: @STREGAsGate @egorzhdan

@compnerd
Copy link
Member Author

compnerd commented Jan 6, 2021

@swift-ci please smoke test macOS platform

@STREGAsGate
Copy link

Well that's stinky. I don't mind the newer SDK requirement, but I'd like to avoid build flags until the package manager gets a safe way to define them per package. I'd like to keep projects working with just swift build and nothing else.

I'll look into XAudio1 and see what it's expected end of life might be and if it meets all the requirements for reasonably modern spacial audio, I'm sure it probably does. If the newest Xbox supports it then that's at least 5 more years of support.

@compnerd
Copy link
Member Author

compnerd commented Jan 6, 2021

Sure, but I don't think its fair to break the modules for everyone else. You can workaround it by using:

swiftSettings: [
  .unsafeFlags(["-Xfrontend", "-enable-cxx-interop"])
]

in Package.swift if you are using SPM or using target_compile_options if you are using CMake.

@compnerd
Copy link
Member Author

compnerd commented Jan 6, 2021

@swift-ci please smoke test macOS platform

@compnerd
Copy link
Member Author

compnerd commented Jan 6, 2021

@kastiglione - hey, mind taking a look at this failure? The failure is interesting, I've been seeing this elsewhere as well, where llvm::make_scope_exit has suddenly disappeared. The only change that I see here is the recent change from you.

@compnerd
Copy link
Member Author

compnerd commented Jan 6, 2021

FAILED: source/Plugins/TypeSystem/Swift/CMakeFiles/lldbPluginTypeSystemSwift.dir/TypeSystemSwiftTypeRef.cpp.o 
/usr/local/bin/sccache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -DLLDB_CONFIGURATION_RELEASE -DLLDB_ENABLE_SWIFT -DLLDB_USE_OS_LOG -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Isource/Plugins/TypeSystem/Swift -I/Users/buildnode/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/llvm-project/lldb/source/Plugins/TypeSystem/Swift -Isource -I/Users/buildnode/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/llvm-project/lldb/include -Iinclude -I/Users/buildnode/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/llvm-project/llvm/include -I/Users/buildnode/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/buildbot_incremental/llvm-macosx-x86_64/include -I/Users/buildnode/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/llvm-project/clang/include -I/Users/buildnode/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/buildbot_incremental/llvm-macosx-x86_64/tools/clang/include -I/Users/buildnode/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/buildbot_incremental/swift-macosx-x86_64/include -I/Users/buildnode/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/swift/include -I/Users/buildnode/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/llvm-project/lldb/source -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -I/Users/buildnode/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/llvm-project/lldb/tools/clang/include -I../clang/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/libxml2 -I/Users/buildnode/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/llvm-project/lldb/source/. -Wno-unknown-warning-option -Werror=unguarded-availability-new -arch x86_64  -fno-stack-protector -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-class-memaccess -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -O3  -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.11  -fno-exceptions -fno-rtti -UNDEBUG -std=c++14 -MD -MT source/Plugins/TypeSystem/Swift/CMakeFiles/lldbPluginTypeSystemSwift.dir/TypeSystemSwiftTypeRef.cpp.o -MF source/Plugins/TypeSystem/Swift/CMakeFiles/lldbPluginTypeSystemSwift.dir/TypeSystemSwiftTypeRef.cpp.o.d -o source/Plugins/TypeSystem/Swift/CMakeFiles/lldbPluginTypeSystemSwift.dir/TypeSystemSwiftTypeRef.cpp.o -c /Users/buildnode/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/llvm-project/lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp
/Users/buildnode/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/llvm-project/lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp:2341:22: error: no member named 'make_scope_exit' in namespace 'llvm'
  auto defer = llvm::make_scope_exit([&] {
               ~~~~~~^
1 error generated.

@kastiglione
Copy link
Contributor

That compilation error is fixed in swiftlang/llvm-project#2281

@compnerd
Copy link
Member Author

compnerd commented Jan 6, 2021

@swift-ci please smoke test macOS platform

@compnerd compnerd merged commit b1564a6 into swiftlang:main Jan 6, 2021
@compnerd compnerd deleted the xaudio branch January 6, 2021 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants