Skip to content

Commit

Permalink
Agnostic toolset for VS project + std link issue with MSVC 17.2+ (#580)
Browse files Browse the repository at this point in the history
* Agnostic toolset for VS project

* platform tool version

* pragma for std

* Update Modules/@babylonjs/react-native-windows/windows/BabylonReactNative/BabylonReactNative.vcxproj

Co-authored-by: Gary Hsu <bghgary@users.noreply.github.com>

* update windows readme

---------

Co-authored-by: Gary Hsu <bghgary@users.noreply.github.com>
  • Loading branch information
CedricGuillemet and bghgary authored Jun 1, 2023
1 parent 76388a0 commit dfc218e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
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

0 comments on commit dfc218e

Please sign in to comment.