From 822498fd3f9959c1b04a6a3cda229959fb3313ec Mon Sep 17 00:00:00 2001 From: Elias Holzer Date: Sat, 15 Feb 2025 16:26:29 +0100 Subject: [PATCH] Necessary changes for win-arm64 build --- README.md | 1 + src/VHACD_Lib/VHACD/VHACD.sln | 10 +++- src/VHACD_Lib/VHACD/VHACD.vcxproj | 78 ++++++++++++++++++++++++++++--- src/VHACD_Lib/inc/btScalar.h | 2 +- src/msbuild_winstore.bat | 11 ++++- 5 files changed, 91 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 05a05c938..4f3a6676c 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ This repo houses bullet 2, the physics engine used within [Stride](https://githu - Windows x64 / x86 / Store / UWP / ARM msbuild: - Install Visual Studio 2015+ with C++, cmake and Windows Store/UWP requirements. - > msbuild_winstore.bat + - Cherry-pick e4414c80232d66f8a250aa83f934594bcba3c605 in bullet submodule to fix build on win-arm64 - If you run into any issue (which you most likely will) good luck, CMakeLists wants to build everything, you'll have to fiddle around with it. - Unix: - > sudo apt install make diff --git a/src/VHACD_Lib/VHACD/VHACD.sln b/src/VHACD_Lib/VHACD/VHACD.sln index 2f40009d1..b0b0e9ba9 100644 --- a/src/VHACD_Lib/VHACD/VHACD.sln +++ b/src/VHACD_Lib/VHACD/VHACD.sln @@ -1,22 +1,28 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29326.143 +# Visual Studio Version 17 +VisualStudioVersion = 17.13.35806.99 d17.13 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VHACD", "VHACD.vcxproj", "{F7ED6A05-8E3A-4239-BEB7-ACAA3128FBF7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM64 = Debug|ARM64 Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 + Release|ARM64 = Release|ARM64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F7ED6A05-8E3A-4239-BEB7-ACAA3128FBF7}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {F7ED6A05-8E3A-4239-BEB7-ACAA3128FBF7}.Debug|ARM64.Build.0 = Debug|ARM64 {F7ED6A05-8E3A-4239-BEB7-ACAA3128FBF7}.Debug|Win32.ActiveCfg = Debug|Win32 {F7ED6A05-8E3A-4239-BEB7-ACAA3128FBF7}.Debug|Win32.Build.0 = Debug|Win32 {F7ED6A05-8E3A-4239-BEB7-ACAA3128FBF7}.Debug|x64.ActiveCfg = Debug|x64 {F7ED6A05-8E3A-4239-BEB7-ACAA3128FBF7}.Debug|x64.Build.0 = Debug|x64 + {F7ED6A05-8E3A-4239-BEB7-ACAA3128FBF7}.Release|ARM64.ActiveCfg = Release|ARM64 + {F7ED6A05-8E3A-4239-BEB7-ACAA3128FBF7}.Release|ARM64.Build.0 = Release|ARM64 {F7ED6A05-8E3A-4239-BEB7-ACAA3128FBF7}.Release|Win32.ActiveCfg = Release|Win32 {F7ED6A05-8E3A-4239-BEB7-ACAA3128FBF7}.Release|Win32.Build.0 = Release|Win32 {F7ED6A05-8E3A-4239-BEB7-ACAA3128FBF7}.Release|x64.ActiveCfg = Release|x64 diff --git a/src/VHACD_Lib/VHACD/VHACD.vcxproj b/src/VHACD_Lib/VHACD/VHACD.vcxproj index 9f862f220..d5c2cb948 100644 --- a/src/VHACD_Lib/VHACD/VHACD.vcxproj +++ b/src/VHACD_Lib/VHACD/VHACD.vcxproj @@ -1,6 +1,10 @@ - + + + Debug + ARM64 + Debug Win32 @@ -9,6 +13,10 @@ Debug x64 + + Release + ARM64 + Release Win32 @@ -40,26 +48,39 @@ DynamicLibrary true - v142 + v143 Unicode DynamicLibrary true - v142 + v143 + Unicode + + + DynamicLibrary + true + v143 Unicode DynamicLibrary false - v142 + v143 true Unicode DynamicLibrary false - v142 + v143 + true + Unicode + + + DynamicLibrary + false + v143 true Unicode @@ -72,12 +93,18 @@ + + + + + + true @@ -85,12 +112,18 @@ true + + true + false false + + false + NotUsing @@ -121,6 +154,21 @@ S:\bullet-2.82-r2704-CMade\lib\Debug;%(AdditionalLibraryDirectories) + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;VHACD_EXPORTS;%(PreprocessorDefinitions) + ..\inc;..\..\bullet-2.82-r2704\src;%(AdditionalIncludeDirectories) + StreamingSIMDExtensions + + + Windows + true + ..\..\build\bullet\Windows\arm64\lib\Debug;%(AdditionalLibraryDirectories) + + Level3 @@ -157,7 +205,25 @@ ..\..\build\bullet\Windows\x64\lib\Release;%(AdditionalLibraryDirectories) + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;VHACD_EXPORTS;%(PreprocessorDefinitions) + ..\inc;..\..\bullet-2.82-r2704\src;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + ..\..\build\bullet\Windows\arm64\lib\Release;%(AdditionalLibraryDirectories) + + - \ No newline at end of file + diff --git a/src/VHACD_Lib/inc/btScalar.h b/src/VHACD_Lib/inc/btScalar.h index f4bc17c9c..d3d4ec906 100644 --- a/src/VHACD_Lib/inc/btScalar.h +++ b/src/VHACD_Lib/inc/btScalar.h @@ -67,7 +67,7 @@ inline int btGetVersion() #define btFsel(a,b,c) __fsel((a),(b),(c)) #else -#if (defined (_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined (BT_USE_DOUBLE_PRECISION)) +#if (defined (_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined (BT_USE_DOUBLE_PRECISION)) && !defined(_M_ARM64) #define BT_USE_SSE #include #endif diff --git a/src/msbuild_winstore.bat b/src/msbuild_winstore.bat index 61ecb7a2e..c6cbaf51f 100644 --- a/src/msbuild_winstore.bat +++ b/src/msbuild_winstore.bat @@ -1,14 +1,21 @@ REM Windows mkdir msbuild\x86 pushd msbuild\x86 -cmake ..\..\..\libbulletc\ -G "Visual Studio 15" -DBUILD_MULTITHREADING=OFF -DBULLET_LIBS_DIR=..\..\..\bullet\Windows\x86\lib +cmake ..\..\..\libbulletc\ -G "Visual Studio 17 2022" -A Win32 -DBUILD_MULTITHREADING=OFF -DBULLET_LIBS_DIR=..\..\..\bullet\Windows\x86\lib msbuild libbulletc.sln /p:Configuration=Release if %ERRORLEVEL% neq 0 GOTO :error_popd popd mkdir msbuild\x64 pushd msbuild\x64 -cmake ..\..\..\libbulletc\ -G "Visual Studio 15 Win64" -DBUILD_MULTITHREADING=OFF -DBULLET_LIBS_DIR=..\..\..\bullet\Windows\x64\lib +cmake ..\..\..\libbulletc\ -G "Visual Studio 17 2022" -A X64 -DBUILD_MULTITHREADING=OFF -DBULLET_LIBS_DIR=..\..\..\bullet\Windows\x64\lib +msbuild libbulletc.sln /p:Configuration=Release +if %ERRORLEVEL% neq 0 GOTO :error_popd +popd + +mkdir msbuild\arm64 +pushd msbuild\arm64 +cmake ..\..\..\libbulletc\ -G "Visual Studio 17 2022" -A ARM64 -DBUILD_MULTITHREADING=OFF -DBULLET_LIBS_DIR=..\..\..\bullet\Windows\arm64\lib msbuild libbulletc.sln /p:Configuration=Release if %ERRORLEVEL% neq 0 GOTO :error_popd popd