From 8441ecf6bf8aed491f2c4dc2abd7da3aeb5144e6 Mon Sep 17 00:00:00 2001 From: kimmi Date: Mon, 28 May 2012 10:19:50 +0000 Subject: [PATCH 01/12] Bugfix : Fix a compiler issue with OSX and Linux. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1250 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/ObjTools.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/ObjTools.h b/code/ObjTools.h index 61e439eb6..dfe51d328 100644 --- a/code/ObjTools.h +++ b/code/ObjTools.h @@ -222,6 +222,12 @@ inline char_t getFloat( char_t it, char_t end, float &value ) return it; } +/** @brief Will perform a simple tokenize. + * @param str String to tokenize. + * @param tokens Array with tokens, will be empty if no token was found. + * @param delimiters Delimiter for tokenize. + * @return Number of found token. + */ template unsigned int tokenize( const string_type& str, std::vector& tokens, const string_type& delimiters ) @@ -230,7 +236,7 @@ unsigned int tokenize( const string_type& str, std::vector& tokens, string_type::size_type lastPos = str.find_first_not_of( delimiters, 0 ); // Find first "non-delimiter". - string_type::size_type pos = str.find_first_of( delimiters, lastPos ); + size_t pos = str.find_first_of( delimiters, lastPos ); while ( string_type::npos != pos || string_type::npos != lastPos ) { // Found a token, add it to the vector. From 9d00c18761609cb02e667bcaa68f652f5dbb176b Mon Sep 17 00:00:00 2001 From: kimmi Date: Mon, 28 May 2012 19:20:56 +0000 Subject: [PATCH 02/12] Feature : Prepare FindPackage feature. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1251 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- AssimpBuildTreeSettings.cmake.in | 3 +++ AssimpConfig.cmake.in | 21 +++++++++++++++++++++ AssimpConfigVersion.cmake.in | 11 +++++++++++ 3 files changed, 35 insertions(+) create mode 100644 AssimpBuildTreeSettings.cmake.in create mode 100644 AssimpConfig.cmake.in create mode 100644 AssimpConfigVersion.cmake.in diff --git a/AssimpBuildTreeSettings.cmake.in b/AssimpBuildTreeSettings.cmake.in new file mode 100644 index 000000000..342da1b08 --- /dev/null +++ b/AssimpBuildTreeSettings.cmake.in @@ -0,0 +1,3 @@ +set(ASSIMP_INCLUDE_DIRS + "@PROJECT_SOURCE_DIR@" + "@PROJECT_BINARY_DIR@") diff --git a/AssimpConfig.cmake.in b/AssimpConfig.cmake.in new file mode 100644 index 000000000..d46fa8315 --- /dev/null +++ b/AssimpConfig.cmake.in @@ -0,0 +1,21 @@ +# - Config file for the FooBar package +# It defines the following variables +# FOOBAR_INCLUDE_DIRS - include directories for FooBar +# FOOBAR_LIBRARIES - libraries to link against +# FOOBAR_EXECUTABLE - the bar executable + +# Compute paths +get_filename_component(FOOBAR_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +if(EXISTS "${FOOBAR_CMAKE_DIR}/CMakeCache.txt") + # In build tree + include("${FOOBAR_CMAKE_DIR}/FooBarBuildTreeSettings.cmake") +else() + set(FOOBAR_INCLUDE_DIRS "${FOOBAR_CMAKE_DIR}/@CONF_REL_INCLUDE_DIR@") +endif() + +# Our library dependencies (contains definitions for IMPORTED targets) +include("${FOOBAR_CMAKE_DIR}/FooBarLibraryDepends.cmake") + +# These are IMPORTED targets created by FooBarLibraryDepends.cmake +set(FOOBAR_LIBRARIES foo) +set(FOOBAR_EXECUTABLE bar) diff --git a/AssimpConfigVersion.cmake.in b/AssimpConfigVersion.cmake.in new file mode 100644 index 000000000..7ffe759d5 --- /dev/null +++ b/AssimpConfigVersion.cmake.in @@ -0,0 +1,11 @@ +set(PACKAGE_VERSION "@ASSIMP_SOVERSION@") + +# Check whether the requested PACKAGE_FIND_VERSION is compatible +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() From 7384ce4005c3f4d9cd4b02255b9cd60d00bc8049 Mon Sep 17 00:00:00 2001 From: kimmi Date: Sun, 3 Jun 2012 06:10:26 +0000 Subject: [PATCH 03/12] Bugfix: Fix gcc 4.4 compilation error on r1251, thanks to Rosen Diankov for that. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1252 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/ObjTools.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/ObjTools.h b/code/ObjTools.h index dfe51d328..d40241ef0 100644 --- a/code/ObjTools.h +++ b/code/ObjTools.h @@ -230,13 +230,13 @@ inline char_t getFloat( char_t it, char_t end, float &value ) */ template unsigned int tokenize( const string_type& str, std::vector& tokens, - const string_type& delimiters ) + const string_type& delimiters ) { // Skip delimiters at beginning. - string_type::size_type lastPos = str.find_first_not_of( delimiters, 0 ); + typename string_type::size_type lastPos = str.find_first_not_of( delimiters, 0 ); // Find first "non-delimiter". - size_t pos = str.find_first_of( delimiters, lastPos ); + typename string_type::size_type pos = str.find_first_of( delimiters, lastPos ); while ( string_type::npos != pos || string_type::npos != lastPos ) { // Found a token, add it to the vector. From 5b462d484b01753026076158b0cd98a7f288dafd Mon Sep 17 00:00:00 2001 From: jonathanklein Date: Sun, 3 Jun 2012 11:06:47 +0000 Subject: [PATCH 04/12] Ogre: small tweaks git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1253 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/OgreMaterial.cpp | 4 ---- code/OgreSkeleton.cpp | 14 ++++++-------- doc/dox.h | 6 +++--- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/code/OgreMaterial.cpp b/code/OgreMaterial.cpp index 64de3a861..eab92ad48 100644 --- a/code/OgreMaterial.cpp +++ b/code/OgreMaterial.cpp @@ -51,10 +51,6 @@ to make it shorter easier to maintain. #include using namespace std; -//#include "boost/format.hpp" -//#include "boost/foreach.hpp" -//using namespace boost; - #include "OgreImporter.hpp" #include "irrXMLWrapper.h" #include "TinyFormatter.h" diff --git a/code/OgreSkeleton.cpp b/code/OgreSkeleton.cpp index c045b2d4f..567a22fb7 100644 --- a/code/OgreSkeleton.cpp +++ b/code/OgreSkeleton.cpp @@ -169,7 +169,7 @@ void OgreImporter::LoadSkeleton(std::string FileName, vector &Bones, vecto Bones[ChildId].ParentId=ParentId; Bones[ParentId].Children.push_back(ChildId); - XmlRead(SkeletonFile);//i once forget this line, which led to an endless loop, did i mentioned, that irrxml sucks?? + XmlRead(SkeletonFile);//I once forget this line, which led to an endless loop, did i mentioned, that irrxml sucks?? } //_____________________________________________________________________________ @@ -218,7 +218,7 @@ void OgreImporter::LoadSkeleton(std::string FileName, vector &Bones, vecto //loop over the attributes: - while(true) + while(true) //will quit, if a Node is not a animationkey { XmlRead(SkeletonFile); @@ -268,12 +268,9 @@ void OgreImporter::LoadSkeleton(std::string FileName, vector &Bones, vecto break; } - NewTrack.Keyframes.push_back(NewKeyframe); - //XmlRead(SkeletonFile); } - NewAnimation.Tracks.push_back(NewTrack); } @@ -295,7 +292,7 @@ void OgreImporter::CreateAssimpSkeleton(const std::vector &Bones, const st //Createt the assimp bone hierarchy vector RootBoneNodes; - BOOST_FOREACH(Bone theBone, Bones) + BOOST_FOREACH(const Bone &theBone, Bones) { if(-1==theBone.ParentId) //the bone is a root bone { @@ -304,7 +301,8 @@ void OgreImporter::CreateAssimpSkeleton(const std::vector &Bones, const st } } - if (RootBoneNodes.size()) { + if(RootBoneNodes.size() > 0) + { m_CurrentScene->mRootNode->mNumChildren=RootBoneNodes.size(); m_CurrentScene->mRootNode->mChildren=new aiNode*[RootBoneNodes.size()]; memcpy(m_CurrentScene->mRootNode->mChildren, &RootBoneNodes[0], sizeof(aiNode*)*RootBoneNodes.size()); @@ -359,7 +357,7 @@ void OgreImporter::PutAnimationsInScene(const std::vector &Bones, const st aiMatrix4x4 PoseToKey= aiMatrix4x4::Translation(Animations[i].Tracks[j].Keyframes[k].Position, t3) //pos * aiMatrix4x4(Animations[i].Tracks[j].Keyframes[k].Rotation.GetMatrix()) //rot - * aiMatrix4x4::Scaling(Animations[i].Tracks[j].Keyframes[k].Scaling, t2); //scale + * aiMatrix4x4::Scaling(Animations[i].Tracks[j].Keyframes[k].Scaling, t2); //scale //calculate the complete transformation from world space to bone space diff --git a/doc/dox.h b/doc/dox.h index 221599979..1477139e4 100644 --- a/doc/dox.h +++ b/doc/dox.h @@ -1427,11 +1427,11 @@ IFC support is new and considered experimental. Please report any bugs you may e This section contains implementations notes for the OgreXML importer. @subsection overview Overview -Ogre importer is currently optimized for the Blender Ogre exporter, because thats the only one that i use. You can find the Blender Ogre exporter at: http://www.ogre3d.org/forums/viewtopic.php?f=8&t=45922 +Ogre importer is currently optimized for the Blender Ogre exporter, because thats the only one that I use. You can find the Blender Ogre exporter at: http://www.ogre3d.org/forums/viewtopic.php?f=8&t=45922 @subsection what What will be loaded? -Mesh: Faces, Positions, Normals and one Uv pair. The Materialname will be used to load the material. +Mesh: Faces, Positions, Normals and all TexCoords. The Materialname will be used to load the material. Material: The right material in the file will be searched, the importer should work with materials who have 1 technique and 1 pass in this technique. From there, the texturename (for 1 color- and 1 normalmap) and the @@ -1477,7 +1477,7 @@ Just look in OgreImporterMaterial.cpp - Load colors in custom materials - extend custom and normal material loading - fix bone hierarchy bug -- tes everything elaboratly +- test everything elaboratly - check for non existent animation keys (what happens if a one time not all bones have a key?) */ From 29243071faeb13e6c981638cbe70bf570fd5f9ac Mon Sep 17 00:00:00 2001 From: jonathanklein Date: Sun, 3 Jun 2012 18:01:32 +0000 Subject: [PATCH 05/12] Ogre: Importerproperty to set Texture Mode from Filename (bla_n.png -> Normalmap etc.) git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1254 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/OgreImporter.cpp | 1 + code/OgreImporter.hpp | 3 +- code/OgreMaterial.cpp | 76 ++++++++++++++++++++++++++++++++++++----- doc/dox.h | 14 ++++++++ include/assimp/config.h | 13 +++++++ 5 files changed, 98 insertions(+), 9 deletions(-) diff --git a/code/OgreImporter.cpp b/code/OgreImporter.cpp index 736f200b9..e08c1776e 100644 --- a/code/OgreImporter.cpp +++ b/code/OgreImporter.cpp @@ -244,6 +244,7 @@ const aiImporterDesc* OgreImporter::GetInfo () const void OgreImporter::SetupProperties(const Importer* pImp) { m_MaterialLibFilename=pImp->GetPropertyString(AI_CONFIG_IMPORT_OGRE_MATERIAL_FILE, "Scene.material"); + m_TextureTypeFromFilename=pImp->GetPropertyBool(AI_CONFIG_IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME, false); } diff --git a/code/OgreImporter.hpp b/code/OgreImporter.hpp index 80a12f28a..20f3bc576 100644 --- a/code/OgreImporter.hpp +++ b/code/OgreImporter.hpp @@ -93,7 +93,7 @@ private: //-------------------------------- OgreMaterial.cpp ------------------------------- aiMaterial* LoadMaterial(const std::string MaterialName) const; - static void ReadTechnique(std::stringstream &ss, aiMaterial* NewMaterial); + void ReadTechnique(std::stringstream &ss, aiMaterial* NewMaterial) const; @@ -101,6 +101,7 @@ private: //Now we don't have to give theses parameters to all functions std::string m_CurrentFilename; std::string m_MaterialLibFilename; + bool m_TextureTypeFromFilename; IOSystem* m_CurrentIOHandler; aiScene *m_CurrentScene; SubMesh m_SharedGeometry;///< we will just use the vertexbuffers of the submesh diff --git a/code/OgreMaterial.cpp b/code/OgreMaterial.cpp index eab92ad48..95ca1cf42 100644 --- a/code/OgreMaterial.cpp +++ b/code/OgreMaterial.cpp @@ -276,9 +276,12 @@ aiMaterial* OgreImporter::LoadMaterial(const std::string MaterialName) const return NewMaterial; } -void OgreImporter::ReadTechnique(stringstream &ss, aiMaterial* NewMaterial) +void OgreImporter::ReadTechnique(stringstream &ss, aiMaterial* NewMaterial) const { - unsigned int CurrentTextureId=0; + unsigned int CurrentDiffuseTextureId=0; + unsigned int CurrentSpecularTextureId=0; + unsigned int CurrentNormalTextureId=0; + unsigned int CurrentLightTextureId=0; string RestOfLine; @@ -338,6 +341,11 @@ void OgreImporter::ReadTechnique(stringstream &ss, aiMaterial* NewMaterial) else if(Line=="texture_unit") { getline(ss, RestOfLine);//ignore the rest of the line + + std::string TextureName; + int TextureType=-1; + int UvSet=0; + ss >> Line; if(Line!="{") throw DeadlyImportError("empty texture unit!"); @@ -347,17 +355,39 @@ void OgreImporter::ReadTechnique(stringstream &ss, aiMaterial* NewMaterial) if(Line=="texture") { ss >> Line; - aiString ts(Line.c_str()); - NewMaterial->AddProperty(&ts, AI_MATKEY_TEXTURE(aiTextureType_DIFFUSE, CurrentTextureId)); + TextureName=Line; + + if(m_TextureTypeFromFilename) + { + if(Line.find("_n.")!=string::npos)// Normalmap + { + TextureType=aiTextureType_NORMALS; + } + else if(Line.find("_s.")!=string::npos)// Specularmap + { + TextureType=aiTextureType_SPECULAR; + } + else if(Line.find("_l.")!=string::npos)// Lightmap + { + TextureType=aiTextureType_LIGHTMAP; + } + else// colormap + { + TextureType=aiTextureType_DIFFUSE; + } + } + else + { + TextureType=aiTextureType_DIFFUSE; + } } else if(Line=="tex_coord_set") { - int UvSet; ss >> UvSet; - NewMaterial->AddProperty(&UvSet, 1, AI_MATKEY_UVWSRC(0, CurrentTextureId)); } - else if(Line=="colour_op") + else if(Line=="colour_op")//TODO implement this { + /* ss >> Line; if("replace"==Line)//I don't think, assimp has something for this... { @@ -367,11 +397,41 @@ void OgreImporter::ReadTechnique(stringstream &ss, aiMaterial* NewMaterial) //TODO: set value //NewMaterial->AddProperty(aiTextureOp_Multiply) } + */ } }//end of texture unit Line="";//clear the } that would end the outer loop - CurrentTextureId++;//new Id for the next texture + + //give the texture to assimp: + + aiString ts(TextureName.c_str()); + switch(TextureType) + { + case aiTextureType_DIFFUSE: + NewMaterial->AddProperty(&ts, AI_MATKEY_TEXTURE(aiTextureType_DIFFUSE, CurrentDiffuseTextureId)); + NewMaterial->AddProperty(&UvSet, 1, AI_MATKEY_UVWSRC(0, CurrentDiffuseTextureId)); + CurrentDiffuseTextureId++; + break; + case aiTextureType_NORMALS: + NewMaterial->AddProperty(&ts, AI_MATKEY_TEXTURE(aiTextureType_NORMALS, CurrentNormalTextureId)); + NewMaterial->AddProperty(&UvSet, 1, AI_MATKEY_UVWSRC(0, CurrentNormalTextureId)); + CurrentNormalTextureId++; + break; + case aiTextureType_SPECULAR: + NewMaterial->AddProperty(&ts, AI_MATKEY_TEXTURE(aiTextureType_SPECULAR, CurrentSpecularTextureId)); + NewMaterial->AddProperty(&UvSet, 1, AI_MATKEY_UVWSRC(0, CurrentSpecularTextureId)); + CurrentSpecularTextureId++; + break; + case aiTextureType_LIGHTMAP: + NewMaterial->AddProperty(&ts, AI_MATKEY_TEXTURE(aiTextureType_LIGHTMAP, CurrentLightTextureId)); + NewMaterial->AddProperty(&UvSet, 1, AI_MATKEY_UVWSRC(0, CurrentLightTextureId)); + CurrentLightTextureId++; + break; + default: + DefaultLogger::get()->warn("Invalid Texture Type!"); + break; + } } } Line="";//clear the } that would end the outer loop diff --git a/doc/dox.h b/doc/dox.h index 1477139e4..40db0ddad 100644 --- a/doc/dox.h +++ b/doc/dox.h @@ -1473,6 +1473,20 @@ can find in scripts/OgreImpoter/Assimp.tlp in the assimp source. If you don't se If you want more properties in custom materials, you can easily expand the ogre material loader, it will be just a few lines for each property. Just look in OgreImporterMaterial.cpp +@subsection Importer Properties +- IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME: Normally, a texture is loaded as a colormap, if no + target is specified in the + materialfile. Is this switch is enabled, texture names ending with _n, _l, _s + are used as normalmaps, lightmaps or specularmaps. +
+ Property type: Bool. Default value: false. +- IMPORT_OGRE_MATERIAL_FILE: Ogre Meshes contain only the MaterialName, not the MaterialFile. + If there + is no material file with the same name as the material, Ogre Importer will + try to load this file and search the material in it. +
+ Property type: String. Default value: guessed. + @subsection todo Todo - Load colors in custom materials - extend custom and normal material loading diff --git a/include/assimp/config.h b/include/assimp/config.h index 73e41ca2f..9c4fef0f8 100644 --- a/include/assimp/config.h +++ b/include/assimp/config.h @@ -686,6 +686,19 @@ enum aiComponent #define AI_CONFIG_IMPORT_OGRE_MATERIAL_FILE "IMPORT_OGRE_MATERIAL_FILE" +// --------------------------------------------------------------------------- +/** @brief Ogre Importer detect the texture usage from its filename + * + * Normally, a texture is loaded as a colormap, if no target is specified in the + * materialfile. Is this switch is enabled, texture names ending with _n, _l, _s + * are used as normalmaps, lightmaps or specularmaps. + *
+ * Property type: Bool. Default value: false. + */ +#define AI_CONFIG_IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME "IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME" + + + // --------------------------------------------------------------------------- /** @brief Specifies whether the IFC loader skips over IfcSpace elements. * From 97995e41f403e9963f342ee9396b2c715d3677f3 Mon Sep 17 00:00:00 2001 From: kimmi Date: Tue, 5 Jun 2012 19:30:45 +0000 Subject: [PATCH 06/12] Debian-specific adapting cmake. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1255 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- CMakeLists.txt | 26 ++++-- assimp-config.cmake.in | 74 ++++++++++++++++ cmake-modules/DebSourcePPA.cmake | 145 +++++++++++++++++++++++++------ code/CMakeLists.txt | 10 +-- 4 files changed, 213 insertions(+), 42 deletions(-) create mode 100644 assimp-config.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 0794db16a..978ed636f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,16 +4,17 @@ PROJECT( Assimp ) # Define here the needed parameters set (ASSIMP_VERSION_MAJOR 2) set (ASSIMP_VERSION_MINOR 0) -set (ASSIMP_VERSION_PATCH 0) +set (ASSIMP_VERSION_PATCH 1251) # subversion revision? set (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}) set (ASSIMP_SOVERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}) -SET ( PROJECT_VERSION "${ASSIMP_SOVERSION}" ) +SET ( PROJECT_VERSION "${ASSIMP_VERSION}" ) set(PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources") option(OPT_BUILD_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules") -set(CPACK_COMPONENTS_ALL assimp-bin libassimp${ASSIMP_VERSION_MAJOR} assimp-dev) +set(LIBASSIMP_COMPONENT libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MAJOR}-r1251) +set(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} assimp-dev) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) add_definitions(-fPIC) # this is a very important switch and some libraries seem now to have it.... @@ -48,6 +49,15 @@ SET(DEBUG_POSTFIX "D" CACHE STRING "Debug Postfitx for lib, samples and tools") CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/assimp.pc.in" "${PROJECT_BINARY_DIR}/assimp.pc" @ONLY ) INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${LIB_INSTALL_DIR}/pkgconfig/ COMPONENT assimp-dev) +# cmake configuration files +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" DESTINATION "${LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_SOVERSION}" COMPONENT assimp-dev) + +# add make uninstall capability +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) +add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") + # Allow the user to build a static library SET ( BUILD_STATIC_LIB OFF CACHE BOOL "Build a static (.a) version of the library" @@ -169,7 +179,7 @@ if(CMAKE_CPACK_COMMAND AND UNIX AND OPT_BUILD_PACKAGES) set(CPACK_PACKAGE_CONTACT "" CACHE STRING "Package maintainer and PGP signer.") set(CPACK_PACKAGE_VENDOR "http://assimp.sourceforge.net/") set(CPACK_PACKAGE_DISPLAY_NAME "Assimp ${ASSIMP_VERSION}.${ASSIMP_VERSION_MINOR}") - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY " - Open Asset Import Library") + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY " - Open Asset Import Library r1252") set(CPACK_PACKAGE_VERSION ${ASSIMP_VERSION}.${PACKAGE_VERSION}) set(CPACK_PACKAGE_VERSION_MAJOR ${ASSIMP_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${ASSIMP_VERSION_MINOR}) @@ -180,9 +190,9 @@ if(CMAKE_CPACK_COMMAND AND UNIX AND OPT_BUILD_PACKAGES) set(CPACK_COMPONENT_ASSIMP-BIN_DISPLAY_NAME "tools") set(CPACK_COMPONENT_ASSIMP-DEV_DISPLAY_NAME "common headers and installs") - set(CPACK_COMPONENT_LIBASSIMP${ASSIMP_VERSION_MAJOR}_DISPLAY_NAME "libraries") - set(CPACK_COMPONENT_ASSIMP-BIN_DEPENDS libassimp${ASSIMP_VERSION_MAJOR}) - set(CPACK_COMPONENT_ASSIMP-DEV_DEPENDS libassimp${ASSIMP_VERSION_MAJOR}) + set(CPACK_COMPONENT_${LIBASSIMP_COMPONENT}_DISPLAY_NAME "libraries") + set(CPACK_COMPONENT_ASSIMP-BIN_DEPENDS ${LIBASSIMP_COMPONENT}) + set(CPACK_COMPONENT_ASSIMP-DEV_DEPENDS ${LIBASSIMP_COMPONENT}) set(CPACK_DEBIAN_BUILD_DEPENDS debhelper cmake libboost-dev libboost-thread-dev libboost-math-dev zlib1g-dev pkg-config) # debian @@ -200,7 +210,7 @@ if(CMAKE_CPACK_COMMAND AND UNIX AND OPT_BUILD_PACKAGES) set(CPACK_DEBIAN_DISTRIBUTION_NAME ${_lsb_distribution} CACHE STRING "Name of the distrubiton") string(TOLOWER ${CPACK_DEBIAN_DISTRIBUTION_NAME} CPACK_DEBIAN_DISTRIBUTION_NAME) if( ${CPACK_DEBIAN_DISTRIBUTION_NAME} STREQUAL "ubuntu" ) - set(CPACK_DEBIAN_DISTRIBUTION_RELEASES karmic lucid maverick natty CACHE STRING "Release code-names of the distrubiton release") + set(CPACK_DEBIAN_DISTRIBUTION_RELEASES lucid maverick natty oneiric precise CACHE STRING "Release code-names of the distrubiton release") endif() set(DPUT_HOST "" CACHE STRING "PPA repository to upload the debian sources") include(CPack) diff --git a/assimp-config.cmake.in b/assimp-config.cmake.in new file mode 100644 index 000000000..936a7f2ba --- /dev/null +++ b/assimp-config.cmake.in @@ -0,0 +1,74 @@ +# - Find Assimp Installation +# +# Users can set the following variables before calling the module: +# ASSIMP_DIR - The preferred installation prefix for searching for ASSIMP. Set by the user. +# +# ASSIMP_ROOT_DIR - the root directory where the installation can be found +# ASSIMP_CXX_FLAGS - extra flags for compilation +# ASSIMP_LINK_FLAGS - extra flags for linking +# ASSIMP_INCLUDE_DIRS - include directories +# ASSIMP_LIBRARY_DIRS - link directories +# ASSIMP_LIBRARIES - libraries to link plugins with +# ASSIMP_Boost_VERSION - the boost version assimp was compiled with +get_filename_component(_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_PREFIX "${_PREFIX}" PATH) +get_filename_component(_PREFIX "${_PREFIX}" PATH) +get_filename_component(ASSIMP_ROOT_DIR "${_PREFIX}" PATH) + +if( MSVC ) + # in order to prevent DLL hell, each of the DLLs have to be suffixed with the major version and msvc prefix + if( MSVC70 OR MSVC71 ) + set(MSVC_PREFIX "vc70") + elseif( MSVC80 ) + set(MSVC_PREFIX "vc80") + elseif( MSVC90 ) + set(MSVC_PREFIX "vc90") + else() + set(MSVC_PREFIX "vc100") + endif() + set(ASSIMP_LIBRARY_SUFFIX "-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" FORCE) +else() + set(ASSIMP_LIBRARY_SUFFIX ) +endif() + +set( ASSIMP_CXX_FLAGS ) # dynamically linked library +if( WIN32 ) + # for visual studio linking, most of the time boost dlls will be used + set( ASSIMP_CXX_FLAGS " -DBOOST_ALL_DYN_LINK -DBOOST_ALL_NO_LIB") +endif() +set( ASSIMP_LINK_FLAGS "" ) +set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/lib@LIB_INSTALL_DIR@") +set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@INCLUDE_INSTALL_DIR@") +set( ASSIMP_LIBRARIES assimp) + +# the boost version assimp was compiled with +set( ASSIMP_Boost_VERSION "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@") + +if( WIN32 ) + # search for the boost version assimp was compiled with + set(Boost_USE_MULTITHREAD ON) + set(Boost_USE_STATIC_LIBS OFF) + set(Boost_USE_STATIC_RUNTIME OFF) + find_package(Boost ${ASSIMP_Boost_VERSION} EXACT COMPONENTS thread date_time) + if(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") + set( ASSIMP_INCLUDE_DIRS "${ASSIMP_INCLUDE_DIRS}" ${Boost_INCLUDE_DIRS}) + else(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") + message(WARNING "Failed to find Boost ${ASSIMP_Boost_VERSION} necessary for assimp") + endif(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") +endif( WIN32 ) + +# for compatibility wiht pkg-config +set(ASSIMP_CFLAGS_OTHER "${ASSIMP_CXX_FLAGS}") +set(ASSIMP_LDFLAGS_OTHER "${ASSIMP_LINK_FLAGS}") + +MARK_AS_ADVANCED( + ASSIMP_ROOT_DIR + ASSIMP_CXX_FLAGS + ASSIMP_LINK_FLAGS + ASSIMP_INCLUDE_DIRS + ASSIMP_LIBRARIES + ASSIMP_Boost_VERSION + ASSIMP_CFLAGS_OTHER + ASSIMP_LDFLAGS_OTHER + ASSIMP_LIBRARY_SUFFIX +) diff --git a/cmake-modules/DebSourcePPA.cmake b/cmake-modules/DebSourcePPA.cmake index 95d842535..62c645251 100644 --- a/cmake-modules/DebSourcePPA.cmake +++ b/cmake-modules/DebSourcePPA.cmake @@ -17,14 +17,17 @@ # set(CPACK_DEBIAN_BUILD_DEPENDS debhelper cmake) # set(CPACK_DEBIAN_PACKAGE_PRIORITY optional) # set(CPACK_DEBIAN_PACKAGE_SECTION devel) +# set(CPACK_DEBIAN_CMAKE_OPTIONS "-DMYOPTION=myvalue") # set(CPACK_DEBIAN_PACKAGE_DEPENDS mycomp0 mycomp1 some_ubuntu_package) -# set(CPACK_DEBIAN_PACKAGE_DEPENDS_LUCID mycomp0 mycomp1 lucid_specific_package) +# set(CPACK_DEBIAN_PACKAGE_DEPENDS_UBUNTU_LUCID mycomp0 mycomp1 lucid_specific_package) # set(CPACK_DEBIAN_PACKAGE_NAME mypackage) # set(CPACK_DEBIAN_PACKAGE_REMOVE_SOURCE_FILES unnecessary_file unnecessary_dir/file0) # set(CPACK_DEBIAN_PACKAGE_SOURCE_COPY svn export --force) # if using subversion # set(CPACK_DEBIAN_DISTRIBUTION_NAME ubuntu) # set(CPACK_DEBIAN_DISTRIBUTION_RELEASES karmic lucid maverick natty) # set(CPACK_DEBIAN_CHANGELOG " * Extra change log lines") +# set(CPACK_DEBIAN_PACKAGE_SUGGESTS "ipython") +# set(CPACK_COMPONENT_X_RECOMMENDS "recommended-package") ## find_program(DEBUILD_EXECUTABLE debuild) @@ -81,6 +84,7 @@ foreach(RELEASE ${CPACK_DEBIAN_DISTRIBUTION_RELEASES}) set(DEBIAN_SOURCE_DIR "${DEBIAN_SOURCE_ORIG_DIR}-${CPACK_DEBIAN_DISTRIBUTION_NAME}1~${RELEASE}1") set(RELEASE_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_DISTRIBUTION_NAME}1~${RELEASE}1") string(TOUPPER ${RELEASE} RELEASE_UPPER) + string(TOUPPER ${CPACK_DEBIAN_DISTRIBUTION_NAME} DISTRIBUTION_NAME_UPPER) file(MAKE_DIRECTORY ${DEBIAN_SOURCE_DIR}/debian) ############################################################################## # debian/control @@ -94,15 +98,21 @@ foreach(RELEASE ${CPACK_DEBIAN_DISTRIBUTION_RELEASES}) "Build-Depends: " ) - if( CPACK_DEBIAN_BUILD_DEPENDS_${RELEASE_UPPER} ) - foreach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS_${RELEASE_UPPER}}) + if( CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + foreach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}}) file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") - endforeach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS_${RELEASE_UPPER}}) - else( CPACK_DEBIAN_BUILD_DEPENDS_${RELEASE_UPPER} ) - foreach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS}) - file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") - endforeach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS}) - endif( CPACK_DEBIAN_BUILD_DEPENDS_${RELEASE_UPPER} ) + endforeach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}}) + else( CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + if( CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER} ) + foreach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER}}) + file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") + endforeach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER}}) + else( CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER} ) + foreach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS}) + file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") + endforeach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS}) + endif( CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER} ) + endif( CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) file(APPEND ${DEBIAN_CONTROL} "\n" @@ -111,19 +121,58 @@ foreach(RELEASE ${CPACK_DEBIAN_DISTRIBUTION_RELEASES}) "\n" "Package: ${CPACK_DEBIAN_PACKAGE_NAME}\n" "Architecture: any\n" - "Suggests: ${CPACK_DEBIAN_BUILD_SUGGESTS}\n" "Depends: " ) - if( CPACK_DEBIAN_PACKAGE_DEPENDS_${RELEASE_UPPER} ) - foreach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS_${RELEASE_UPPER}}) + if( CPACK_DEBIAN_PACKAGE_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + foreach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}}) file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") - endforeach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS_${RELEASE_UPPER}}) - else( CPACK_DEBIAN_PACKAGE_DEPENDS_${RELEASE_UPPER} ) - foreach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS}) + endforeach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}}) + else( CPACK_DEBIAN_PACKAGE_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + if( CPACK_DEBIAN_PACKAGE_DEPENDS_${DISTRIBUTION_NAME_UPPER} ) + foreach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS_${DISTRIBUTION_NAME_UPPER}}) + file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") + endforeach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS_${DISTRIBUTION_NAME_UPPER}}) + else( CPACK_DEBIAN_PACKAGE_DEPENDS_${DISTRIBUTION_NAME_UPPER} ) + foreach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS}) + file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") + endforeach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS}) + endif( CPACK_DEBIAN_PACKAGE_DEPENDS_${DISTRIBUTION_NAME_UPPER} ) + endif( CPACK_DEBIAN_PACKAGE_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + + file(APPEND ${DEBIAN_CONTROL} "\nRecommends: ") + if( CPACK_DEBIAN_PACKAGE_RECOMMENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + foreach(DEP ${CPACK_DEBIAN_PACKAGE_RECOMMENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}}) file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") - endforeach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS}) - endif( CPACK_DEBIAN_PACKAGE_DEPENDS_${RELEASE_UPPER} ) + endforeach(DEP ${CPACK_DEBIAN_PACKAGE_RECOMMENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}}) + else( CPACK_DEBIAN_PACKAGE_RECOMMENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + if( CPACK_DEBIAN_PACKAGE_RECOMMENDS_${DISTRIBUTION_NAME_UPPER} ) + foreach(DEP ${CPACK_DEBIAN_PACKAGE_RECOMMENDS_${DISTRIBUTION_NAME_UPPER}}) + file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") + endforeach(DEP ${CPACK_DEBIAN_PACKAGE_RECOMMENDS_${DISTRIBUTION_NAME_UPPER}}) + else( CPACK_DEBIAN_PACKAGE_RECOMMENDS_${DISTRIBUTION_NAME_UPPER} ) + foreach(DEP ${CPACK_DEBIAN_PACKAGE_RECOMMENDS}) + file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") + endforeach(DEP ${CPACK_DEBIAN_PACKAGE_RECOMMENDS}) + endif( CPACK_DEBIAN_PACKAGE_RECOMMENDS_${DISTRIBUTION_NAME_UPPER} ) + endif( CPACK_DEBIAN_PACKAGE_RECOMMENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + + file(APPEND ${DEBIAN_CONTROL} "\nSuggests: ") + if( CPACK_DEBIAN_PACKAGE_SUGGESTS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + foreach(DEP ${CPACK_DEBIAN_PACKAGE_SUGGESTS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}}) + file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") + endforeach(DEP ${CPACK_DEBIAN_PACKAGE_SUGGESTS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}}) + else( CPACK_DEBIAN_PACKAGE_SUGGESTS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + if( CPACK_DEBIAN_PACKAGE_SUGGESTS_${DISTRIBUTION_NAME_UPPER} ) + foreach(DEP ${CPACK_DEBIAN_PACKAGE_SUGGESTS_${DISTRIBUTION_NAME_UPPER}}) + file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") + endforeach(DEP ${CPACK_DEBIAN_PACKAGE_SUGGESTS_${DISTRIBUTION_NAME_UPPER}}) + else( CPACK_DEBIAN_PACKAGE_SUGGESTS_${DISTRIBUTION_NAME_UPPER} ) + foreach(DEP ${CPACK_DEBIAN_PACKAGE_SUGGESTS}) + file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") + endforeach(DEP ${CPACK_DEBIAN_PACKAGE_SUGGESTS}) + endif( CPACK_DEBIAN_PACKAGE_SUGGESTS_${DISTRIBUTION_NAME_UPPER} ) + endif( CPACK_DEBIAN_PACKAGE_SUGGESTS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) file(APPEND ${DEBIAN_CONTROL} "\n" "Description: ${CPACK_PACKAGE_DISPLAY_NAME} ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\n" @@ -133,20 +182,62 @@ foreach(RELEASE ${CPACK_DEBIAN_DISTRIBUTION_RELEASES}) foreach(COMPONENT ${CPACK_COMPONENTS_ALL}) string(TOUPPER ${COMPONENT} UPPER_COMPONENT) set(DEPENDS "\${shlibs:Depends}") - if( CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${RELEASE_UPPER} ) - foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${RELEASE_UPPER}}) + if( CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}}) set(DEPENDS "${DEPENDS}, ${DEP}") - endforeach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${RELEASE_UPPER}}) - else( CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${RELEASE_UPPER} ) - foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS}) - set(DEPENDS "${DEPENDS}, ${DEP}") - endforeach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS}) - endif( CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${RELEASE_UPPER} ) + endforeach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}}) + else( CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + if( CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${DISTRIBUTION_NAME_UPPER} ) + foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${DISTRIBUTION_NAME_UPPER}}) + set(DEPENDS "${DEPENDS}, ${DEP}") + endforeach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${DISTRIBUTION_NAME_UPPER}}) + else( CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${DISTRIBUTION_NAME_UPPER} ) + foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS}) + set(DEPENDS "${DEPENDS}, ${DEP}") + endforeach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS}) + endif( CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${DISTRIBUTION_NAME_UPPER} ) + endif( CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + + set(RECOMMENDS) + if( CPACK_COMPONENT_${UPPER_COMPONENT}_RECOMMENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_RECOMMENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}}) + set(RECOMMENDS "${RECOMMENDS} ${DEP}, ") + endforeach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_RECOMMENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}}) + else( CPACK_COMPONENT_${UPPER_COMPONENT}_RECOMMENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + if( CPACK_COMPONENT_${UPPER_COMPONENT}_RECOMMENDS_${DISTRIBUTION_NAME_UPPER} ) + foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_RECOMMENDS_${DISTRIBUTION_NAME_UPPER}}) + set(RECOMMENDS "${RECOMMENDS} ${DEP}, ") + endforeach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_RECOMMENDS_${DISTRIBUTION_NAME_UPPER}}) + else( CPACK_COMPONENT_${UPPER_COMPONENT}_RECOMMENDS_${DISTRIBUTION_NAME_UPPER} ) + foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_RECOMMENDS}) + set(RECOMMENDS "${RECOMMENDS} ${DEP}, ") + endforeach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_RECOMMENDS}) + endif( CPACK_COMPONENT_${UPPER_COMPONENT}_RECOMMENDS_${DISTRIBUTION_NAME_UPPER} ) + endif( CPACK_COMPONENT_${UPPER_COMPONENT}_RECOMMENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + + set(SUGGESTS) + if( CPACK_COMPONENT_${UPPER_COMPONENT}_SUGGESTS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_SUGGESTS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}}) + set(SUGGESTS "${SUGGESTS} ${DEP}, ") + endforeach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_SUGGESTS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}}) + else( CPACK_COMPONENT_${UPPER_COMPONENT}_SUGGESTS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) + if( CPACK_COMPONENT_${UPPER_COMPONENT}_SUGGESTS_${DISTRIBUTION_NAME_UPPER} ) + foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_SUGGESTS_${DISTRIBUTION_NAME_UPPER}}) + set(SUGGESTS "${SUGGESTS} ${DEP}, ") + endforeach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_SUGGESTS_${DISTRIBUTION_NAME_UPPER}}) + else( CPACK_COMPONENT_${UPPER_COMPONENT}_SUGGESTS_${DISTRIBUTION_NAME_UPPER} ) + foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_SUGGESTS}) + set(SUGGESTS "${SUGGESTS} ${DEP}, ") + endforeach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_SUGGESTS}) + endif( CPACK_COMPONENT_${UPPER_COMPONENT}_SUGGESTS_${DISTRIBUTION_NAME_UPPER} ) + endif( CPACK_COMPONENT_${UPPER_COMPONENT}_SUGGESTS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} ) file(APPEND ${DEBIAN_CONTROL} "\n" "Package: ${COMPONENT}\n" "Architecture: any\n" "Depends: ${DEPENDS}\n" + "Recommends: ${RECOMMENDS}\n" + "Suggests: ${SUGGESTS}\n" "Description: ${CPACK_PACKAGE_DISPLAY_NAME} ${CPACK_COMPONENT_${UPPER_COMPONENT}_DISPLAY_NAME}\n" "${DEB_LONG_DESCRIPTION}" " .\n" @@ -171,7 +262,7 @@ foreach(RELEASE ${CPACK_DEBIAN_DISTRIBUTION_RELEASES}) "\n" "build:\n" " mkdir $(BUILDDIR)\n" - " cd $(BUILDDIR); cmake -DCMAKE_BUILD_TYPE=Release -DBASH_COMPLETION_DIR=../etc/bash_completion.d -DCMAKE_INSTALL_PREFIX=/usr ..\n" + " cd $(BUILDDIR); cmake -DCMAKE_BUILD_TYPE=Release ${CPACK_DEBIAN_CMAKE_OPTIONS} -DCMAKE_INSTALL_PREFIX=/usr ..\n" " $(MAKE) -C $(BUILDDIR) preinstall\n" " touch build\n" "\n" @@ -233,7 +324,7 @@ foreach(RELEASE ${CPACK_DEBIAN_DISTRIBUTION_RELEASES}) set(DEBIAN_CHANGELOG ${DEBIAN_SOURCE_DIR}/debian/changelog) execute_process(COMMAND date -R OUTPUT_VARIABLE DATE_TIME) file(WRITE ${DEBIAN_CHANGELOG} - "${CPACK_DEBIAN_PACKAGE_NAME} (${RELEASE_PACKAGE_VERSION}) ${RELEASE}; urgency=low\n\n" + "${CPACK_DEBIAN_PACKAGE_NAME} (${RELEASE_PACKAGE_VERSION}) ${RELEASE}; urgency=medium\n\n" " * Package built with CMake\n\n" "${CPACK_DEBIAN_CHANGELOG}" " -- ${CPACK_PACKAGE_CONTACT} ${DATE_TIME}" diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 610873ce0..e5de6e1a7 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -1,7 +1,3 @@ -SET( LIBRARY_VERSION "2.0.0" ) -SET( LIBRARY_SOVERSION "2" ) - -# # Listing and grouping of all the source files. # 1) Set the file lists for each component # 2) Create a Source Group for each component, for IDE project orginization @@ -662,8 +658,8 @@ SET_PROPERTY(TARGET assimp PROPERTY DEBUG_POSTFIX ${DEBUG_POSTFIX}) TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES}) SET_TARGET_PROPERTIES( assimp PROPERTIES - VERSION ${LIBRARY_VERSION} - SOVERSION ${LIBRARY_SOVERSION} + VERSION ${ASSIMP_VERSION} + SOVERSION ${ASSIMP_VERSION} # use full version ) # Build against external unzip, or add ../contrib/unzip so # assimp can #include "unzip.h" @@ -674,6 +670,6 @@ else (UNZIP_FOUND) INCLUDE_DIRECTORIES("../contrib/unzip") endif (UNZIP_FOUND) -INSTALL( TARGETS assimp DESTINATION ${LIB_INSTALL_DIR} COMPONENT libassimp${ASSIMP_VERSION_MAJOR}) +INSTALL( TARGETS assimp DESTINATION ${LIB_INSTALL_DIR} COMPONENT ${LIBASSIMP_COMPONENT}) INSTALL( FILES ${PUBLIC_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/assimp COMPONENT assimp-dev) INSTALL( FILES ${COMPILER_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/assimp/Compiler COMPONENT assimp-dev) From 526150a8e3f46b8e6fbe9f596acb4d48b5a69532 Mon Sep 17 00:00:00 2001 From: kimmi Date: Mon, 11 Jun 2012 11:49:08 +0000 Subject: [PATCH 07/12] Update: Debian-related cmake changes ( I changed the revision to 1256 instead of 1251 ). git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1256 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- CMakeLists.txt | 6 +++--- cmake-modules/cmake_uninstall.cmake.in | 17 +++++++++++++++++ code/CMakeLists.txt | 2 +- 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 cmake-modules/cmake_uninstall.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 978ed636f..f5036667b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,14 +6,14 @@ set (ASSIMP_VERSION_MAJOR 2) set (ASSIMP_VERSION_MINOR 0) set (ASSIMP_VERSION_PATCH 1251) # subversion revision? set (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}) -set (ASSIMP_SOVERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}) +set (ASSIMP_SOVERSION 1251) SET ( PROJECT_VERSION "${ASSIMP_VERSION}" ) set(PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources") option(OPT_BUILD_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules") -set(LIBASSIMP_COMPONENT libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MAJOR}-r1251) +set(LIBASSIMP_COMPONENT libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MAJOR}-r1256) set(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} assimp-dev) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) @@ -52,7 +52,7 @@ INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${LIB_INSTALL_DIR}/ # cmake configuration files configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" DESTINATION "${LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_SOVERSION}" COMPONENT assimp-dev) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" DESTINATION "${LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT assimp-dev) # add make uninstall capability configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) diff --git a/cmake-modules/cmake_uninstall.cmake.in b/cmake-modules/cmake_uninstall.cmake.in new file mode 100644 index 000000000..167011595 --- /dev/null +++ b/cmake-modules/cmake_uninstall.cmake.in @@ -0,0 +1,17 @@ +IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") +FOREACH(file ${files}) + MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF(NOT "${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + ENDIF(NOT "${rm_retval}" STREQUAL 0) +ENDFOREACH(file) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index e5de6e1a7..d21f2995b 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -659,7 +659,7 @@ SET_PROPERTY(TARGET assimp PROPERTY DEBUG_POSTFIX ${DEBUG_POSTFIX}) TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES}) SET_TARGET_PROPERTIES( assimp PROPERTIES VERSION ${ASSIMP_VERSION} - SOVERSION ${ASSIMP_VERSION} # use full version + SOVERSION ${ASSIMP_SOVERSION} # use full version ) # Build against external unzip, or add ../contrib/unzip so # assimp can #include "unzip.h" From 48e2132f380752b18771ecf9da4656a278c1f3b1 Mon Sep 17 00:00:00 2001 From: kimmi Date: Fri, 15 Jun 2012 19:36:24 +0000 Subject: [PATCH 08/12] Bugfix: Add a missing CMake-config file. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1257 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- assimp-config-version.cmake.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 assimp-config-version.cmake.in diff --git a/assimp-config-version.cmake.in b/assimp-config-version.cmake.in new file mode 100644 index 000000000..9a8789f34 --- /dev/null +++ b/assimp-config-version.cmake.in @@ -0,0 +1,12 @@ +set( PACKAGE_VERSION "@ASSIMP_VERSION@" ) +if( "${PACKAGE_FIND_VERSION}" VERSION_EQUAL "@ASSIMP_VERSION@") + set(PACKAGE_VERSION_EXACT 1) +endif() +if( "${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}" EQUAL "@ASSIMP_SOVERSION@" ) + set(PACKAGE_VERSION_COMPATIBLE 1) +elseif( "${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@ASSIMP_VERSION_MAJOR@" ) + # for now backward compatible if minor version is less + if( ${PACKAGE_FIND_VERSION_MINOR} LESS @ASSIMP_VERSION_MINOR@ ) + set(PACKAGE_VERSION_COMPATIBLE 1) + endif() +endif() From 1d7018c8268861148d4f306eac2628f76fb28c21 Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Sun, 17 Jun 2012 12:15:49 +0000 Subject: [PATCH 09/12] # fix bug in STEPFileReader, loader fails if string literals contain more than one ". Thanks to Juha Vesanen for the patch. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1258 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/STEPFileReader.cpp | 24 ++++++++++++++++-------- revision.h | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/code/STEPFileReader.cpp b/code/STEPFileReader.cpp index 7ddfd91c3..66e08fcb5 100644 --- a/code/STEPFileReader.cpp +++ b/code/STEPFileReader.cpp @@ -318,20 +318,28 @@ boost::shared_ptr EXPRESS::DataType::Parse(const char*& else if (*cur == '\'' ) { // string literal const char* start = ++cur; - for(;*cur != '\'';++cur) { - if (*cur == '\0') { + + for(;*cur != '\'';++cur) { + if (*cur == '\0') { throw STEP::SyntaxError("string literal not closed",line); } } - if (cur[1]=='\'') { - for(cur+=2;*cur != '\'';++cur) { - if (*cur == '\0') { - throw STEP::SyntaxError("string literal not closed",line); + + if (cur[1] == '\'') { + // Vesanen: more than 2 escaped ' in one literal! + do { + for(cur += 2;*cur != '\'';++cur) { + if (*cur == '\0') { + throw STEP::SyntaxError("string literal not closed",line); + } } } + while(cur[1] == '\''); } - inout = cur+1; - return boost::make_shared(std::string(start, static_cast(cur-start) )); + + inout = cur + 1; + + return boost::make_shared(std::string(start, static_cast(cur - start))); } else if (*cur == '\"' ) { throw STEP::SyntaxError("binary data not supported yet",line); diff --git a/revision.h b/revision.h index f55c0cc89..03665b4ba 100644 --- a/revision.h +++ b/revision.h @@ -1 +1 @@ -#define SVNRevision 1154 +#define SVNRevision 1257 From 141104f3f50cfa11976d9d9122df64b42ce20004 Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Sun, 17 Jun 2012 12:18:37 +0000 Subject: [PATCH 10/12] - start linklist for good IFC test file sources. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1259 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- test/models-nonbsd/IFC/linklist.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 test/models-nonbsd/IFC/linklist.txt diff --git a/test/models-nonbsd/IFC/linklist.txt b/test/models-nonbsd/IFC/linklist.txt new file mode 100644 index 000000000..041435c50 --- /dev/null +++ b/test/models-nonbsd/IFC/linklist.txt @@ -0,0 +1,4 @@ +Good IFC test cases +=================== + +http://www.iai.fzk.de/www-extern/index.php?id=1135 \ No newline at end of file From eb3fd360f416535180ab9a468a3eb7c389ae9d60 Mon Sep 17 00:00:00 2001 From: kimmi Date: Mon, 18 Jun 2012 19:33:17 +0000 Subject: [PATCH 11/12] - Bugfix : Fix invalid variable ASSIMP_LIBRARY_DIRS. - Update : Introduce a subversion-revision variable for the right patch version. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1260 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- CMakeLists.txt | 5 +++-- assimp-config.cmake.in | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5036667b..2aecdbb72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,9 +2,10 @@ cmake_minimum_required( VERSION 2.6 ) PROJECT( Assimp ) # Define here the needed parameters +set (ASSIMP_SV_REVISION 1260) set (ASSIMP_VERSION_MAJOR 2) set (ASSIMP_VERSION_MINOR 0) -set (ASSIMP_VERSION_PATCH 1251) # subversion revision? +set (ASSIMP_VERSION_PATCH ${ASSIMP_SV_REVISION}) # subversion revision? set (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}) set (ASSIMP_SOVERSION 1251) SET ( PROJECT_VERSION "${ASSIMP_VERSION}" ) @@ -13,7 +14,7 @@ set(PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uplo option(OPT_BUILD_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules") -set(LIBASSIMP_COMPONENT libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MAJOR}-r1256) +set(LIBASSIMP_COMPONENT libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MAJOR}-r${ASSIMP_SV_REVISION}) set(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} assimp-dev) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) diff --git a/assimp-config.cmake.in b/assimp-config.cmake.in index 936a7f2ba..853cc06fd 100644 --- a/assimp-config.cmake.in +++ b/assimp-config.cmake.in @@ -37,7 +37,7 @@ if( WIN32 ) set( ASSIMP_CXX_FLAGS " -DBOOST_ALL_DYN_LINK -DBOOST_ALL_NO_LIB") endif() set( ASSIMP_LINK_FLAGS "" ) -set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/lib@LIB_INSTALL_DIR@") +set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@LIB_INSTALL_DIR@") set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@INCLUDE_INSTALL_DIR@") set( ASSIMP_LIBRARIES assimp) From 4413006cbf451271936a4ade902409c481719629 Mon Sep 17 00:00:00 2001 From: kimmi Date: Mon, 18 Jun 2012 21:31:59 +0000 Subject: [PATCH 12/12] update revision git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1261 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- revision.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revision.h b/revision.h index 03665b4ba..500b490c6 100644 --- a/revision.h +++ b/revision.h @@ -1 +1 @@ -#define SVNRevision 1257 +#define SVNRevision 1261