[Libreoffice-commits] core.git: avmedia/Library_avmedia.mk avmedia/source config_host/config_features.h.in config_host.mk.in configure.ac include/avmedia RepositoryExternal.mk sd/source

Zolnai Tamás tamas.zolnai at collabora.com
Thu Aug 7 06:46:59 PDT 2014


 RepositoryExternal.mk                   |    6 +++++-
 avmedia/Library_avmedia.mk              |    5 +----
 avmedia/source/framework/modeltools.cxx |    9 ++++++---
 config_host.mk.in                       |    1 +
 config_host/config_features.h.in        |    5 +++++
 configure.ac                            |   23 +++++++++++++++++++----
 include/avmedia/modeltools.hxx          |    4 ++++
 sd/source/ui/func/fuinsert.cxx          |    9 +++++++++
 8 files changed, 50 insertions(+), 12 deletions(-)

New commits:
commit 191f0944fd8fc30493eda58c7adfdfa0b538f507
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Aug 7 15:21:41 2014 +0200

    Handle collada libraries seperately: --disable-collada
    
    Depends on gltf support.
    
    Change-Id: Ief0452da3d03b0ddbca45272e5f5cd268691aeca

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 1961829..1822f95 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3373,6 +3373,8 @@ endef
 
 endif # SYSTEN_LIBGLTF
 
+ifeq ($(ENABLE_COLLADA),TRUE)
+
 define gb_LinkTarget__use_opencollada_parser
 $(call gb_LinkTarget_set_include,$(1),\
 	-I$(call gb_UnpackedTarball_get_dir,opencollada)/COLLADABaseUtils/include \
@@ -3403,7 +3405,9 @@ $(call gb_LinkTarget_use_static_libraries,$(1),\
 )
 endef
 
-endif
+endif # ENABLE_COLLADA
+
+endif # ENABLE_GLTF
 
 ### Jars ############################################################
 
diff --git a/avmedia/Library_avmedia.mk b/avmedia/Library_avmedia.mk
index 184c66c..7cc08fa 100644
--- a/avmedia/Library_avmedia.mk
+++ b/avmedia/Library_avmedia.mk
@@ -52,7 +52,7 @@ $(eval $(call gb_Library_add_exception_objects,avmedia,\
 ))
 endif
 
-ifneq (,$(filter COLLADA2GLTF,$(BUILD_TYPE)))
+ifeq ($(ENABLE_COLLADA),TRUE)
 $(eval $(call gb_Library_set_warnings_not_errors,avmedia))
 
 ifeq ($(OS),LINUX)
@@ -68,9 +68,6 @@ $(eval $(call gb_Library_use_externals,avmedia,\
 	png \
 ))
 
-$(eval $(call gb_Library_add_defs,avmedia,\
-	-DENABLE_COLLADA2GLTF \
-))
 endif
 
 $(eval $(call gb_Library_add_exception_objects,avmedia,\
diff --git a/avmedia/source/framework/modeltools.cxx b/avmedia/source/framework/modeltools.cxx
index 87c7519..4360f42 100644
--- a/avmedia/source/framework/modeltools.cxx
+++ b/avmedia/source/framework/modeltools.cxx
@@ -29,7 +29,9 @@
 #include <boost/foreach.hpp>
 #include <boost/optional.hpp>
 
-#ifdef ENABLE_COLLADA2GLTF
+#include <config_features.h>
+
+#if HAVE_FEATURE_COLLADA
 #include <COLLADA2GLTFWriter.h>
 #include <GLTFAsset.h>
 #endif
@@ -42,7 +44,7 @@ using namespace boost::property_tree;
 
 namespace avmedia {
 
-#ifdef ENABLE_COLLADA2GLTF
+#if HAVE_FEATURE_COLLADA
 
 static void lcl_UnzipKmz(const OUString& rSourceURL, const OUString& rOutputFolderURL, OUString& o_rDaeFileURL)
 {
@@ -241,7 +243,8 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
         const OUString& rSourceURL, OUString& o_rEmbeddedURL)
 {
     OUString sSource = rSourceURL;
-#ifdef ENABLE_COLLADA2GLTF
+
+#if HAVE_FEATURE_COLLADA
     if( !rSourceURL.endsWithIgnoreAsciiCase(".json") )
         KmzDae2Gltf(rSourceURL, sSource);
 #endif
diff --git a/config_host.mk.in b/config_host.mk.in
index 31dea01..1d4520cf 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -112,6 +112,7 @@ export ENABLE_COINMP=@ENABLE_COINMP@
 export SYSTEM_COINMP=@SYSTEM_COINMP@
 export COINMP_CFLAGS=@COINMP_CFLAGS@
 export COINMP_LIBS=@COINMP_LIBS@
+export ENABLE_COLLADA=@ENABLE_COLLADA@
 export ENABLE_CRASHDUMP=@ENABLE_CRASHDUMP@
 export ENABLE_CUPS=@ENABLE_CUPS@
 export ENABLE_CURL=@ENABLE_CURL@
diff --git a/config_host/config_features.h.in b/config_host/config_features.h.in
index 3fd1da5..f87ee27 100644
--- a/config_host/config_features.h.in
+++ b/config_host/config_features.h.in
@@ -142,4 +142,9 @@
  */
 #define HAVE_FEATURE_GLTF 0
 
+/*
+ * Whether we have COLLADA support.
+ */
+#define HAVE_FEATURE_COLLADA 0
+
 #endif
diff --git a/configure.ac b/configure.ac
index 12e5f81..ee388ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1438,6 +1438,10 @@ AC_ARG_ENABLE(gltf,
     AS_HELP_STRING([--disable-gltf],
         [Determines whether to build libraries related to glTF 3D model rendering.]))
 
+AC_ARG_ENABLE(collada,
+    AS_HELP_STRING([--disable-collada],
+        [Disable collada support (Rendering 3D models stored in *.dae and *.kmz format).]))
+
 dnl ===================================================================
 dnl Optional Packages (--with/without-)
 dnl ===================================================================
@@ -10640,10 +10644,6 @@ if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android; then
     else
     	BUILD_TYPE="$BUILD_TYPE LIBGLTF"
     fi
-    # otherwise build fails in collada2gltf external because of std::shared_ptr
-    if test "$have_std_shared_ptr" = "yes"; then
-        BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
-    fi
 else
     AC_MSG_RESULT([no])
 fi
@@ -10652,6 +10652,21 @@ AC_SUBST(SYSTEM_LIBGLTF)
 AC_SUBST(LIBGLTF_CFLAGS)
 AC_SUBST(LIBGLTF_LIBS)
 
+dnl ===================================================================
+dnl Check whether to enable COLLADA support
+dnl ===================================================================
+AC_MSG_CHECKING([whether to enable COLLADA support])
+ENABLE_COLLADA=
+if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE" -a "$have_std_shared_ptr" = "yes"; then
+    AC_MSG_RESULT([yes])
+    ENABLE_COLLADA=TRUE
+    AC_DEFINE(HAVE_FEATURE_COLLADA,1)
+    BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
+else
+    AC_MSG_RESULT([no])
+fi
+AC_SUBST(ENABLE_COLLADA)
+
 # pdf import?
 AC_MSG_CHECKING([whether to build the PDF import feature])
 ENABLE_PDFIMPORT=
diff --git a/include/avmedia/modeltools.hxx b/include/avmedia/modeltools.hxx
index 2435e02..590e8d0 100644
--- a/include/avmedia/modeltools.hxx
+++ b/include/avmedia/modeltools.hxx
@@ -14,9 +14,13 @@
 #include <com/sun/star/frame/XModel.hpp>
 #include <avmedia/avmediadllapi.h>
 
+#include <config_features.h>
+
 namespace avmedia {
 
+#if HAVE_FEATURE_COLLADA
 bool KmzDae2Gltf(const OUString& rSourceURL, OUString& o_rOutput);
+#endif
 
 bool AVMEDIA_DLLPUBLIC Embed3DModel(
     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& xModel,
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index bef5991..e49ef0d 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -784,10 +784,19 @@ void FuInsert3DModel::DoExecute( SfxRequest& )
     sfx2::FileDialogHelper aDlg( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
 
     aDlg.SetTitle( "Insert 3D Model" );
+
+#if HAVE_FEATURE_COLLADA
     aDlg.AddFilter( "All supported formats", "*.json; *.dae; *.kmz"  );
+#else
+    aDlg.AddFilter( "All supported formats", "*.json"  );
+#endif
+
     aDlg.AddFilter( "JSON - GL Transmission Format", "*.json" );
+
+#if HAVE_FEATURE_COLLADA
     aDlg.AddFilter( "DAE - COLLADA", "*.dae" );
     aDlg.AddFilter( "KMZ - Keyhole Markup language Zipped", "*.kmz"  );
+#endif
 
     OUString sURL;
     if( aDlg.Execute() == ERRCODE_NONE )


More information about the Libreoffice-commits mailing list