glm: update to 1.0.1.

This commit is contained in:
Đoàn Trần Công Danh 2025-08-30 16:16:27 +07:00
parent d71570e1b0
commit f399af49c4
6 changed files with 244 additions and 194 deletions

View file

@ -1,7 +0,0 @@
prefix=/usr
includedir=${prefix}/include
Name: GLM
Description: OpenGL Mathematics
Version: 0.9.9.6
Cflags: -I${includedir}

View file

@ -1,169 +1,172 @@
Taken from Adélie Linux.
--- glm-0.9.9.0/test/gtc/gtc_packing.cpp
+++ glm-0.9.9.0/test/gtc/gtc_packing.cpp
@@ -3,6 +3,7 @@
#include <glm/gtc/epsilon.hpp>
#include <cstdio>
#include <vector>
+#include <arpa/inet.h>
void print_bits(float const& s)
{
@@ -155,7 +156,7 @@
glm::u8vec4 const v0(0xff, 0x77, 0x0, 0x33);
glm::uint32 const p0 = *reinterpret_cast<glm::uint32 const*>(&v0[0]);
- glm::uint32 const r0 = 0x330077ff;
+ glm::uint32 const r0 = htonl(0xff770033);
Error += p0 == r0 ? 0 : 1;
--- glm-0.9.9.0/glm/gtc/packing.inl
+++ glm-0.9.9.0/glm/gtc/packing.inl
@@ -9,6 +9,9 @@
#include "../detail/type_half.hpp"
#include <cstring>
#include <limits>
+extern "C" {
+#include <endian.h>
+}
namespace glm{
namespace detail
@@ -183,9 +186,15 @@
{
struct
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 3;
uint y : 3;
uint z : 2;
diff --git a/glm/gtc/packing.inl b/glm/gtc/packing.inl
index 1792760..1c60f5a 100644
--- a/glm/gtc/packing.inl
+++ b/glm/gtc/packing.inl
@@ -10,6 +10,10 @@
#include <cstring>
#include <limits>
+extern "C" {
+#include <endian.h>
+}
+
namespace glm{
namespace detail
{
@@ -190,9 +194,15 @@ namespace detail
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 3;
uint y : 3;
uint z : 2;
+#else
+ uint z : 2;
+ uint y : 3;
+ uint x : 3;
+ uint z : 2;
+ uint y : 3;
+ uint x : 3;
+#endif
} data;
uint8 pack;
};
@@ -194,8 +203,13 @@
{
struct
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 4;
uint y : 4;
} data;
uint8 pack;
};
@@ -201,8 +211,13 @@ namespace detail
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 4;
uint y : 4;
+#else
+ uint y : 4;
+ uint x : 4;
+ uint y : 4;
+ uint x : 4;
+#endif
} data;
uint8 pack;
};
@@ -204,10 +218,17 @@
{
struct
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 4;
uint y : 4;
uint z : 4;
uint w : 4;
+#else
+ uint w : 4;
+ uint z : 4;
+ uint y : 4;
+ uint x : 4;
+#endif
} data;
uint16 pack;
};
@@ -216,9 +237,15 @@
{
struct
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 5;
uint y : 6;
uint z : 5;
+#else
+ uint z : 5;
+ uint y : 6;
+ uint x : 5;
+#endif
} data;
uint16 pack;
};
@@ -227,10 +254,17 @@
{
struct
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 5;
uint y : 5;
uint z : 5;
uint w : 1;
+#else
+ uint w : 1;
+ uint z : 5;
+ uint y : 5;
+ uint x : 5;
+#endif
} data;
uint16 pack;
};
@@ -239,10 +273,17 @@
{
struct
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 10;
uint y : 10;
uint z : 10;
uint w : 2;
+#else
+ uint w : 2;
+ uint z : 10;
+ uint y : 10;
+ uint x : 10;
+#endif
} data;
uint32 pack;
};
@@ -251,10 +292,17 @@
{
struct
{
+#if BYTE_ORDER == LITTLE_ENDIAN
int x : 10;
int y : 10;
int z : 10;
int w : 2;
+#else
+ int w : 2;
+ int z : 10;
+ int y : 10;
+ int x : 10;
+#endif
} data;
uint32 pack;
};
@@ -263,10 +311,17 @@
{
struct
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 9;
uint y : 9;
uint z : 9;
uint w : 5;
+#else
+ uint w : 5;
+ uint z : 9;
+ uint y : 9;
+ uint x : 9;
+#endif
} data;
uint32 pack;
};
} data;
uint8 pack;
};
@@ -211,10 +226,17 @@ namespace detail
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 4;
uint y : 4;
uint z : 4;
uint w : 4;
+#else
+ uint w : 4;
+ uint z : 4;
+ uint y : 4;
+ uint x : 4;
+#endif
} data;
uint16 pack;
};
@@ -223,9 +245,15 @@ namespace detail
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 5;
uint y : 6;
uint z : 5;
+#else
+ uint z : 5;
+ uint y : 6;
+ uint x : 5;
+#endif
} data;
uint16 pack;
};
@@ -234,10 +262,17 @@ namespace detail
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 5;
uint y : 5;
uint z : 5;
uint w : 1;
+#else
+ uint w : 1;
+ uint z : 5;
+ uint y : 5;
+ uint x : 5;
+#endif
} data;
uint16 pack;
};
@@ -252,10 +287,17 @@ namespace detail
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 10;
uint y : 10;
uint z : 10;
uint w : 2;
+#else
+ uint w : 2;
+ uint z : 10;
+ uint y : 10;
+ uint x : 10;
+#endif
} data;
uint32 pack;
};
@@ -264,10 +306,17 @@ namespace detail
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
int x : 10;
int y : 10;
int z : 10;
int w : 2;
+#else
+ int w : 2;
+ int z : 10;
+ int y : 10;
+ int x : 10;
+#endif
} data;
uint32 pack;
};
@@ -276,10 +325,17 @@ namespace detail
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 9;
uint y : 9;
uint z : 9;
uint w : 5;
+#else
+ uint w : 5;
+ uint z : 9;
+ uint y : 9;
+ uint x : 9;
+#endif
} data;
uint32 pack;
};
diff --git a/test/gtc/gtc_packing.cpp b/test/gtc/gtc_packing.cpp
index b3fd854..614c0e2 100644
--- a/test/gtc/gtc_packing.cpp
+++ b/test/gtc/gtc_packing.cpp
@@ -4,6 +4,7 @@
#include <glm/ext/vector_relational.hpp>
#include <cstdio>
#include <vector>
+#include <arpa/inet.h>
/*
static void print_bits(float const& s)
@@ -157,7 +158,7 @@ static int test_U3x10_1x2()
glm::u8vec4 const v0(0xff, 0x77, 0x0, 0x33);
glm::uint32 const p0 = *reinterpret_cast<glm::uint32 const*>(&v0[0]);
- glm::uint32 const r0 = 0x330077ff;
+ glm::uint32 const r0 = htonl(0xff770033);
Error += p0 == r0 ? 0 : 1;

View file

@ -0,0 +1,20 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -263,7 +263,7 @@
install(
EXPORT glm
NAMESPACE glm::
- DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/glm"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/glm"
FILE glmConfig.cmake
)
include(CMakePackageConfigHelpers)
@@ -273,7 +273,7 @@
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake"
- DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/glm"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/glm"
)
configure_file(

View file

@ -0,0 +1,25 @@
this is removed in 1.0, but it's still needed by anything trying to find this
with autotools
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,6 +32,10 @@
option(GLM_ENABLE_CXX_17 "Enable C++ 17" OFF)
option(GLM_ENABLE_CXX_20 "Enable C++ 20" OFF)
+set(GLM_PC ${CMAKE_CURRENT_BINARY_DIR}/glm.pc)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/glm.pc.in ${GLM_PC} @ONLY)
+install(FILES ${GLM_PC} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(GLM_ENABLE_CXX_20)
--- /dev/null
+++ b/glm.pc.in
@@ -0,0 +1,7 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+includedir=${prefix}/include
+
+Name: GLM
+Description: OpenGL Mathematics
+Version: @GLM_VERSION@
+Cflags: -I${includedir}

View file

@ -0,0 +1,25 @@
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 93abbfa..2ac0df3 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -11,7 +11,6 @@
endif()
if(NOT GLM_DISABLE_AUTO_DETECTION)
- add_compile_options(-Werror -Weverything)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
@@ -20,12 +19,10 @@
endif()
if(NOT GLM_DISABLE_AUTO_DETECTION)
- add_compile_options(-Werror)
# add_compile_options(-Wpedantic)
# add_compile_options(-Wall)
# add_compile_options(-Wextra)
endif()
- add_compile_options(-O2)
#add_compile_options(-Wno-long-long)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
if(NOT GLM_QUIET)

View file

@ -1,33 +1,17 @@
# Template file for 'glm'
pkgname=glm
version=0.9.9.8
revision=2
version=1.0.1
revision=1
build_style=cmake
hostmakedepends="dos2unix unzip"
hostmakedepends="unzip"
short_desc="C++ mathematics library for graphics programming"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="http://glm.g-truc.net"
distfiles="https://github.com/g-truc/glm/releases/download/${version}/glm-${version}.zip"
checksum=37e2a3d62ea3322e43593c34bae29f57e3e251ea89f4067506c94043769ade4c
# No longer has install target
# Install manually
do_install() {
local i
vmkdir usr/include
vcopy glm usr/include
vmkdir usr/lib/cmake
vcopy cmake/glm usr/lib/cmake
vmkdir usr/share/pkgconfig
vinstall ${FILESDIR}/glm.pc 644 usr/share/pkgconfig
}
distfiles="https://github.com/g-truc/glm/releases/download/${version}/glm-${version}-light.zip"
distfiles="https://github.com/g-truc/glm/archive/refs/tags/${version}.tar.gz"
checksum=9f3174561fd26904b23f0db5e560971cbf9b3cbda0b280f04d5c379d03bf234c
post_install() {
local f
for f in $(find ${DESTDIR}/usr/include -type f); do
dos2unix "$f"
done
rm "${DESTDIR}/usr/include/glm/CMakeLists.txt"
vlicense copying.txt LICENSE
}