summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2016-05-18 07:25:23 (GMT)
committerDavid Yip <yipdw@member.fsf.org>2016-05-19 07:32:44 (GMT)
commitfe5fc67f3ab02341ad9c24f21646eb42b219df65 (patch)
treeeb661f8ea1cc0b0c38a9c6dfd2bc5d6469ed4f6c
parent0acac278d238acbdacd75267f5cfbb1a6cf9afd3 (diff)
downloadmxe-fe5fc67f3ab02341ad9c24f21646eb42b219df65.zip
mxe-fe5fc67f3ab02341ad9c24f21646eb42b219df65.tar.gz
mxe-fe5fc67f3ab02341ad9c24f21646eb42b219df65.tar.bz2
glm: add rules to download/build version 0.9.7.4
-rw-r--r--index.html4
-rw-r--r--src/glm-test.cpp32
-rw-r--r--src/glm.mk28
3 files changed, 64 insertions, 0 deletions
diff --git a/index.html b/index.html
index 1c7cc16..116e9ae 100644
--- a/index.html
+++ b/index.html
@@ -1418,6 +1418,10 @@ local-pkg-list: $(LOCAL_PKG_LIST)</pre>
<td class="website"><a href="http://www.gtkmm.org/">GLibmm</a></td>
</tr>
<tr>
+ <td class="package">glm</td>
+ <td class="website"><a href="http://glm.g-truc.net">GLM - OpenGL Mathematics</a></td>
+ </tr>
+ <tr>
<td class="package">gmp</td>
<td class="website"><a href="http://www.gmplib.org/">GMP</a></td>
</tr>
diff --git a/src/glm-test.cpp b/src/glm-test.cpp
new file mode 100644
index 0000000..08e8a32
--- /dev/null
+++ b/src/glm-test.cpp
@@ -0,0 +1,32 @@
+/*
+ * This file is part of MXE.
+ * See index.html for further information.
+ *
+ * This file is a test program for glm, adapted from the code sample at
+ * http://glm.g-truc.net/0.9.7/index.html.
+ */
+
+#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
+#include <glm/mat4x4.hpp> // glm::mat4
+#include <glm/vec3.hpp> // glm::vec3
+#include <glm/vec4.hpp> // glm::vec4
+#include <glm/gtx/string_cast.hpp> // so we can print a calculation result
+#include <iostream>
+
+glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
+{
+ glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.f);
+ glm::mat4 View = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate));
+ View = glm::rotate(View, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f));
+ View = glm::rotate(View, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f));
+ glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f));
+ return Projection * View * Model;
+}
+
+int main()
+{
+ glm::mat4 m = camera(0.0f, glm::vec2(0.0f, 0.0f));
+ std::cout << glm::to_string(m) << std::endl;
+
+ return 0;
+}
diff --git a/src/glm.mk b/src/glm.mk
new file mode 100644
index 0000000..eba83d1
--- /dev/null
+++ b/src/glm.mk
@@ -0,0 +1,28 @@
+# This file is part of MXE.
+# See index.html for further information.
+
+PKG := glm
+$(PKG)_IGNORE :=
+$(PKG)_VERSION := 0.9.7.4
+$(PKG)_CHECKSUM := 0cfa1e40041114cda8ced7e6738860fe6f9a7103d25bcc376adb9840fcf21fe1
+$(PKG)_SUBDIR := glm-$($(PKG)_VERSION)
+$(PKG)_FILE := $($(PKG)_VERSION).tar.gz
+$(PKG)_URL := https://github.com/g-truc/glm/archive/$($(PKG)_VERSION).tar.gz
+$(PKG)_DEPS := gcc
+
+define $(PKG)_UPDATE
+ $(call MXE_GET_GITHUB_TAGS, g-truc/glm)
+endef
+
+define $(PKG)_BUILD
+ mkdir '$(1).build'
+
+ cd '$(1).build' && $(TARGET)-cmake '$(1)'
+
+ $(MAKE) -C '$(1).build' -j '$(JOBS)' install
+
+ '$(TARGET)-g++' \
+ -W -Wall -Werror -ansi -pedantic \
+ '$(2).cpp' -o '$(PREFIX)/$(TARGET)/bin/test-glm.exe'
+endef
+