Skip to content

Commit 7b712ed

Browse files
committed
fixed for clang
1 parent 138c996 commit 7b712ed

File tree

6 files changed

+46
-8
lines changed

6 files changed

+46
-8
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/cmake-build/
22
/.idea
33
/out
4+
*.DS_Store

CMakeLists.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ option(OMATH_BUILD_EXAMPLES "Build example projects with you can learn & play" O
1414
option(OMATH_STATIC_MSVC_RUNTIME_LIBRARY "Force Omath to link static runtime" OFF)
1515

1616
if (OMATH_BUILD_AS_SHARED_LIBRARY)
17-
add_library(omath SHARED source/Matrix.cpp)
17+
add_library(omath SHARED source/matrix.cpp)
1818
else()
19-
add_library(omath STATIC source/Matrix.cpp)
19+
add_library(omath STATIC source/matrix.cpp
20+
source/matrix.cpp)
2021
endif()
21-
22+
message(STATUS "Building on ${CMAKE_HOST_SYSTEM_NAME}")
2223
add_library(omath::omath ALIAS omath)
2324

2425
if (OMATH_IMGUI_INTEGRATION)

CMakePresets.json

+32
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,38 @@
6464
"cacheVariables": {
6565
"CMAKE_BUILD_TYPE": "Release"
6666
}
67+
},
68+
{
69+
"name": "darwin-base",
70+
"hidden": true,
71+
"generator": "Ninja",
72+
"binaryDir": "${sourceDir}/cmake-build/build/${presetName}",
73+
"installDir": "${sourceDir}/cmake-build/install/${presetName}",
74+
"cacheVariables": {
75+
"CMAKE_C_COMPILER": "clang",
76+
"CMAKE_CXX_COMPILER": "clang++"
77+
},
78+
"condition": {
79+
"type": "equals",
80+
"lhs": "${hostSystemName}",
81+
"rhs": "Darwin"
82+
}
83+
},
84+
{
85+
"name": "darwin-debug",
86+
"displayName": "Darwin Debug",
87+
"inherits": "darwin-base",
88+
"cacheVariables": {
89+
"CMAKE_BUILD_TYPE": "Debug"
90+
}
91+
},
92+
{
93+
"name": "darwin-release",
94+
"displayName": "Darwin Release",
95+
"inherits": "darwin-debug",
96+
"cacheVariables": {
97+
"CMAKE_BUILD_TYPE": "Release"
98+
}
6799
}
68100
]
69101
}

include/omath/vector2.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ namespace omath
124124
}
125125

126126
#ifndef _MSC_VER
127-
[[nodiscard]] constexpr Type& Length() const
127+
[[nodiscard]] constexpr Type Length() const
128128
{
129-
return std::hypot(x, y);
129+
return std::hypot(this->x, this->y);
130130
}
131131

132132
[[nodiscard]] constexpr Vector2 Normalized() const

include/omath/vector3.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ namespace omath
121121
#ifndef _MSC_VER
122122
[[nodiscard]] constexpr Type Length() const
123123
{
124-
return std::hypot(x, y, z);
124+
return std::hypot(this->x, this->y, z);
125125
}
126126

127127
[[nodiscard]] constexpr Type Length2D() const
128128
{
129-
return Vector2::Length();
129+
return Vector2<Type>::Length();
130130
}
131131
[[nodiscard]] Type DistTo(const Vector3& vOther) const
132132
{

source/projectile_prediction/proj_pred_engine_avx2.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
#include "omath/projectile_prediction/proj_pred_engine_avx2.hpp"
55
#include "source_location"
66

7+
#if defined(OMATH_USE_AVX2) && defined(__i386__) && defined(__x86_64__)
8+
#include <immintrin.h>
9+
#endif
10+
711
namespace omath::projectile_prediction
812
{
913
std::optional<Vector3<float>>
1014
ProjPredEngineAVX2::MaybeCalculateAimPoint([[maybe_unused]] const Projectile& projectile,
1115
[[maybe_unused]] const Target& target) const
1216
{
13-
#ifdef OMATH_USE_AVX2
17+
#if defined(OMATH_USE_AVX2) && defined(__i386__) && defined(__x86_64__)
1418
const float bulletGravity = m_gravityConstant * projectile.m_gravityScale;
1519
const float v0 = projectile.m_launchSpeed;
1620
const float v0Sqr = v0 * v0;

0 commit comments

Comments
 (0)