From f24c60870531689d95c056037e48cd29ad1d17bb Mon Sep 17 00:00:00 2001 From: David Tardon Date: Mon, 20 Oct 2014 14:21:22 +0200 Subject: [PATCH] allow to build with system opencollada Change-Id: I6101099c57d429987e06bca0652c843f4a94f8cc --- Makefile.fetch | 2 +- RepositoryExternal.mk | 16 ++++++++++++++++ config_host.mk.in | 4 +++- configure.ac | 35 +++++++++++++++++++++++++++++++++++ external/Module_external.mk | 2 +- 5 files changed, 56 insertions(+), 3 deletions(-) diff --git a/Makefile.fetch b/Makefile.fetch index e8ccf5b..18b12be 100644 --- a/Makefile.fetch +++ b/Makefile.fetch @@ -184,7 +184,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR) $(call fetch_Optional,NSS,NSS_TARBALL) \ $(call fetch_Optional_pack,NUMBERTEXT_EXTENSION_PACK) \ $(call fetch_Optional,ODFGEN,ODFGEN_TARBALL) \ - $(call fetch_Optional,COLLADA2GLTF,OPENCOLLADA_TARBALL) \ + $(call fetch_Optional,OPENCOLLADA,OPENCOLLADA_TARBALL) \ $(call fetch_Optional,OPENLDAP,OPENLDAP_TARBALL) \ $(call fetch_Optional,OPENSSL,OPENSSL_TARBALL) \ $(call fetch_Optional,ORCUS,ORCUS_TARBALL) \ diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index 5277aea..911dab1 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -3371,6 +3371,20 @@ endif # SYSTEN_LIBGLTF ifeq ($(ENABLE_COLLADA),TRUE) +ifeq ($(SYSTEM_OPENCOLLADA),TRUE) + +define gb_LinkTarget__use_opencollada_parser +$(call gb_LinkTarget_set_include,$(1),\ + $$(INCLUDE) \ + $(OPENCOLLADA_CFLAGS) \ +) + +$(call gb_LinkTarget_add_libs,$(1),$(OPENCOLLADA_LIBS)) + +endef + +else # !SYSTEM_OPENCOLLADA + define gb_LinkTarget__use_opencollada_parser $(call gb_LinkTarget_set_include,$(1),\ -I$(call gb_UnpackedTarball_get_dir,opencollada)/COLLADABaseUtils/include \ @@ -3385,6 +3399,8 @@ $(call gb_LinkTarget_use_static_libraries,$(1),\ ) endef +endif # SYSTEM_OPENCOLLADA + define gb_LinkTarget__use_collada2gltf $(call gb_LinkTarget_set_include,$(1),\ -I$(call gb_UnpackedTarball_get_dir,collada2gltf) \ diff --git a/config_host.mk.in b/config_host.mk.in index 0fefbb0..738c80c 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -431,6 +431,8 @@ export OOOP_SAMPLES_PACK=@OOOP_SAMPLES_PACK@ export OOO_JUNIT_JAR=@OOO_JUNIT_JAR@ export OOO_VENDOR=@OOO_VENDOR@ +export OPENCOLLADA_CFLAGS=$(gb_SPACE)@OPENCOLLADA_CFLAGS@ +export OPENCOLLADA_LIBS=$(gb_SPACE)@OPENCOLLADA_LIBS@ export OPENSSL_CFLAGS=$(gb_SPACE)@OPENSSL_CFLAGS@ export OPENSSL_LIBS=$(gb_SPACE)@OPENSSL_LIBS@ export ORCUS_CFLAGS=$(gb_SPACE)@ORCUS_CFLAGS@ export ORCUS_LIBS=$(gb_SPACE)@ORCUS_LIBS@ @@ -558,4 +559,5 @@ export SYSTEM_NPAPI_HEADERS=@SYSTEM_NPAPI_HEADERS@ export SYSTEM_ODBC_HEADERS=@SYSTEM_ODBC_HEADERS@ export SYSTEM_ODFGEN=@SYSTEM_ODFGEN@ +export SYSTEM_OPENCOLLADA=@SYSTEM_OPENCOLLADA@ export SYSTEM_OPENLDAP=@SYSTEM_OPENLDAP@ export SYSTEM_OPENSSL=@SYSTEM_OPENSSL@ diff --git a/configure.ac b/configure.ac index 17feb1a..5d2198b 100644 --- a/configure.ac +++ b/configure.ac @@ -1641,6 +1641,11 @@ AC_ARG_WITH(system-ucpp, [Use ucpp already on system.]),, []) +AC_ARG_WITH(system-opencollada, + AS_HELP_STRING([--with-system-opencollada], + [Use openCOLLADA already on system.]),, + [with_system_opencollada=no]) + AC_ARG_WITH(system-openldap, AS_HELP_STRING([--with-system-openldap], [Use the OpenLDAP LDAP SDK already on system.]),, @@ -10342,11 +10347,41 @@ if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then AC_MSG_RESULT([yes]) ENABLE_COLLADA=TRUE AC_DEFINE(HAVE_FEATURE_COLLADA,1) + AC_MSG_CHECKING([which OPENCOLLADA to use]) + if test "$with_system_opencollada" = "yes"; then + AC_MSG_RESULT([external]) + SYSTEM_OPENCOLLADA=TRUE + AS_IF([test -n "$OPENCOLLADA_CFLAGS"],[],[AC_MSG_ERROR([export OPENCOLLADA_CFLAGS])]) + AS_IF([test -n "$OPENCOLLADA_LIBS"],[],[AC_MSG_ERROR([export OPENCOLLADA_LIBS])]) + AC_LANG_PUSH([C++]) + save_CXXFLAGS=$CXXFLAGS + save_CPPFLAGS=$CPPFLAGS + CXXFLAGS="$CXXFLAGS $OPENCOLLADA_CFLAGS" + CPPFLAGS="$CPPFLAGS $OPENCOLLADA_CFLAGS" + AC_CHECK_HEADERS( + COLLADABU.h \ + COLLADAFW.h \ + COLLADASaxFWLLoader.h \ + GeneratedSaxParser.h, + [], + [AC_MSG_ERROR([openCOLLADA headers not found. Install openCOLLADA])], + []) + CXXFLAGS=$save_CXXFLAGS + CPPFLAGS=$save_CPPFLAGS + AC_LANG_POP([C++]) + OPENCOLLADA_CFLAGS=$(printf '%s' "$OPENCOLLADA_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g") + else + AC_MSG_RESULT([internal]) + BUILD_TYPE="$BUILD_TYPE OPENCOLLADA" + fi BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF" else AC_MSG_RESULT([no]) fi AC_SUBST(ENABLE_COLLADA) +AC_SUBST([OPENCOLLADA_CFLAGS]) +AC_SUBST([OPENCOLLADA_LIBS]) +AC_SUBST([SYSTEM_OPENCOLLADA]) # pdf import? AC_MSG_CHECKING([whether to build the PDF import feature]) diff --git a/external/Module_external.mk b/external/Module_external.mk index c95ea20..688e335 100644 --- a/external/Module_external.mk +++ b/external/Module_external.mk @@ -75,7 +75,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\ $(call gb_Helper_optional,NEON,neon) \ $(call gb_Helper_optional,NSS,nss) \ $(call gb_Helper_optional,ODFGEN,libodfgen) \ - $(call gb_Helper_optional,COLLADA2GLTF,opencollada) \ + $(call gb_Helper_optional,OPENCOLLADA,opencollada) \ $(call gb_Helper_optional,OPENLDAP,openldap) \ $(call gb_Helper_optional,OPENSSL,openssl) \ $(call gb_Helper_optional,ORCUS,liborcus) \ -- 1.9.3