Fix compile with glm 1.0.0+ and musl libc (#185)

* bugfix: fix compilation with glm 1.0.0+

GLM_ENABLE_EXPERIMENTAL has guarded inclusion of glm/gtx/transform.hpp
since version 1.0.0.

* bugfix: fix compilation on musl libc

isinff is deprecated since C99 and only glibc still implements it
nowadays while musl libc doesn't, replace it with the modern counterpart
and start using the C++ overload.

Meanwhile M_PIf is a glibc 2.35+ macro which doesn't exist on musl libc
math.h, so just use M_PI which seems to work the same in this case.
This commit is contained in:
Jami Kettunen 2024-07-01 18:14:23 +03:00 committed by GitHub
parent 458b5cc4fd
commit c2f37ded8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 7 deletions

View File

@ -21,8 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <mir/server_action_queue.h>
#define MIR_LOG_COMPONENT "animator"
#include <mir/log.h>
#define _USE_MATH_DEFINES
#include <cmath>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/transform.hpp>
#include <utility>
@ -42,7 +41,7 @@ inline float get_percent_complete(float target, float real)
return 1.f;
float percent = real / target;
if (isinff(percent) != 0 || percent > 1.f)
if (std::isinf(percent) != 0 || percent > 1.f)
return 1.f;
else
return percent;
@ -140,11 +139,11 @@ inline float ease(AnimationDefinition const& defintion, float t)
case EaseFunction::linear:
return t;
case EaseFunction::ease_in_sine:
return 1 - cosf((t * M_PIf) / 2.f);
return 1 - cosf((t * M_PI) / 2.f);
case EaseFunction::ease_in_out_sine:
return -(cosf(M_PIf * t) - 1) / 2;
return -(cosf(M_PI * t) - 1) / 2;
case EaseFunction::ease_out_sine:
return sinf((t * M_PIf) / 2.f);
return sinf((t * M_PI) / 2.f);
case EaseFunction::ease_in_quad:
return t * t;
case EaseFunction::ease_out_quad:

View File

@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "output_content.h"
#include "window_helpers.h"
#include "workspace_manager.h"
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/transform.hpp>
#include <mir/log.h>
#include <mir/scene/surface.h>

View File

@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "window_metadata.h"
#include "output_content.h"
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/transform.hpp>
using namespace miracle;