pull/14/head
Alexander Gessler 2012-06-21 17:15:14 +02:00
commit 43e19c682f
19 changed files with 416 additions and 79 deletions

View File

@ -0,0 +1,3 @@
set(ASSIMP_INCLUDE_DIRS
"@PROJECT_SOURCE_DIR@"
"@PROJECT_BINARY_DIR@")

View File

@ -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)

View File

@ -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()

View File

@ -2,18 +2,20 @@ cmake_minimum_required( VERSION 2.6 )
PROJECT( Assimp ) PROJECT( Assimp )
# Define here the needed parameters # Define here the needed parameters
set (ASSIMP_SV_REVISION 1260)
set (ASSIMP_VERSION_MAJOR 2) set (ASSIMP_VERSION_MAJOR 2)
set (ASSIMP_VERSION_MINOR 0) set (ASSIMP_VERSION_MINOR 0)
set (ASSIMP_VERSION_PATCH 0) set (ASSIMP_VERSION_PATCH ${ASSIMP_SV_REVISION}) # subversion revision?
set (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}) 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_SOVERSION}" ) SET ( PROJECT_VERSION "${ASSIMP_VERSION}" )
set(PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources") 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) 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(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}-r${ASSIMP_SV_REVISION})
set(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} assimp-dev)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) 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.... add_definitions(-fPIC) # this is a very important switch and some libraries seem now to have it....
@ -48,6 +50,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 ) 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) 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_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)
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
# Allow the user to build a static library # Allow the user to build a static library
SET ( BUILD_STATIC_LIB OFF CACHE BOOL SET ( BUILD_STATIC_LIB OFF CACHE BOOL
"Build a static (.a) version of the library" "Build a static (.a) version of the library"
@ -169,7 +180,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_CONTACT "" CACHE STRING "Package maintainer and PGP signer.")
set(CPACK_PACKAGE_VENDOR "http://assimp.sourceforge.net/") set(CPACK_PACKAGE_VENDOR "http://assimp.sourceforge.net/")
set(CPACK_PACKAGE_DISPLAY_NAME "Assimp ${ASSIMP_VERSION}.${ASSIMP_VERSION_MINOR}") 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 ${ASSIMP_VERSION}.${PACKAGE_VERSION})
set(CPACK_PACKAGE_VERSION_MAJOR ${ASSIMP_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MAJOR ${ASSIMP_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${ASSIMP_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_MINOR ${ASSIMP_VERSION_MINOR})
@ -180,9 +191,9 @@ if(CMAKE_CPACK_COMMAND AND UNIX AND OPT_BUILD_PACKAGES)
set(CPACK_COMPONENT_ASSIMP-BIN_DISPLAY_NAME "tools") set(CPACK_COMPONENT_ASSIMP-BIN_DISPLAY_NAME "tools")
set(CPACK_COMPONENT_ASSIMP-DEV_DISPLAY_NAME "common headers and installs") set(CPACK_COMPONENT_ASSIMP-DEV_DISPLAY_NAME "common headers and installs")
set(CPACK_COMPONENT_LIBASSIMP${ASSIMP_VERSION_MAJOR}_DISPLAY_NAME "libraries") set(CPACK_COMPONENT_${LIBASSIMP_COMPONENT}_DISPLAY_NAME "libraries")
set(CPACK_COMPONENT_ASSIMP-BIN_DEPENDS libassimp${ASSIMP_VERSION_MAJOR}) set(CPACK_COMPONENT_ASSIMP-BIN_DEPENDS ${LIBASSIMP_COMPONENT})
set(CPACK_COMPONENT_ASSIMP-DEV_DEPENDS libassimp${ASSIMP_VERSION_MAJOR}) 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) set(CPACK_DEBIAN_BUILD_DEPENDS debhelper cmake libboost-dev libboost-thread-dev libboost-math-dev zlib1g-dev pkg-config)
# debian # debian
@ -200,7 +211,7 @@ if(CMAKE_CPACK_COMMAND AND UNIX AND OPT_BUILD_PACKAGES)
set(CPACK_DEBIAN_DISTRIBUTION_NAME ${_lsb_distribution} CACHE STRING "Name of the distrubiton") set(CPACK_DEBIAN_DISTRIBUTION_NAME ${_lsb_distribution} CACHE STRING "Name of the distrubiton")
string(TOLOWER ${CPACK_DEBIAN_DISTRIBUTION_NAME} CPACK_DEBIAN_DISTRIBUTION_NAME) string(TOLOWER ${CPACK_DEBIAN_DISTRIBUTION_NAME} CPACK_DEBIAN_DISTRIBUTION_NAME)
if( ${CPACK_DEBIAN_DISTRIBUTION_NAME} STREQUAL "ubuntu" ) 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() endif()
set(DPUT_HOST "" CACHE STRING "PPA repository to upload the debian sources") set(DPUT_HOST "" CACHE STRING "PPA repository to upload the debian sources")
include(CPack) include(CPack)

View File

@ -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()

View File

@ -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_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
)

View File

@ -17,14 +17,17 @@
# set(CPACK_DEBIAN_BUILD_DEPENDS debhelper cmake) # set(CPACK_DEBIAN_BUILD_DEPENDS debhelper cmake)
# set(CPACK_DEBIAN_PACKAGE_PRIORITY optional) # set(CPACK_DEBIAN_PACKAGE_PRIORITY optional)
# set(CPACK_DEBIAN_PACKAGE_SECTION devel) # 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 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_NAME mypackage)
# set(CPACK_DEBIAN_PACKAGE_REMOVE_SOURCE_FILES unnecessary_file unnecessary_dir/file0) # 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_PACKAGE_SOURCE_COPY svn export --force) # if using subversion
# set(CPACK_DEBIAN_DISTRIBUTION_NAME ubuntu) # set(CPACK_DEBIAN_DISTRIBUTION_NAME ubuntu)
# set(CPACK_DEBIAN_DISTRIBUTION_RELEASES karmic lucid maverick natty) # set(CPACK_DEBIAN_DISTRIBUTION_RELEASES karmic lucid maverick natty)
# set(CPACK_DEBIAN_CHANGELOG " * Extra change log lines") # 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) 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(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") set(RELEASE_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_DISTRIBUTION_NAME}1~${RELEASE}1")
string(TOUPPER ${RELEASE} RELEASE_UPPER) string(TOUPPER ${RELEASE} RELEASE_UPPER)
string(TOUPPER ${CPACK_DEBIAN_DISTRIBUTION_NAME} DISTRIBUTION_NAME_UPPER)
file(MAKE_DIRECTORY ${DEBIAN_SOURCE_DIR}/debian) file(MAKE_DIRECTORY ${DEBIAN_SOURCE_DIR}/debian)
############################################################################## ##############################################################################
# debian/control # debian/control
@ -94,15 +98,21 @@ foreach(RELEASE ${CPACK_DEBIAN_DISTRIBUTION_RELEASES})
"Build-Depends: " "Build-Depends: "
) )
if( CPACK_DEBIAN_BUILD_DEPENDS_${RELEASE_UPPER} ) if( CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} )
foreach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS_${RELEASE_UPPER}}) foreach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}})
file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") file(APPEND ${DEBIAN_CONTROL} "${DEP}, ")
endforeach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS_${RELEASE_UPPER}}) endforeach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}})
else( CPACK_DEBIAN_BUILD_DEPENDS_${RELEASE_UPPER} ) else( CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} )
foreach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS}) if( CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER} )
file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") foreach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS_${DISTRIBUTION_NAME_UPPER}})
endforeach(DEP ${CPACK_DEBIAN_BUILD_DEPENDS}) file(APPEND ${DEBIAN_CONTROL} "${DEP}, ")
endif( CPACK_DEBIAN_BUILD_DEPENDS_${RELEASE_UPPER} ) 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" file(APPEND ${DEBIAN_CONTROL} "\n"
@ -111,19 +121,58 @@ foreach(RELEASE ${CPACK_DEBIAN_DISTRIBUTION_RELEASES})
"\n" "\n"
"Package: ${CPACK_DEBIAN_PACKAGE_NAME}\n" "Package: ${CPACK_DEBIAN_PACKAGE_NAME}\n"
"Architecture: any\n" "Architecture: any\n"
"Suggests: ${CPACK_DEBIAN_BUILD_SUGGESTS}\n"
"Depends: " "Depends: "
) )
if( CPACK_DEBIAN_PACKAGE_DEPENDS_${RELEASE_UPPER} ) if( CPACK_DEBIAN_PACKAGE_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} )
foreach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS_${RELEASE_UPPER}}) foreach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}})
file(APPEND ${DEBIAN_CONTROL} "${DEP}, ") file(APPEND ${DEBIAN_CONTROL} "${DEP}, ")
endforeach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS_${RELEASE_UPPER}}) endforeach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}})
else( CPACK_DEBIAN_PACKAGE_DEPENDS_${RELEASE_UPPER} ) else( CPACK_DEBIAN_PACKAGE_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} )
foreach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS}) 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}, ") file(APPEND ${DEBIAN_CONTROL} "${DEP}, ")
endforeach(DEP ${CPACK_DEBIAN_PACKAGE_DEPENDS}) endforeach(DEP ${CPACK_DEBIAN_PACKAGE_RECOMMENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}})
endif( CPACK_DEBIAN_PACKAGE_DEPENDS_${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" file(APPEND ${DEBIAN_CONTROL} "\n"
"Description: ${CPACK_PACKAGE_DISPLAY_NAME} ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\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}) foreach(COMPONENT ${CPACK_COMPONENTS_ALL})
string(TOUPPER ${COMPONENT} UPPER_COMPONENT) string(TOUPPER ${COMPONENT} UPPER_COMPONENT)
set(DEPENDS "\${shlibs:Depends}") set(DEPENDS "\${shlibs:Depends}")
if( 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_${RELEASE_UPPER}}) foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER}})
set(DEPENDS "${DEPENDS}, ${DEP}") set(DEPENDS "${DEPENDS}, ${DEP}")
endforeach(DEP ${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_${RELEASE_UPPER} ) else( CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${DISTRIBUTION_NAME_UPPER}_${RELEASE_UPPER} )
foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS}) if( CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${DISTRIBUTION_NAME_UPPER} )
set(DEPENDS "${DEPENDS}, ${DEP}") foreach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${DISTRIBUTION_NAME_UPPER}})
endforeach(DEP ${CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS}) set(DEPENDS "${DEPENDS}, ${DEP}")
endif( CPACK_COMPONENT_${UPPER_COMPONENT}_DEPENDS_${RELEASE_UPPER} ) 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" file(APPEND ${DEBIAN_CONTROL} "\n"
"Package: ${COMPONENT}\n" "Package: ${COMPONENT}\n"
"Architecture: any\n" "Architecture: any\n"
"Depends: ${DEPENDS}\n" "Depends: ${DEPENDS}\n"
"Recommends: ${RECOMMENDS}\n"
"Suggests: ${SUGGESTS}\n"
"Description: ${CPACK_PACKAGE_DISPLAY_NAME} ${CPACK_COMPONENT_${UPPER_COMPONENT}_DISPLAY_NAME}\n" "Description: ${CPACK_PACKAGE_DISPLAY_NAME} ${CPACK_COMPONENT_${UPPER_COMPONENT}_DISPLAY_NAME}\n"
"${DEB_LONG_DESCRIPTION}" "${DEB_LONG_DESCRIPTION}"
" .\n" " .\n"
@ -171,7 +262,7 @@ foreach(RELEASE ${CPACK_DEBIAN_DISTRIBUTION_RELEASES})
"\n" "\n"
"build:\n" "build:\n"
" mkdir $(BUILDDIR)\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" " $(MAKE) -C $(BUILDDIR) preinstall\n"
" touch build\n" " touch build\n"
"\n" "\n"
@ -233,7 +324,7 @@ foreach(RELEASE ${CPACK_DEBIAN_DISTRIBUTION_RELEASES})
set(DEBIAN_CHANGELOG ${DEBIAN_SOURCE_DIR}/debian/changelog) set(DEBIAN_CHANGELOG ${DEBIAN_SOURCE_DIR}/debian/changelog)
execute_process(COMMAND date -R OUTPUT_VARIABLE DATE_TIME) execute_process(COMMAND date -R OUTPUT_VARIABLE DATE_TIME)
file(WRITE ${DEBIAN_CHANGELOG} 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" " * Package built with CMake\n\n"
"${CPACK_DEBIAN_CHANGELOG}" "${CPACK_DEBIAN_CHANGELOG}"
" -- ${CPACK_PACKAGE_CONTACT} ${DATE_TIME}" " -- ${CPACK_PACKAGE_CONTACT} ${DATE_TIME}"

View File

@ -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)

View File

@ -1,7 +1,3 @@
SET( LIBRARY_VERSION "2.0.0" )
SET( LIBRARY_SOVERSION "2" )
#
# Listing and grouping of all the source files. # Listing and grouping of all the source files.
# 1) Set the file lists for each component # 1) Set the file lists for each component
# 2) Create a Source Group for each component, for IDE project orginization # 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}) TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES})
SET_TARGET_PROPERTIES( assimp PROPERTIES SET_TARGET_PROPERTIES( assimp PROPERTIES
VERSION ${LIBRARY_VERSION} VERSION ${ASSIMP_VERSION}
SOVERSION ${LIBRARY_SOVERSION} SOVERSION ${ASSIMP_SOVERSION} # use full version
) )
# Build against external unzip, or add ../contrib/unzip so # Build against external unzip, or add ../contrib/unzip so
# assimp can #include "unzip.h" # assimp can #include "unzip.h"
@ -674,6 +670,6 @@ else (UNZIP_FOUND)
INCLUDE_DIRECTORIES("../contrib/unzip") INCLUDE_DIRECTORIES("../contrib/unzip")
endif (UNZIP_FOUND) 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 ${PUBLIC_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/assimp COMPONENT assimp-dev)
INSTALL( FILES ${COMPILER_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/assimp/Compiler COMPONENT assimp-dev) INSTALL( FILES ${COMPILER_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/assimp/Compiler COMPONENT assimp-dev)

View File

@ -222,15 +222,21 @@ inline char_t getFloat( char_t it, char_t end, float &value )
return it; 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<class string_type> template<class string_type>
unsigned int tokenize( const string_type& str, std::vector<string_type>& tokens, unsigned int tokenize( const string_type& str, std::vector<string_type>& tokens,
const string_type& delimiters ) const string_type& delimiters )
{ {
// Skip delimiters at beginning. // 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". // Find first "non-delimiter".
string_type::size_type 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 ) while ( string_type::npos != pos || string_type::npos != lastPos )
{ {
// Found a token, add it to the vector. // Found a token, add it to the vector.

View File

@ -244,6 +244,7 @@ const aiImporterDesc* OgreImporter::GetInfo () const
void OgreImporter::SetupProperties(const Importer* pImp) void OgreImporter::SetupProperties(const Importer* pImp)
{ {
m_MaterialLibFilename=pImp->GetPropertyString(AI_CONFIG_IMPORT_OGRE_MATERIAL_FILE, "Scene.material"); m_MaterialLibFilename=pImp->GetPropertyString(AI_CONFIG_IMPORT_OGRE_MATERIAL_FILE, "Scene.material");
m_TextureTypeFromFilename=pImp->GetPropertyBool(AI_CONFIG_IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME, false);
} }

View File

@ -93,7 +93,7 @@ private:
//-------------------------------- OgreMaterial.cpp ------------------------------- //-------------------------------- OgreMaterial.cpp -------------------------------
aiMaterial* LoadMaterial(const std::string MaterialName) const; 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 //Now we don't have to give theses parameters to all functions
std::string m_CurrentFilename; std::string m_CurrentFilename;
std::string m_MaterialLibFilename; std::string m_MaterialLibFilename;
bool m_TextureTypeFromFilename;
IOSystem* m_CurrentIOHandler; IOSystem* m_CurrentIOHandler;
aiScene *m_CurrentScene; aiScene *m_CurrentScene;
SubMesh m_SharedGeometry;///< we will just use the vertexbuffers of the submesh SubMesh m_SharedGeometry;///< we will just use the vertexbuffers of the submesh

View File

@ -51,10 +51,6 @@ to make it shorter easier to maintain.
#include <sstream> #include <sstream>
using namespace std; using namespace std;
//#include "boost/format.hpp"
//#include "boost/foreach.hpp"
//using namespace boost;
#include "OgreImporter.hpp" #include "OgreImporter.hpp"
#include "irrXMLWrapper.h" #include "irrXMLWrapper.h"
#include "TinyFormatter.h" #include "TinyFormatter.h"
@ -280,9 +276,12 @@ aiMaterial* OgreImporter::LoadMaterial(const std::string MaterialName) const
return NewMaterial; 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; string RestOfLine;
@ -342,6 +341,11 @@ void OgreImporter::ReadTechnique(stringstream &ss, aiMaterial* NewMaterial)
else if(Line=="texture_unit") else if(Line=="texture_unit")
{ {
getline(ss, RestOfLine);//ignore the rest of the line getline(ss, RestOfLine);//ignore the rest of the line
std::string TextureName;
int TextureType=-1;
int UvSet=0;
ss >> Line; ss >> Line;
if(Line!="{") if(Line!="{")
throw DeadlyImportError("empty texture unit!"); throw DeadlyImportError("empty texture unit!");
@ -351,17 +355,39 @@ void OgreImporter::ReadTechnique(stringstream &ss, aiMaterial* NewMaterial)
if(Line=="texture") if(Line=="texture")
{ {
ss >> Line; ss >> Line;
aiString ts(Line.c_str()); TextureName=Line;
NewMaterial->AddProperty(&ts, AI_MATKEY_TEXTURE(aiTextureType_DIFFUSE, CurrentTextureId));
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") else if(Line=="tex_coord_set")
{ {
int UvSet;
ss >> 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; ss >> Line;
if("replace"==Line)//I don't think, assimp has something for this... if("replace"==Line)//I don't think, assimp has something for this...
{ {
@ -371,11 +397,41 @@ void OgreImporter::ReadTechnique(stringstream &ss, aiMaterial* NewMaterial)
//TODO: set value //TODO: set value
//NewMaterial->AddProperty(aiTextureOp_Multiply) //NewMaterial->AddProperty(aiTextureOp_Multiply)
} }
*/
} }
}//end of texture unit }//end of texture unit
Line="";//clear the } that would end the outer loop 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 Line="";//clear the } that would end the outer loop

View File

@ -169,7 +169,7 @@ void OgreImporter::LoadSkeleton(std::string FileName, vector<Bone> &Bones, vecto
Bones[ChildId].ParentId=ParentId; Bones[ChildId].ParentId=ParentId;
Bones[ParentId].Children.push_back(ChildId); 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<Bone> &Bones, vecto
//loop over the attributes: //loop over the attributes:
while(true) while(true) //will quit, if a Node is not a animationkey
{ {
XmlRead(SkeletonFile); XmlRead(SkeletonFile);
@ -268,12 +268,9 @@ void OgreImporter::LoadSkeleton(std::string FileName, vector<Bone> &Bones, vecto
break; break;
} }
NewTrack.Keyframes.push_back(NewKeyframe); NewTrack.Keyframes.push_back(NewKeyframe);
//XmlRead(SkeletonFile);
} }
NewAnimation.Tracks.push_back(NewTrack); NewAnimation.Tracks.push_back(NewTrack);
} }
@ -295,7 +292,7 @@ void OgreImporter::CreateAssimpSkeleton(const std::vector<Bone> &Bones, const st
//Createt the assimp bone hierarchy //Createt the assimp bone hierarchy
vector<aiNode*> RootBoneNodes; vector<aiNode*> RootBoneNodes;
BOOST_FOREACH(Bone theBone, Bones) BOOST_FOREACH(const Bone &theBone, Bones)
{ {
if(-1==theBone.ParentId) //the bone is a root bone if(-1==theBone.ParentId) //the bone is a root bone
{ {
@ -304,7 +301,8 @@ void OgreImporter::CreateAssimpSkeleton(const std::vector<Bone> &Bones, const st
} }
} }
if (RootBoneNodes.size()) { if(RootBoneNodes.size() > 0)
{
m_CurrentScene->mRootNode->mNumChildren=RootBoneNodes.size(); m_CurrentScene->mRootNode->mNumChildren=RootBoneNodes.size();
m_CurrentScene->mRootNode->mChildren=new aiNode*[RootBoneNodes.size()]; m_CurrentScene->mRootNode->mChildren=new aiNode*[RootBoneNodes.size()];
memcpy(m_CurrentScene->mRootNode->mChildren, &RootBoneNodes[0], sizeof(aiNode*)*RootBoneNodes.size()); memcpy(m_CurrentScene->mRootNode->mChildren, &RootBoneNodes[0], sizeof(aiNode*)*RootBoneNodes.size());
@ -359,7 +357,7 @@ void OgreImporter::PutAnimationsInScene(const std::vector<Bone> &Bones, const st
aiMatrix4x4 PoseToKey= aiMatrix4x4 PoseToKey=
aiMatrix4x4::Translation(Animations[i].Tracks[j].Keyframes[k].Position, t3) //pos aiMatrix4x4::Translation(Animations[i].Tracks[j].Keyframes[k].Position, t3) //pos
* aiMatrix4x4(Animations[i].Tracks[j].Keyframes[k].Rotation.GetMatrix()) //rot * 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 //calculate the complete transformation from world space to bone space

View File

@ -318,20 +318,28 @@ boost::shared_ptr<const EXPRESS::DataType> EXPRESS::DataType::Parse(const char*&
else if (*cur == '\'' ) { else if (*cur == '\'' ) {
// string literal // string literal
const char* start = ++cur; const char* start = ++cur;
for(;*cur != '\'';++cur) {
if (*cur == '\0') { for(;*cur != '\'';++cur) {
if (*cur == '\0') {
throw STEP::SyntaxError("string literal not closed",line); throw STEP::SyntaxError("string literal not closed",line);
} }
} }
if (cur[1]=='\'') {
for(cur+=2;*cur != '\'';++cur) { if (cur[1] == '\'') {
if (*cur == '\0') { // Vesanen: more than 2 escaped ' in one literal!
throw STEP::SyntaxError("string literal not closed",line); 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<EXPRESS::STRING>(std::string(start, static_cast<size_t>(cur-start) )); inout = cur + 1;
return boost::make_shared<EXPRESS::STRING>(std::string(start, static_cast<size_t>(cur - start)));
} }
else if (*cur == '\"' ) { else if (*cur == '\"' ) {
throw STEP::SyntaxError("binary data not supported yet",line); throw STEP::SyntaxError("binary data not supported yet",line);

View File

@ -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. This section contains implementations notes for the OgreXML importer.
@subsection overview Overview @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? @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 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 have 1 technique and 1 pass in this technique. From there, the texturename (for 1 color- and 1 normalmap) and the
@ -1473,11 +1473,25 @@ 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. 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 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.
<br>
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.
<br>
Property type: String. Default value: guessed.
@subsection todo Todo @subsection todo Todo
- Load colors in custom materials - Load colors in custom materials
- extend custom and normal material loading - extend custom and normal material loading
- fix bone hierarchy bug - 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?) - check for non existent animation keys (what happens if a one time not all bones have a key?)
*/ */

View File

@ -686,6 +686,19 @@ enum aiComponent
#define AI_CONFIG_IMPORT_OGRE_MATERIAL_FILE "IMPORT_OGRE_MATERIAL_FILE" #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.
* <br>
* 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. /** @brief Specifies whether the IFC loader skips over IfcSpace elements.
* *

View File

@ -1 +1 @@
#define SVNRevision 1154 #define SVNRevision 1261

View File

@ -0,0 +1,4 @@
Good IFC test cases
===================
http://www.iai.fzk.de/www-extern/index.php?id=1135