Re: [CrystalSpace] #996: assimpldr.cpp compile error on Fedora 18
"CrystalSpace" <[email protected]> Sun, 04 Aug 2013 11:28:25 -0000
| Newsgroups | gmane.comp.graphics.crystalspace.tracker |
|---|---|
| Message-ID | <[email protected]> |
#996: assimpldr.cpp compile error on Fedora 18
----------------------------+-----------------------------------------------
Reporter: ralphcampbell | Owner: admin
Type: defect | Status: closed
Priority: minor | Milestone:
Component: other plugins | Version: V2.1
Resolution: fixed | Keywords:
----------------------------+-----------------------------------------------
Changes (by sunshine):
* status: new => closed
* resolution: => fixed
Comment:
I rewrote `assimp` detection in `configure.ac` to be feature- rather than
version-based and committed it as r39555:39556. I'm closing this ticket as
''fixed'' in the hope that it resolves the issue for you, but please do
report here if the changes work for you. If not, we can re-open the
ticket. Below is the diff of what I committed.
{{{
#!diff
diff --git a/configure.ac b/configure.ac
index 81afcce..05374ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1967,52 +1967,53 @@ CS_NOTABLE([alsa], [audio], [unix],
[$cs_cv_libasound],
#------------------------------------------------------------------------------
-# Check for Open Asset Import Library (Assimp). Also check whether this
is the
-# version 2.0 or 3.0/above that is being used, the header files to be
included
-# not being the same.
-#------------------------------------------------------------------------------
-CS_CHECK_LIB_WITH([assimp],
- [AC_LANG_PROGRAM(
- [[]],
- [])],
- [], [C++],
- [CS_CHECK_BUILD([for Assimp v3], [cs_cv_assimp3],
+# Check for Open Asset Import Library (assimp). Versions 2 & 3 are
supported.
+#
+# This check is complicated by the fact that the name of headers and
constants
+# change incompatibly between versions. For instance, version 2 uses .h
+# extension for headers, but version 3 uses .hpp. Version 2 has constants
named
+# Assimp::Loger::FOO, but version 3 has Assimp::Logger:Foo. Worse, some
+# distros seem to ship a mishmash of the two versions. For instance, in
Fedora
+# 18, package assimp-devel.x86_64 claims version 2.0.863, and the header
+# extensions are indeed .h, but the constants are from v3
(Assimp::Logger:Foo).
+#------------------------------------------------------------------------------
+CS_CHECK_LIB_WITH([assimp], [AC_LANG_PROGRAM([], [])], [], [C++], [], [],
+ [$cs_cv_libz_cflags], [$cs_cv_libz_lflags], [$cs_cv_libz_libs])
+
+AS_IF([test $cs_cv_libassimp = yes],
+ [CS_CHECK_BUILD([if assimp uses .hpp headers],
[cs_cv_assimp_hpp_headers],
+ [AC_LANG_PROGRAM([[#include <assimp/Logger.hpp>]], [])], [],
[C++],
+ [CS_HEADER_PROPERTY([CS_ASSIMP_HPP_HEADERS])
+ cs_assimp_header_ext=.hpp], [cs_assimp_header_ext=.h], [],
+ [$cs_cv_libassimp_cflags],
+ [$cs_cv_libassimp_lflags],
+ [$cs_cv_libassimp_libs])])
+
+AS_IF([test $cs_cv_libassimp = yes],
+ [CS_CHECK_BUILD([if assimp is sufficiently recent],
[cs_cv_assimp_recent],
[AC_LANG_PROGRAM(
- [[#include <assimp/Logger.hpp>]],
- [])],
- [], [C++],
- [CS_HEADER_PROPERTY([CS_ASSIMP_VERSION], [3])],
- [CS_CHECK_BUILD([for Assimp v2], [cs_cv_assimp2],
- [AC_LANG_PROGRAM(
- [[#include <assimp/ProgressHandler.h>]],
- [])],
- [], [C++],
- [CS_HEADER_PROPERTY([CS_ASSIMP_VERSION], [2])],
- [unset cs_cv_libassimp], [],
- [$cs_cv_libassimp_cflags $cs_cv_libz_cflags],
- [$cs_cv_libassimp_lflags $cs_cv_libz_lflags],
- [$cs_cv_libassimp_libs $cs_cv_libz_libs])],
- [],
- [$cs_cv_libassimp_cflags $cs_cv_libz_cflags],
- [$cs_cv_libassimp_lflags $cs_cv_libz_lflags],
- [$cs_cv_libassimp_libs $cs_cv_libz_libs])],
- [],
- [$cs_cv_libz_cflags],
- [$cs_cv_libz_lflags],
- [$cs_cv_libz_libs])
-
-unset cs_cv_assimp2
-unset cs_cv_assimp2_cflags
-unset cs_cv_assimp2_lflags
-unset cs_cv_assimp2_libs
-unset cs_cv_assimp3
-unset cs_cv_assimp3_cflags
-unset cs_cv_assimp3_lflags
-unset cs_cv_assimp3_libs
+ [[#include <assimp/ProgressHandler$cs_assimp_header_ext>]],
[])],
+ [], [C++],
+ [CS_EMIT_BUILD_RESULT([cs_cv_libassimp], [ASSIMP])],
+ [cs_cv_libassimp=no], [],
+ [$cs_cv_libassimp_cflags],
+ [$cs_cv_libassimp_lflags],
+ [$cs_cv_libassimp_libs])])
+
+AS_IF([test $cs_cv_libassimp = yes],
+ [CS_CHECK_BUILD([for uppercase Assimp::Logger constants],
+ [cs_cv_assimp_logger_uppercase],
+ [AC_LANG_PROGRAM(
+ [[#include <assimp/Logger$cs_assimp_header_ext>]],
+ [Assimp::Logger::ERR])],
+ [], [C++],
+ [CS_HEADER_PROPERTY([CS_ASSIMP_LOGGER_UPPERCASE])], [], [],
+ [$cs_cv_libassimp_cflags],
+ [$cs_cv_libassimp_lflags],
+ [$cs_cv_libassimp_libs])])
CS_NOTABLE([assimp], [models], [], [$cs_cv_libassimp])
-AS_IF([test "$cs_cv_libassimp" = yes],
- CS_EMIT_BUILD_RESULT([cs_cv_libassimp], [ASSIMP]))
+
#------------------------------------------------------------------------------
diff --git a/plugins/mesh/persist/assimpldr/assimpldr.cpp
b/plugins/mesh/persist/assimpldr/assimpldr.cpp
index dfe4512..2bb7827 100644
--- a/plugins/mesh/persist/assimpldr/assimpldr.cpp
+++ b/plugins/mesh/persist/assimpldr/assimpldr.cpp
@@ -49,7 +49,7 @@
#include "assimpldr.h"
// The name of those values is different from Assimp 2.0 and above
versions
-#if (CS_ASSIMP_VERSION == 2)
+#ifdef CS_ASSIMP_LOGGER_UPPERCASE
#define LOGGER_ERROR Assimp::Logger::ERR
#define LOGGER_WARNING Assimp::Logger::WARN
#define LOGGER_NOTIFY Assimp::Logger::INFO
diff --git a/plugins/mesh/persist/assimpldr/assimpldr.h
b/plugins/mesh/persist/assimpldr/assimpldr.h
index 36ea389..311d089 100644
--- a/plugins/mesh/persist/assimpldr/assimpldr.h
+++ b/plugins/mesh/persist/assimpldr/assimpldr.h
@@ -35,7 +35,7 @@
// The header files to be included are not the same between Assimp 2.0
and
// above versions
-#if (CS_ASSIMP_VERSION == 2)
+#ifndef CS_ASSIMP_HPP_HEADERS
#include "assimp/assimp.hpp"
#include "assimp/aiScene.h"
#include "assimp/aiPostProcess.h"
}}}
--
Ticket URL: <http://trac.crystalspace3d.org/trac/CS/ticket/996#comment:10>
CrystalSpace <http://www.crystalspace3d.org/>
Free open-source 3D SDK.
------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk