From 3c6b2741cfec72487257d6a064e886cb6245d2b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Mon, 24 Feb 2020 17:28:06 +0100 Subject: [PATCH] Add bullet package (#16) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add bullet package * Added more details to bullet/Readme.md * Update package/bullet/README.md Co-Authored-By: Steven! Ragnarök * Update package/bullet/bullet.nuspec Co-Authored-By: Steven! Ragnarök --- package/bullet/README.md | 18 +++++ package/bullet/bullet.nuspec | 57 ++++++++++++++ package/bullet/include/.gitkeep | 0 package/bullet/lib/.gitkeep | 0 package/bullet/share/cmake/BulletConfig.cmake | 78 +++++++++++++++++++ package/bullet/tools/LICENSE.txt | 15 ++++ package/bullet/tools/chocolateyinstall.ps1 | 24 ++++++ package/bullet/tools/chocolateyuninstall.ps1 | 13 ++++ package/bullet/tools/regKeys.ps1 | 3 + 9 files changed, 208 insertions(+) create mode 100644 package/bullet/README.md create mode 100644 package/bullet/bullet.nuspec create mode 100644 package/bullet/include/.gitkeep create mode 100644 package/bullet/lib/.gitkeep create mode 100644 package/bullet/share/cmake/BulletConfig.cmake create mode 100644 package/bullet/tools/LICENSE.txt create mode 100644 package/bullet/tools/chocolateyinstall.ps1 create mode 100644 package/bullet/tools/chocolateyuninstall.ps1 create mode 100644 package/bullet/tools/regKeys.ps1 diff --git a/package/bullet/README.md b/package/bullet/README.md new file mode 100644 index 0000000..3aa3ee4 --- /dev/null +++ b/package/bullet/README.md @@ -0,0 +1,18 @@ +Chocolatey Package for Bullet. + +This package is beta quality and designed for a specific application. +At this time it is not recommended to distribute this package outside of the +tutorial application which requires it. + +To build the package, follow these steps. + +You need Git, Visual Studio 2017 Command line tools, CMake, Chocolatey, and a text editor. + +- Clone or download https://github.com/bulletphysics/bullet3 +- Create a CMake build directory and run `cmake -G "Visual Studio 15 2017 Win64" PATH_TO_BULLET_SOURCE -DBUILD_SHARED_LIBS=ON -DUSE_DOUBLE_PRECISION=ON -DBUILD_CPU_DEMOS=OFF -DBUILD_BULLET2_DEMOS=OFF -DBUILD_OPENGL3_DEMOS=OFF -DBUILD_UNIT_TESTS=OFF -DBUILD_EXTRAS=OFF`. +- Run `msbuild ALL_BUILD.sln /p:Configuration=Release` +- Copy `Bullet*.lib` and `Bullet*.dll` located under `lib/Release` files to the package `lib/` directory. +- Run `msbuild ALL_BUILD.sln /p:Configuration=Debug` +- Copy `Bullet*_Debug.lib`, `Bullet*_Debug.dll` and `Bullet*_Debug.pdb` located under `lib/Debug` files to the package `lib/` directory. +- Run `choco pack`. +- Test the package and if it's good upload it somewhere your end users can reach it. diff --git a/package/bullet/bullet.nuspec b/package/bullet/bullet.nuspec new file mode 100644 index 0000000..bcbc230 --- /dev/null +++ b/package/bullet/bullet.nuspec @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + bullet + + + + 2.89.0 + https://github.com/ros2/choco-packages/tree/latest/package/bullet + Alejandro Hernández + + + + + Bullet + Erwin Coumans + + https://github.com/bulletphysics/bullet3/ + + + https://github.com/bulletphysics/bullet3/blob/master/LICENSE.txt + physics simulation engine + Bullet Physics SDK is a real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc. + + Bullet Physics SDK is a real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc. + + + + + + + + + + + diff --git a/package/bullet/include/.gitkeep b/package/bullet/include/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/package/bullet/lib/.gitkeep b/package/bullet/lib/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/package/bullet/share/cmake/BulletConfig.cmake b/package/bullet/share/cmake/BulletConfig.cmake new file mode 100644 index 0000000..f653175 --- /dev/null +++ b/package/bullet/share/cmake/BulletConfig.cmake @@ -0,0 +1,78 @@ +get_filename_component(_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE) +set (BULLET_INCLUDE_DIRS "${_PREFIX}/include") + +set(BULLET_DYNAMICS_LIBRARY + debug + "${_PREFIX}/lib/Bullet3Dynamics_Debug.dll" + "${_PREFIX}/lib/Bullet3Dynamics_Debug.lib" + "${_PREFIX}/lib/BulletDynamics_Debug.dll" + "${_PREFIX}/lib/BulletDynamics_Debug.lib" + "${_PREFIX}/lib/BulletInverseDynamics_Debug.dll" + "${_PREFIX}/lib/BulletInverseDynamics_Debug.lib" + optimized + "${_PREFIX}/lib/Bullet3Dynamics.dll" + "${_PREFIX}/lib/BulletDynamics.dll" + "${_PREFIX}/lib/BulletDynamics.lib" + "${_PREFIX}/lib/BulletInverseDynamics.dll" + "${_PREFIX}/lib/BulletInverseDynamics.lib" +) + +set(BULLET_COLLISION_LIBRARY + debug + "${_PREFIX}/lib/Bullet3Collision_Debug.dll" + "${_PREFIX}/lib/Bullet3Collision_Debug.lib" + "${_PREFIX}/lib/BulletCollision_Debug.dll" + "${_PREFIX}/lib/BulletCollision_Debug.lib" + optimized + "${_PREFIX}/lib/Bullet3Collision.dll" + "${_PREFIX}/lib/Bullet3Collision.lib" + "${_PREFIX}/lib/BulletCollision.dll" + "${_PREFIX}/lib/BulletCollision.lib" +) + +set(BULLET_MATH_LIBRARY + debug + "${_PREFIX}/lib/LinearMath_Debug.dll" + "${_PREFIX}/lib/LinearMath_Debug.lib" + optimized + "${_PREFIX}/lib/LinearMath.dll" + "${_PREFIX}/lib/LinearMath.lib" +) + +set(BULLET_SOFTBODY_LIBRARY + debug + "${_PREFIX}/lib/BulletSoftBody_Debug.dll" + "${_PREFIX}/lib/BulletSoftBody_Debug.lib" + optimized + "${_PREFIX}/lib/BulletSoftBody.dll" + "${_PREFIX}/lib/BulletSoftBody.lib" +) + +set (BULLET_LIBRARIES + debug + "${_PREFIX}/lib/Bullet2FileLoader_Debug.dll" + "${_PREFIX}/lib/Bullet2FileLoader_Debug.lib" + + "${_PREFIX}/lib/Bullet3Common_Debug.dll" + "${_PREFIX}/lib/Bullet3Common_Debug.lib" + "${_PREFIX}/lib/Bullet3Geometry_Debug.dll" + "${_PREFIX}/lib/Bullet3Geometry_Debug.lib" + "${_PREFIX}/lib/Bullet3OpenCL_clew_Debug.dll" + "${_PREFIX}/lib/Bullet3OpenCL_clew_Debug.lib" + optimized + "${_PREFIX}/lib/Bullet2FileLoader.dll" + "${_PREFIX}/lib/Bullet2FileLoader.lib" + "${_PREFIX}/lib/Bullet3Common.dll" + "${_PREFIX}/lib/Bullet3Common.lib" + "${_PREFIX}/lib/Bullet3Geometry.dll" + "${_PREFIX}/lib/Bullet3Geometry.lib" + "${_PREFIX}/lib/Bullet3OpenCL_clew.dll" + "${_PREFIX}/lib/Bullet3OpenCL_clew.lib" +) + +set (BULLET_INCLUDE_DIR "${BULLET_INCLUDE_DIRS}") +set (BULLET_INCLUDE_DIRS "${BULLET_INCLUDE_DIRS}") +set (BULLET_INCLUDE_DIR "${BULLET_INCLUDE_DIRS}") +set (BULLET_LIBRARY "${BULLET_LIBRARIES}") +set (BULLET_LIBRARIES "${BULLET_LIBRARIES}") +set (BULLET_LIBRARY "${BULLET_LIBRARIES}") diff --git a/package/bullet/tools/LICENSE.txt b/package/bullet/tools/LICENSE.txt new file mode 100644 index 0000000..38691d2 --- /dev/null +++ b/package/bullet/tools/LICENSE.txt @@ -0,0 +1,15 @@ + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. \ No newline at end of file diff --git a/package/bullet/tools/chocolateyinstall.ps1 b/package/bullet/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000..29969d5 --- /dev/null +++ b/package/bullet/tools/chocolateyinstall.ps1 @@ -0,0 +1,24 @@ +# IMPORTANT: Before releasing this package, copy/paste the next 2 lines into PowerShell to remove all comments from this file: +# $f='c:\path\to\thisFile.ps1' +# gc $f | ? {$_ -notmatch "^\s*#"} | % {$_ -replace '(^.*?)\s*?[^``]#.*','$1'} | Out-File $f+".~" -en utf8; mv -fo $f+".~" $f + +$ErrorActionPreference = 'Stop'; # stop on all errors + +# Source registry key values which are shared between install and uninstall +. $PSScriptRoot\regKeys.ps1 + + +# CMake doesn't set registry keys for the system package repository by default so we check for the presence of CMake by observing the registry path for the current user. +# We need to register the package path to the machine because the jenkins node user doesn't have privileges to install packages via chocolatey. There may be other options to work around this and use HKCU. +if (Test-Path $CMakeRegistryPath) { + if (-not(Test-Path $CMakeSystemRepositoryPath)) { + # The force is necessary to make this create parent keys (think `mkdir -p`). It ain't great. + New-Item $CMakeSystemRepositoryPath -ItemType directory -Force + } + + New-Item "$CMakeSystemRepositoryPath\$CMakePackageName" -ItemType directory + New-ItemProperty -Name "CMakePackageDir" -PropertyType String -Value "$env:ChocolateyPackageFolder\share\cmake" -Path "$CMakeSystemRepositoryPath\$CMakePackageName" +} + +# Add lib directory to path for dlls. +Install-ChocolateyPath "$env:ChocolateyPackageFolder\lib" -PathType "Machine" diff --git a/package/bullet/tools/chocolateyuninstall.ps1 b/package/bullet/tools/chocolateyuninstall.ps1 new file mode 100644 index 0000000..01c71d2 --- /dev/null +++ b/package/bullet/tools/chocolateyuninstall.ps1 @@ -0,0 +1,13 @@ +$ErrorActionPreference = 'Stop'; # stop on all errors + +# Source registry key values which are shared between install and uninstall +. $PSScriptRoot\regKeys.ps1 + +if (Test-Path $CMakeRegistryPath) { + if (Test-Path $CMakeSystemRepositoryPath) { + Remove-Item "$CMakeSystemRepositoryPath\$CMakePackageName" + } +} + +# Removal of the dynamic library from the system Path +# is handled automagically by the use of Install-ChocolateyPath. diff --git a/package/bullet/tools/regKeys.ps1 b/package/bullet/tools/regKeys.ps1 new file mode 100644 index 0000000..aed05cc --- /dev/null +++ b/package/bullet/tools/regKeys.ps1 @@ -0,0 +1,3 @@ +$CMakeRegistryPath = "HKCU:\SOFTWARE\Kitware\CMake" +$CMakeSystemRepositoryPath = "HKLM:\SOFTWARE\Kitware\CMake\Packages" +$CMakePackageName = "Bullet"