Skip to content

Agnostic toolset for VS project + std link issue with MSVC 17.2+ #580

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 6 commits into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Modules/@babylonjs/react-native-windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@ This package has several **peer dependencies**. If these dependencies are unmet,

This package will not work without installing the `@babylonjs/react-native` peer dependency.
The `react-native-permissions` dependency is required for XR capabilities of Babylon.js.

### Toolset

Default toolset is v142. It's possible to change it using project variable named `BabylonReactNativeToolset`.
There are multiple ways to specify it:
- environment variable
- msbuild property (`msbuild /p:BabylonReactNativeToolset=v143` for example)
- customize the build by folder (https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-by-directory?view=vs-2022)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
#include "BabylonModule.h"
#include "JSI/JsiApiContext.h"

// see https://developercommunity.visualstudio.com/t/-imp-std-init-once-complete-unresolved-external-sy/1684365
#if _MSC_VER >= 1932 // Visual Studio 2022 version 17.2+
# pragma comment(linker, "/alternatename:__imp___std_init_once_complete=__imp_InitOnceComplete")
# pragma comment(linker, "/alternatename:__imp___std_init_once_begin_initialize=__imp_InitOnceBeginInitialize")
#endif

using namespace winrt::BabylonReactNative::implementation;

REACT_INIT(Initialize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
<PropertyGroup Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
<PlatformToolset Condition="'$(BabylonReactNativeToolset)'!=''">$(BabylonReactNativeToolset)</PlatformToolset>

<CharacterSet>Unicode</CharacterSet>
<GenerateManifest>false</GenerateManifest>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
Expand Down