fixed for clang

This commit is contained in:
Orange
2025-04-05 13:00:00 +03:00
parent 138c996393
commit 7b712ed960
6 changed files with 46 additions and 8 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/cmake-build/ /cmake-build/
/.idea /.idea
/out /out
*.DS_Store

View File

@@ -14,11 +14,12 @@ option(OMATH_BUILD_EXAMPLES "Build example projects with you can learn & play" O
option(OMATH_STATIC_MSVC_RUNTIME_LIBRARY "Force Omath to link static runtime" OFF) option(OMATH_STATIC_MSVC_RUNTIME_LIBRARY "Force Omath to link static runtime" OFF)
if (OMATH_BUILD_AS_SHARED_LIBRARY) if (OMATH_BUILD_AS_SHARED_LIBRARY)
add_library(omath SHARED source/Matrix.cpp) add_library(omath SHARED source/matrix.cpp)
else() else()
add_library(omath STATIC source/Matrix.cpp) add_library(omath STATIC source/matrix.cpp
source/matrix.cpp)
endif() endif()
message(STATUS "Building on ${CMAKE_HOST_SYSTEM_NAME}")
add_library(omath::omath ALIAS omath) add_library(omath::omath ALIAS omath)
if (OMATH_IMGUI_INTEGRATION) if (OMATH_IMGUI_INTEGRATION)

View File

@@ -64,6 +64,38 @@
"cacheVariables": { "cacheVariables": {
"CMAKE_BUILD_TYPE": "Release" "CMAKE_BUILD_TYPE": "Release"
} }
},
{
"name": "darwin-base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/cmake-build/build/${presetName}",
"installDir": "${sourceDir}/cmake-build/install/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
},
{
"name": "darwin-debug",
"displayName": "Darwin Debug",
"inherits": "darwin-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "darwin-release",
"displayName": "Darwin Release",
"inherits": "darwin-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
} }
] ]
} }

View File

@@ -124,9 +124,9 @@ namespace omath
} }
#ifndef _MSC_VER #ifndef _MSC_VER
[[nodiscard]] constexpr Type& Length() const [[nodiscard]] constexpr Type Length() const
{ {
return std::hypot(x, y); return std::hypot(this->x, this->y);
} }
[[nodiscard]] constexpr Vector2 Normalized() const [[nodiscard]] constexpr Vector2 Normalized() const

View File

@@ -121,12 +121,12 @@ namespace omath
#ifndef _MSC_VER #ifndef _MSC_VER
[[nodiscard]] constexpr Type Length() const [[nodiscard]] constexpr Type Length() const
{ {
return std::hypot(x, y, z); return std::hypot(this->x, this->y, z);
} }
[[nodiscard]] constexpr Type Length2D() const [[nodiscard]] constexpr Type Length2D() const
{ {
return Vector2::Length(); return Vector2<Type>::Length();
} }
[[nodiscard]] Type DistTo(const Vector3& vOther) const [[nodiscard]] Type DistTo(const Vector3& vOther) const
{ {

View File

@@ -4,13 +4,17 @@
#include "omath/projectile_prediction/proj_pred_engine_avx2.hpp" #include "omath/projectile_prediction/proj_pred_engine_avx2.hpp"
#include "source_location" #include "source_location"
#if defined(OMATH_USE_AVX2) && defined(__i386__) && defined(__x86_64__)
#include <immintrin.h>
#endif
namespace omath::projectile_prediction namespace omath::projectile_prediction
{ {
std::optional<Vector3<float>> std::optional<Vector3<float>>
ProjPredEngineAVX2::MaybeCalculateAimPoint([[maybe_unused]] const Projectile& projectile, ProjPredEngineAVX2::MaybeCalculateAimPoint([[maybe_unused]] const Projectile& projectile,
[[maybe_unused]] const Target& target) const [[maybe_unused]] const Target& target) const
{ {
#ifdef OMATH_USE_AVX2 #if defined(OMATH_USE_AVX2) && defined(__i386__) && defined(__x86_64__)
const float bulletGravity = m_gravityConstant * projectile.m_gravityScale; const float bulletGravity = m_gravityConstant * projectile.m_gravityScale;
const float v0 = projectile.m_launchSpeed; const float v0 = projectile.m_launchSpeed;
const float v0Sqr = v0 * v0; const float v0Sqr = v0 * v0;