chore: build reactphysics3d automatically via vcpkg
This commit is contained in:
parent
df9e285954
commit
76ceaae25b
8 changed files with 78 additions and 5 deletions
|
@ -8,6 +8,14 @@
|
|||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-linux",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,14 +1,14 @@
|
|||
#include "surface.h"
|
||||
#include "datatypes/vector.h"
|
||||
|
||||
static std::array<Data::Vector3, 6> FACE_NORMALS = {{
|
||||
Data::Vector3 FACE_NORMALS[6] = {
|
||||
{ 1, 0, 0 },
|
||||
{ 0, 1, 0 },
|
||||
{ 0, 0, 1 },
|
||||
{ -1, 0, 0 },
|
||||
{ 0, -1, 0 },
|
||||
{ 0, 0, -1 },
|
||||
}};
|
||||
};
|
||||
|
||||
NormalId faceFromNormal(Data::Vector3 normal) {
|
||||
for (int face = 0; face < 6; face++) {
|
||||
|
|
6
editor/mainglwidget.cpp
Normal file → Executable file
6
editor/mainglwidget.cpp
Normal file → Executable file
|
@ -11,6 +11,8 @@
|
|||
#include "rendering/renderer.h"
|
||||
#include "rendering/shader.h"
|
||||
|
||||
#define PI 3.14159
|
||||
|
||||
static Data::CFrame XYZToZXY(glm::vec3(0, 0, 0), -glm::vec3(1, 0, 0), glm::vec3(0, 0, 1));
|
||||
|
||||
MainGLWidget::MainGLWidget(QWidget* parent): QOpenGLWidget(parent) {
|
||||
|
@ -271,7 +273,7 @@ void MainGLWidget::handleRotationalTransform(QMouseEvent* evt) {
|
|||
|
||||
// Snap the angle
|
||||
if (snappingFactor() > 0)
|
||||
angle = roundf(angle * 4 / std::numbers::pi / snappingFactor()) / 4 * std::numbers::pi * snappingFactor();
|
||||
angle = roundf(angle * 4 / PI / snappingFactor()) / 4 * PI * snappingFactor();
|
||||
|
||||
// Checks if the rotation axis is facing towards, or away from the camera
|
||||
// If it pointing away from the camera, then we need to invert the angle change
|
||||
|
@ -483,4 +485,4 @@ float MainGLWidget::snappingFactor() {
|
|||
case GridSnappingMode::SNAP_OFF: return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
3
vcpkg-configuration.json
Normal file → Executable file
3
vcpkg-configuration.json
Normal file → Executable file
|
@ -10,5 +10,8 @@
|
|||
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
|
||||
"name": "microsoft"
|
||||
}
|
||||
],
|
||||
"overlay-ports": [
|
||||
"./vcpkg-overlays"
|
||||
]
|
||||
}
|
||||
|
|
23
vcpkg-overlays/reactphysics3d/portfile.cmake
Executable file
23
vcpkg-overlays/reactphysics3d/portfile.cmake
Executable file
|
@ -0,0 +1,23 @@
|
|||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO DanielChappuis/reactphysics3d
|
||||
REF "cd958bbc0c6e84a869388cba6613f10cc645b3cb"
|
||||
SHA512 9856c0e998473e0bfb97af9ced07952bbd4dfef79f7dc388b1ecf9b6c6406f7669333e441fe6cefdf40b32edc5a1b8e4cb35a8c15fccb64c28785aff5fd77113
|
||||
HEAD_REF master
|
||||
PATCHES "std_chrono.patch"
|
||||
)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
|
||||
vcpkg_cmake_config_fixup(PACKAGE_NAME "reactphysics3d" CONFIG_PATH "lib/cmake/ReactPhysics3D")
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
# file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|
12
vcpkg-overlays/reactphysics3d/std_chrono.patch
Executable file
12
vcpkg-overlays/reactphysics3d/std_chrono.patch
Executable file
|
@ -0,0 +1,12 @@
|
|||
diff --git a/include/reactphysics3d/utils/DefaultLogger.h b/include/reactphysics3d/utils/DefaultLogger.h
|
||||
index 1088d1e..8360f07 100644
|
||||
--- a/include/reactphysics3d/utils/DefaultLogger.h
|
||||
+++ b/include/reactphysics3d/utils/DefaultLogger.h
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <iomanip>
|
||||
#include <mutex>
|
||||
#include <ctime>
|
||||
+#include <chrono>
|
||||
|
||||
/// ReactPhysics3D namespace
|
||||
namespace reactphysics3d {
|
18
vcpkg-overlays/reactphysics3d/vcpkg.json
Executable file
18
vcpkg-overlays/reactphysics3d/vcpkg.json
Executable file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "reactphysics3d",
|
||||
"version": "0.10.2",
|
||||
"homepage": "https://github.com/DanielChappuis/reactphysics3d",
|
||||
"description": "Open source C++ physics engine library in 3D",
|
||||
"license": "zlib",
|
||||
"dependencies": [
|
||||
{
|
||||
"name" : "vcpkg-cmake",
|
||||
"host" : true
|
||||
},
|
||||
{
|
||||
"name" : "vcpkg-cmake-config",
|
||||
"host" : true
|
||||
},
|
||||
"fmt"
|
||||
]
|
||||
}
|
9
vcpkg.json
Normal file → Executable file
9
vcpkg.json
Normal file → Executable file
|
@ -5,6 +5,13 @@
|
|||
"glm",
|
||||
{ "name": "pugixml", "version>=": "1.15" },
|
||||
"sdl2",
|
||||
"stb"
|
||||
"stb",
|
||||
"reactphysics3d"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"name": "sdl2",
|
||||
"version": "2.32.4"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue