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

Support for Windows with msvc #2

Merged
merged 7 commits into from
Mar 17, 2021

Conversation

Snowapril
Copy link
Contributor

@Snowapril Snowapril commented Mar 13, 2021

Hello. At first, I really appreciated for providing really good example of openxr and vulkan application.
But I encountered problem with build error in Windows msvc compiler
I modified some codes for supporting window platform as far as not touching Linux specific codes.

In addition, there is trivial problems like below

  1. In windows, as generated ktx dynamic linking library is not located in the same directory with executable file,
    program complains about there is no ktx.dll file. Thus, I did manually relocate ktx.dll file to executable file path.
  2. Since designated initializer is non-standard features before c++20:latest, I should set c++ standard as c++20 for successful building.

As M_PI is non-standard macro, msvc does not support M_PI in cmath. 
For defining M_PI, add _USE_MATH_DEFINES macro in advance
In msvc, this is not permitted conversion.
As std::filesystem::path provides string() method, I replaced it.
replace WINDOWS to _WIN32 for checking botn window 32bit and 64bit.
I think WINDOWS is not valid for checking window platform
As non-constant size array declaration is non-standard, I replaced it to vector
As, vector.reserve actually not allocating memory, in my compiler these commands make abort. 
I think reserve calls need to be replaced by resize or constructor with size.
As a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax, I remove explicit type conversion because both left and right are same type I think there is no need to specifying it.
without this binary flag (e.g. with text mode), vkCreateShaderModule function does not work properly.
I added this flag and work project completely good in window
@gpx1000
Copy link
Contributor

gpx1000 commented Mar 17, 2021

Thanks for the PR. It's great to see these fixes. I'll do a quick review and we'll accept the changes.

Also thanks for the issues in windows. I will investigate some fixes.

@gpx1000 gpx1000 self-requested a review March 17, 2021 17:20
Copy link
Contributor

@gpx1000 gpx1000 left a comment

Choose a reason for hiding this comment

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

This looks great to me! Thanks for the quality PR.

@@ -137,9 +137,9 @@ namespace Util {
return false;
}

XrReferenceSpaceType referenceSpaces[referenceSpacesCount];
Copy link
Contributor

Choose a reason for hiding this comment

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

Moving to C++ vectors from C Arrays is fine for me. I initially wanted to keep them as C Arrays as this is meant as an instructional sample rather than a production code. I think this is a fine change.

@gpx1000 gpx1000 merged commit 7a153a6 into Holochip-Public:main Mar 17, 2021
@Snowapril Snowapril deleted the window-msvc-support branch March 18, 2021 08:02
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.

None yet

2 participants