Skip to content
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

build: fix building with MSVC #333

Merged
merged 1 commit into from
Mar 7, 2024
Merged

Conversation

rkitover
Copy link
Contributor

@rkitover rkitover commented Mar 6, 2024

Add an ALIGN(type, boundary) macro with an MSVC equivalent using
__declspec(align(x)) to the gcc/clang-specific
attribute((aligned(x))). Fallback to no alignment for other
compilers.

Link system DLLs on Windows by name instead of as an -l linker flag,
cmake automatically produces the correct linker invocation on both MINGW
and MSVC.

Include <windows.h> with WIN32_LEAN_AND_MEAN defined instead of
including <windef.h> and <winbase.h>, because this breaks the Windows
header architecture detection on MSVC.

Define the GUIDs for IID_IAudioClient, IID_IAudioRenderClient,
IID_IMMDeviceEnumerator and CLSID_MMDeviceEnumerator for PLATFORM_WIN32
taken from the SDK headers, because MSVC cannot find the linkage for
them.

@flibitijibibo
Copy link
Member

All looks good except for the language version bump - does __declspec(align) work with newer VS versions? We should be able to stay on the old version if so.

@rkitover
Copy link
Contributor Author

rkitover commented Mar 7, 2024

How's this, I added an ALIGN(type, boundary) macro.

@rkitover rkitover mentioned this pull request Mar 7, 2024
11 tasks
rkitover added a commit to rkitover/vcpkg that referenced this pull request Mar 7, 2024
Add new port FAudio, an "accuracy-focused XAudio reimplementation for
open platforms".

Use the PLATFORM_WIN32 cmake flag on Windows, otherwise use the sdl2
dependency.

MSVC build PR is here:

FNA-XNA/FAudio#333

MSYS2 package is here:

https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-faudio/PKGBUILD

Signed-off-by: Rafael Kitover <[email protected]>
Copy link
Member

@flibitijibibo flibitijibibo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, will merge when CI is ready!

Add an ALIGN(type, boundary) macro with an MSVC equivalent using
__declspec(align(x)) to the gcc/clang-specific
__attribute__((aligned(x))). Fallback to no alignment for other
compilers.

Link system DLLs on Windows by name instead of as an -l linker flag,
cmake automatically produces the correct linker invocation on both MINGW
and MSVC.

Include <windows.h> with WIN32_LEAN_AND_MEAN defined instead of
including <windef.h> and <winbase.h>, because this breaks the Windows
header architecture detection on MSVC.

Define the GUIDs for IID_IAudioClient, IID_IAudioRenderClient,
IID_IMMDeviceEnumerator and CLSID_MMDeviceEnumerator for PLATFORM_WIN32
taken from the SDK headers, because MSVC cannot find the linkage for
them. Define them only for MSVC because MINGW throws a redeclaration
error.

Signed-off-by: Rafael Kitover <[email protected]>
@rkitover
Copy link
Contributor Author

rkitover commented Mar 7, 2024

Can you rerun the CI please, I fixed the MINGW fail.

rkitover added a commit to rkitover/vcpkg that referenced this pull request Mar 7, 2024
Add new port FAudio, an "accuracy-focused XAudio reimplementation for
open platforms".

Use the PLATFORM_WIN32 cmake flag on Windows, otherwise use the sdl2
dependency.

MSVC build PR is here:

FNA-XNA/FAudio#333

MSYS2 package is here:

https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-faudio/PKGBUILD

Signed-off-by: Rafael Kitover <[email protected]>
@flibitijibibo flibitijibibo merged commit 81d5a24 into FNA-XNA:master Mar 7, 2024
5 checks passed
rkitover added a commit to rkitover/vcpkg that referenced this pull request Mar 8, 2024
Add new port FAudio, an "accuracy-focused XAudio reimplementation for
open platforms".

Use the PLATFORM_WIN32 cmake flag on Windows, otherwise use the sdl2
dependency.

MSVC build PR is here:

FNA-XNA/FAudio#333

MSYS2 package is here:

https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-faudio/PKGBUILD

Signed-off-by: Rafael Kitover <[email protected]>
rkitover added a commit to rkitover/vcpkg that referenced this pull request Mar 8, 2024
Add new port FAudio, an "accuracy-focused XAudio reimplementation for
open platforms".

Use the PLATFORM_WIN32 cmake flag on Windows, otherwise use the sdl2
dependency.

MSVC build PR is here:

FNA-XNA/FAudio#333

MSYS2 package is here:

https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-faudio/PKGBUILD

Signed-off-by: Rafael Kitover <[email protected]>
@rkitover rkitover deleted the msvc-build branch March 8, 2024 18:57
rkitover added a commit to rkitover/vcpkg that referenced this pull request Mar 8, 2024
Add new port FAudio, an "accuracy-focused XAudio reimplementation for
open platforms".

Use the PLATFORM_WIN32 cmake flag on Windows, otherwise use the sdl2
dependency.

MSVC build PR is here:

FNA-XNA/FAudio#333

MSYS2 package is here:

https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-faudio/PKGBUILD

Signed-off-by: Rafael Kitover <[email protected]>
rkitover added a commit to rkitover/vcpkg that referenced this pull request Mar 8, 2024
Add new port FAudio, an "accuracy-focused XAudio reimplementation for
open platforms".

Use the PLATFORM_WIN32 cmake flag on Windows, otherwise use the sdl2
dependency.

MSVC build PR is here:

FNA-XNA/FAudio#333

MSYS2 package is here:

https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-faudio/PKGBUILD

Signed-off-by: Rafael Kitover <[email protected]>
rkitover added a commit to rkitover/vcpkg that referenced this pull request Mar 9, 2024
Add new port FAudio, an "accuracy-focused XAudio reimplementation for
open platforms".

Use the PLATFORM_WIN32 cmake flag on Windows, otherwise use the sdl2
dependency.

MSVC build PR is here:

FNA-XNA/FAudio#333

, followup PR to fix alignment is here:

FNA-XNA/FAudio#334

, MSYS2 package is here:

https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-faudio/PKGBUILD
.

Signed-off-by: Rafael Kitover <[email protected]>
rkitover added a commit to rkitover/vcpkg that referenced this pull request Mar 10, 2024
Add new port FAudio, an "accuracy-focused XAudio reimplementation for
open platforms".

Use the PLATFORM_WIN32 cmake flag on Windows, otherwise use the sdl2
dependency.

MSVC build PR is here:

FNA-XNA/FAudio#333

, followup PR to fix alignment is here:

FNA-XNA/FAudio#334

, MSYS2 package is here:

https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-faudio/PKGBUILD
.

Signed-off-by: Rafael Kitover <[email protected]>
rkitover added a commit to rkitover/vcpkg that referenced this pull request Mar 10, 2024
Add new port FAudio, an "accuracy-focused XAudio reimplementation for
open platforms".

Use the PLATFORM_WIN32 cmake flag on Windows, otherwise use the sdl2
dependency.

MSVC build PR is here:

FNA-XNA/FAudio#333

, followup PR to fix alignment is here:

FNA-XNA/FAudio#334

, MSYS2 package is here:

https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-faudio/PKGBUILD
.

Signed-off-by: Rafael Kitover <[email protected]>
rkitover added a commit to rkitover/vcpkg that referenced this pull request Mar 10, 2024
Add new port FAudio, an "accuracy-focused XAudio reimplementation for
open platforms".

Use the PLATFORM_WIN32 cmake flag on Windows, otherwise use the sdl2
dependency.

MSVC build PR is here:

FNA-XNA/FAudio#333

, followup PR to fix alignment is here:

FNA-XNA/FAudio#334

, and another followup for the SDL2 dependency:

FNA-XNA/FAudio#335

, the MSYS2 package is here:

https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-faudio/PKGBUILD
.

Signed-off-by: Rafael Kitover <[email protected]>
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.

2 participants