summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.fetch1
-rw-r--r--RepositoryExternal.mk18
-rw-r--r--configure.ac1
-rw-r--r--download.lst1
-rw-r--r--external/Module_external.mk1
-rw-r--r--external/libgltf/Makefile14
-rw-r--r--external/libgltf/Module_libgltf.mk17
-rw-r--r--external/libgltf/README1
-rw-r--r--external/libgltf/StaticLibrary_libgltf.mk47
-rw-r--r--external/libgltf/UnpackedTarball_libgltf.mk28
-rw-r--r--external/libgltf/patches/adress_of_temporary.patch13
-rw-r--r--external/libgltf/patches/extra_qualification.patch12
-rw-r--r--external/libgltf/patches/include_path_freetype.patch12
-rw-r--r--external/libgltf/patches/include_path_glew.patch48
-rw-r--r--external/libgltf/patches/include_typo_texture.patch12
-rw-r--r--external/libgltf/patches/missing_include_cstring.patch11
-rw-r--r--external/libgltf/patches/unneeded_context_handling.patch12
-rw-r--r--external/libgltf/patches/win_only_variables.patch40
18 files changed, 288 insertions, 1 deletions
diff --git a/Makefile.fetch b/Makefile.fetch
index 636a924360e9..3efe2b5ebee1 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -146,6 +146,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
$(call fetch_Optional,LANGUAGETOOL,$(LANGUAGETOOL_TARBALL)) \
$(call fetch_Optional,LCMS2,$(LCMS2_TARBALL)) \
$(call fetch_Optional,LIBEXTTEXTCAT,$(LIBEXTTEXTCAT_TARBALL)) \
+ $(call fetch_Optional,LIBGLTF,$(LIBGLTF_TARBALL)) \
$(call fetch_Optional,LIBLANGTAG,$(LIBLANGTAG_TARBALL)) \
$(call fetch_Optional,LIBXML2,$(LIBXML_TARBALL)) \
$(LIBXMLSEC_TARBALL) \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index a371f2fa88fd..c9e04fa87ae7 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -21,7 +21,7 @@
# depending on the configure options these may be taken from the system,
# or the internal/bundled copy may be built.
-# for every external, a function gb_LinkTarget_use__FOO is defined,
+# for every external, a function gb_LinkTarget__use_FOO is defined,
# once for the system case, once for the internal case.
# in the system case, no libraries should be registered, but the target-local
@@ -3087,6 +3087,22 @@ endif # SYSTEM_NSS
endif # DESKTOP
+
+ifeq ($(ENABLE_GLTF),TRUE)
+
+define gb_LinkTarget__use_libgltf
+$(call gb_LinkTarget_set_include,$(1),\
+ -I$(call gb_UnpackedTarball_get_dir,libgltf)/inc \
+ $$(INCLUDE) \
+)
+
+$(call gb_LinkTarget_use_static_libraries,$(1),\
+ libgltf \
+)
+endef
+
+endif
+
### Jars ############################################################
ifneq ($(SYSTEM_HSQLDB),)
diff --git a/configure.ac b/configure.ac
index 50c811706067..693d102d1c21 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10368,6 +10368,7 @@ AC_MSG_CHECKING([whether to enable glTF support])
if test "$enable_opengl" = "yes"; then
ENABLE_GLTF=TRUE
AC_MSG_RESULT([yes])
+ BUILD_TYPE="$BUILD_TYPE LIBGLTF"
if test "$test_freetype" = "no"; then
BUILD_TYPE="$BUILD_TYPE FREETYPE"
fi
diff --git a/download.lst b/download.lst
index 40f9ff2583ce..b3b48fae530c 100644
--- a/download.lst
+++ b/download.lst
@@ -88,6 +88,7 @@ export JPEG_TARBALL := 52654eb3b2e60c35731ea8fc87f1bd29-jpegsrc.v8d.tar.gz
export LANGUAGETOOL_TARBALL := b63e6340a02ff1cacfeadb2c42286161-JLanguageTool-1.7.0.tar.bz2
export LCMS2_TARBALL := 861ef15fa0bc018f9ddc932c4ad8b6dd-lcms2-2.4.tar.gz
export LIBEXTTEXTCAT_TARBALL := ae330b9493bd4503ac390106ff6060d7-libexttextcat-3.4.3.tar.bz2
+export LIBGLTF_TARBALL := 8ac8ae9829c4fefd1ae9f715f95d4e0b-libgltf.tar.gz
export LIBLANGTAG_TARBALL := 36271d3fa0d9dec1632029b6d7aac925-liblangtag-0.5.1.tar.bz2
export LIBXMLSEC_TARBALL := 1f24ab1d39f4a51faf22244c94a6203f-xmlsec1-1.2.14.tar.gz
export LIBXML_TARBALL := 9c0cfef285d5c4a5c80d00904ddab380-libxml2-2.9.1.tar.gz
diff --git a/external/Module_external.mk b/external/Module_external.mk
index e9e90c47acfe..02f659570230 100644
--- a/external/Module_external.mk
+++ b/external/Module_external.mk
@@ -57,6 +57,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\
$(call gb_Helper_optional,LIBATOMIC_OPS,libatomic_ops) \
$(call gb_Helper_optional,LIBEOT,libeot) \
$(call gb_Helper_optional,LIBEXTTEXTCAT,libexttextcat) \
+ $(call gb_Helper_optional,LIBGLTF,libgltf) \
$(call gb_Helper_optional,LIBLANGTAG,liblangtag) \
$(call gb_Helper_optional,LIBPNG,libpng) \
$(call gb_Helper_optional,LIBXML2,libxml2) \
diff --git a/external/libgltf/Makefile b/external/libgltf/Makefile
new file mode 100644
index 000000000000..569ad8a0ba7a
--- /dev/null
+++ b/external/libgltf/Makefile
@@ -0,0 +1,14 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libgltf/Module_libgltf.mk b/external/libgltf/Module_libgltf.mk
new file mode 100644
index 000000000000..b593f89398ea
--- /dev/null
+++ b/external/libgltf/Module_libgltf.mk
@@ -0,0 +1,17 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,libgltf))
+
+$(eval $(call gb_Module_add_targets,libgltf,\
+ StaticLibrary_libgltf \
+ UnpackedTarball_libgltf \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libgltf/README b/external/libgltf/README
new file mode 100644
index 000000000000..41fbde692e70
--- /dev/null
+++ b/external/libgltf/README
@@ -0,0 +1 @@
+Render glTF 3D models.
diff --git a/external/libgltf/StaticLibrary_libgltf.mk b/external/libgltf/StaticLibrary_libgltf.mk
new file mode 100644
index 000000000000..4628ebb9760a
--- /dev/null
+++ b/external/libgltf/StaticLibrary_libgltf.mk
@@ -0,0 +1,47 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_StaticLibrary_StaticLibrary,libgltf))
+
+$(eval $(call gb_StaticLibrary_set_warnings_not_errors,libgltf))
+
+$(eval $(call gb_StaticLibrary_use_unpacked,libgltf,libgltf))
+
+$(eval $(call gb_StaticLibrary_set_generated_cxx_suffix,libgltf,cpp))
+
+# Avoid warnings
+$(eval $(call gb_StaticLibrary_add_cxxflags,libgltf,-w))
+
+$(eval $(call gb_StaticLibrary_use_externals,libgltf,\
+ boost_headers \
+ glm_headers \
+ mesa_headers \
+ glew \
+ zlib \
+ freetype \
+))
+
+$(eval $(call gb_StaticLibrary_set_include,libgltf,\
+ -I$(call gb_UnpackedTarball_get_dir,libgltf)/inc \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_StaticLibrary_add_generated_exception_objects,libgltf,\
+ UnpackedTarball/libgltf/src/Camera \
+ UnpackedTarball/libgltf/src/Common \
+ UnpackedTarball/libgltf/src/Font \
+ UnpackedTarball/libgltf/src/FPSCounter \
+ UnpackedTarball/libgltf/src/libgltf \
+ UnpackedTarball/libgltf/src/LoadScene \
+ UnpackedTarball/libgltf/src/RenderScene \
+ UnpackedTarball/libgltf/src/Shaders \
+ UnpackedTarball/libgltf/src/Texture \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libgltf/UnpackedTarball_libgltf.mk b/external/libgltf/UnpackedTarball_libgltf.mk
new file mode 100644
index 000000000000..44496d190be9
--- /dev/null
+++ b/external/libgltf/UnpackedTarball_libgltf.mk
@@ -0,0 +1,28 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,libgltf))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,libgltf,$(LIBGLTF_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_set_patchflags,libgltf,--binary))
+
+$(eval $(call gb_UnpackedTarball_set_patchlevel,libgltf,1))
+
+$(eval $(call gb_UnpackedTarball_add_patches,libgltf,\
+ external/libgltf/patches/include_path_glew.patch \
+ external/libgltf/patches/include_path_freetype.patch \
+ external/libgltf/patches/missing_include_cstring.patch \
+ external/libgltf/patches/win_only_variables.patch \
+ external/libgltf/patches/unneeded_context_handling.patch \
+ external/libgltf/patches/include_typo_texture.patch \
+ external/libgltf/patches/adress_of_temporary.patch \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libgltf/patches/adress_of_temporary.patch b/external/libgltf/patches/adress_of_temporary.patch
new file mode 100644
index 000000000000..d5ea4bc1ef6f
--- /dev/null
+++ b/external/libgltf/patches/adress_of_temporary.patch
@@ -0,0 +1,13 @@
+diff -ur libgltf.org/src/FPSCounter.cpp libgltf/src/FPSCounter.cpp
+--- libgltf.org/src/FPSCounter.cpp 2014-04-18 12:21:54.655972783 +0200
++++ libgltf/src/FPSCounter.cpp 2014-04-18 12:22:25.280971654 +0200
+@@ -107,7 +107,8 @@
+ glUseProgram(uiFPSProgram);
+ glDisable(GL_DEPTH_TEST);
+ GLuint iLoc = glGetUniformLocation(uiFPSProgram, "matrices.projMatrix");
+- glUniformMatrix4fv(iLoc, 1,false, (GLfloat*)(&glm::ortho(0.0f, float(pViewport->width), 0.0f, float(pViewport->height))));
++ const glm::mat4 aMat = glm::ortho(0.0f, float(pViewport->width), 0.0f, float(pViewport->height));
++ glUniformMatrix4fv(iLoc, 1,false, glm::value_ptr(aMat));
+ glm::vec4 lightVector = glm::vec4(1.0f, 1.0f, 1.0f, 1.0f);
+ iLoc = glGetUniformLocation(uiFPSProgram, "vColor");
+ glUniform4fv(iLoc, 1, (GLfloat*)&lightVector);
diff --git a/external/libgltf/patches/extra_qualification.patch b/external/libgltf/patches/extra_qualification.patch
new file mode 100644
index 000000000000..213d8f08c1fd
--- /dev/null
+++ b/external/libgltf/patches/extra_qualification.patch
@@ -0,0 +1,12 @@
+diff -ur libgltf.org/Common.h libgltf/Common.h
+--- libgltf.org/Common.h 2014-04-17 14:24:31.978887883 +0200
++++ libgltf/Common.h 2014-04-17 14:24:57.505886942 +0200
+@@ -551,7 +551,7 @@
+ std::map<std::string, class Technique*>& getTechniqueMap();
+
+ const std::string getCameraIndex() const;
+- const float* Scene::getCameraMatrix() const;
++ const float* getCameraMatrix() const;
+
+ char* getBuffer(unsigned int length);
+ bool setBuffer(const std::string& binName, unsigned int length);
diff --git a/external/libgltf/patches/include_path_freetype.patch b/external/libgltf/patches/include_path_freetype.patch
new file mode 100644
index 000000000000..a365195ba6ed
--- /dev/null
+++ b/external/libgltf/patches/include_path_freetype.patch
@@ -0,0 +1,12 @@
+diff -ur libgltf.org/src/Font.h libgltf/src/Font.h
+--- libgltf.org/src/Font.h 2014-04-18 12:07:57.573003655 +0200
++++ libgltf/src/Font.h 2014-04-18 12:08:22.202002747 +0200
+@@ -8,7 +8,7 @@
+ #ifndef FONT_H
+ #define FONT_H
+
+-#include "freetype/ft2build.h"
++#include "ft2build.h"
+ #include FT_FREETYPE_H
+ #include "Texture.h"
+
diff --git a/external/libgltf/patches/include_path_glew.patch b/external/libgltf/patches/include_path_glew.patch
new file mode 100644
index 000000000000..0d516da29258
--- /dev/null
+++ b/external/libgltf/patches/include_path_glew.patch
@@ -0,0 +1,48 @@
+diff -ur libgltf.org/src/Camera.h libgltf/src/Camera.h
+--- libgltf.org/src/Camera.h 2014-04-18 12:05:38.343008790 +0200
++++ libgltf/src/Camera.h 2014-04-18 12:05:50.331008348 +0200
+@@ -8,7 +8,7 @@
+ #ifndef CAMERA_H
+ #define CAMERA_H
+
+-#include <glew/glew.h>
++#include <GL/glew.h>
+ #include <glm/glm.hpp>
+
+ class CPhysicalCamera
+diff -ur libgltf.org/src/Common.h libgltf/src/Common.h
+--- libgltf.org/src/Common.h 2014-04-18 12:05:38.343008790 +0200
++++ libgltf/src/Common.h 2014-04-18 12:05:52.245008277 +0200
+@@ -7,7 +7,7 @@
+ */
+ #ifndef COMMON_H
+ #define COMMON_H
+-#include <glew/glew.h>
++#include <GL/glew.h>
+ #include <glm/glm.hpp>
+ #include <string>
+ #include <vector>
+diff -ur libgltf.org/src/Shaders.h libgltf/src/Shaders.h
+--- libgltf.org/src/Shaders.h 2014-04-18 12:05:38.343008790 +0200
++++ libgltf/src/Shaders.h 2014-04-18 12:06:02.907007884 +0200
+@@ -8,7 +8,7 @@
+ #ifndef SHADERS_H
+ #define SHADERS_H
+
+-#include <glew/glew.h>
++#include <GL/glew.h>
+ #include <glm/glm.hpp>
+
+ #include <string>
+diff -ur libgltf.org/src/Texture.h libgltf/src/Texture.h
+--- libgltf.org/src/Texture.h 2014-04-18 12:05:38.343008790 +0200
++++ libgltf/src/Texture.h 2014-04-18 12:06:06.390007755 +0200
+@@ -10,7 +10,7 @@
+ #include <string>
+ #include <vector>
+ #include <map>
+-#include <glew/glew.h>
++#include <GL/glew.h>
+ #include <glm/glm.hpp>
+ using namespace std;
+
diff --git a/external/libgltf/patches/include_typo_texture.patch b/external/libgltf/patches/include_typo_texture.patch
new file mode 100644
index 000000000000..9ddd269a0490
--- /dev/null
+++ b/external/libgltf/patches/include_typo_texture.patch
@@ -0,0 +1,12 @@
+diff -ur libgltf.org/src/Texture.cpp libgltf/src/Texture.cpp
+--- libgltf.org/src/Texture.cpp 2014-04-18 12:19:41.806977683 +0200
++++ libgltf/src/Texture.cpp 2014-04-18 12:20:08.065976714 +0200
+@@ -5,7 +5,7 @@
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+-#include "texture.h"
++#include "Texture.h"
+
+ Texture::Texture()
+ {
diff --git a/external/libgltf/patches/missing_include_cstring.patch b/external/libgltf/patches/missing_include_cstring.patch
new file mode 100644
index 000000000000..8b73389efe1b
--- /dev/null
+++ b/external/libgltf/patches/missing_include_cstring.patch
@@ -0,0 +1,11 @@
+diff -ur libgltf.org/src/Common.cpp libgltf/src/Common.cpp
+--- libgltf.org/src/Common.cpp 2014-04-18 12:09:30.459000229 +0200
++++ libgltf/src/Common.cpp 2014-04-18 12:09:51.643999448 +0200
+@@ -6,6 +6,7 @@
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+ #include "Common.h"
++#include <cstring>
+
+ namespace glTF
+ {
diff --git a/external/libgltf/patches/unneeded_context_handling.patch b/external/libgltf/patches/unneeded_context_handling.patch
new file mode 100644
index 000000000000..a5c14b5c7e3c
--- /dev/null
+++ b/external/libgltf/patches/unneeded_context_handling.patch
@@ -0,0 +1,12 @@
+diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp
+--- libgltf.org/src/RenderScene.cpp 2014-04-18 12:13:26.226991534 +0200
++++ libgltf/src/RenderScene.cpp 2014-04-18 12:13:46.133990800 +0200
+@@ -587,8 +587,6 @@
+ }
+ pFPSCounter->timeStampEnd();
+ pFPSCounter->printFPS(pViewport);
+-
+- SwapBuffers(wglGetCurrentDC());
+ }
+
+ void RenderScene::releaseRender(void* lpParam)
diff --git a/external/libgltf/patches/win_only_variables.patch b/external/libgltf/patches/win_only_variables.patch
new file mode 100644
index 000000000000..bf2931d3c7e9
--- /dev/null
+++ b/external/libgltf/patches/win_only_variables.patch
@@ -0,0 +1,40 @@
+diff -ur libgltf.org/src/FPSCounter.cpp libgltf/src/FPSCounter.cpp
+--- libgltf.org/src/FPSCounter.cpp 2014-04-18 12:10:37.031997774 +0200
++++ libgltf/src/FPSCounter.cpp 2014-04-18 12:12:00.025994713 +0200
+@@ -115,8 +115,10 @@
+ {
+ mFPS = getFPS();
+ mDurationTime = 0;
++#ifdef _WIN32
+ mTotalTime = getExecutionTime();
+ mGPUTime = mGPUDuration/dqFreq;
++#endif
+ }
+ else
+ {
+@@ -128,6 +130,8 @@
+ }
+
+ pFont->printFormattedString(20, pViewport->height-30, 20, "FPS: %d", mFPS);
++#ifdef _WIN32
+ pFont->printFormattedString(20, pViewport->height-60, 20, "Render Total Time: %.2f ms, Draw Time: %.2f ms", mTotalTime*1000,mGPUTime*1000);
++#endif
+ glEnable(GL_DEPTH_TEST);
+-}
+\ No newline at end of file
++}
+diff -ur libgltf.org/src/FPSCounter.h libgltf/src/FPSCounter.h
+--- libgltf.org/src/FPSCounter.h 2014-04-18 12:10:37.038997774 +0200
++++ libgltf/src/FPSCounter.h 2014-04-18 12:11:32.301995736 +0200
+@@ -51,9 +51,11 @@
+ mFPS=0;
+ mDurationTime =0;
+ mGPUTime =0;
++#ifdef _WIN32
+ mTotalTime = 0;
+ QueryPerformanceFrequency(&f);
+ dqFreq=(double)f.QuadPart;
++#endif
+ }
+ ~FPSCounter()
+ {