From b43cf9233703305cfd8dfe7844fce959879b4f0c Mon Sep 17 00:00:00 2001 From: dormon Date: Sun, 30 Sep 2018 17:18:18 +0200 Subject: [PATCH 01/22] Improved cmake configs for Windows and Linux. Now the configs follows the standard cmake-package code: see https://cmake.org/cmake/help/v3.12/manual/cmake-packages.7.html Downstreamer no longer have to manually specify target_include_directories with ${ASSIMP_INCLUDE_DIRS}, target_link_libraries with ${ASSIMP_LIBRARY_DIRS} and so on. Downstreamer can now use: find_package(assimp CONFIG REQUIRED) target_link_libraries(AWESOME_APP PUBLIC assimp::assimp) and everything should work. Added assimpTargets.cmake.in Added assimpTargets-debug.cmake.in Added assimpTargets-release.cmake.in Modified CMakeLists.txt Modified code/CMakeLists.txt - added ALIAS assimp::assimp Tested on Ubuntu 18.04 and Windows 10 --- AssimpConfig.cmake.in | 21 ------- CMakeLists.txt | 12 +++- assimp-config.cmake.in | 60 +------------------- assimpTargets-debug.cmake.in | 78 +++++++++++++++++++++++++ assimpTargets-release.cmake.in | 75 ++++++++++++++++++++++++ assimpTargets.cmake.in | 101 +++++++++++++++++++++++++++++++++ code/CMakeLists.txt | 1 + 7 files changed, 267 insertions(+), 81 deletions(-) delete mode 100644 AssimpConfig.cmake.in create mode 100644 assimpTargets-debug.cmake.in create mode 100644 assimpTargets-release.cmake.in create mode 100644 assimpTargets.cmake.in diff --git a/AssimpConfig.cmake.in b/AssimpConfig.cmake.in deleted file mode 100644 index 5bb705a41..000000000 --- a/AssimpConfig.cmake.in +++ /dev/null @@ -1,21 +0,0 @@ -# - 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/CMakeLists.txt b/CMakeLists.txt index f1482fdfa..2162e93a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -309,8 +309,18 @@ ENDIF() # 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}/assimpTargets.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets.cmake" @ONLY IMMEDIATE) +CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-debug.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake" @ONLY IMMEDIATE) +CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-release.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.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 "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT ${LIBASSIMP-DEV_COMPONENT}) +#we should generated these scripts after CMake VERSION 3.0.2 using export(EXPORT ...) and write_basic_package_version_file(...) +INSTALL(FILES + "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake" + DESTINATION "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT ${LIBASSIMP-DEV_COMPONENT}) FIND_PACKAGE( DirectX ) diff --git a/assimp-config.cmake.in b/assimp-config.cmake.in index 1710cac5d..0ab9fd071 100644 --- a/assimp-config.cmake.in +++ b/assimp-config.cmake.in @@ -1,59 +1 @@ -# - 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(ASSIMP_ROOT_DIR "@CMAKE_INSTALL_PREFIX@" REALPATH) - -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") - elseif( MSVC10 ) - set(MSVC_PREFIX "vc100") - elseif( MSVC11 ) - set(MSVC_PREFIX "vc110") - elseif( MSVC12 ) - set(MSVC_PREFIX "vc120") - elseif( MSVC14 ) - set(MSVC_PREFIX "vc140") - else() - set(MSVC_PREFIX "vc150") - endif() - set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" ) -else() - set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@" CACHE STRING "the suffix for the openrave libraries" ) -endif() - -set( ASSIMP_CXX_FLAGS ) # dynamically linked library -set( ASSIMP_LINK_FLAGS "" ) -set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_LIB_INSTALL_DIR@") -set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_INCLUDE_INSTALL_DIR@") -set( ASSIMP_LIBRARIES assimp${ASSIMP_LIBRARY_SUFFIX}) -set( ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES}@CMAKE_DEBUG_POSTFIX@) - -# for compatibility with 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_CFLAGS_OTHER - ASSIMP_LDFLAGS_OTHER - ASSIMP_LIBRARY_SUFFIX -) +include(${CMAKE_CURRENT_LIST_DIR}/assimpTargets.cmake) diff --git a/assimpTargets-debug.cmake.in b/assimpTargets-debug.cmake.in new file mode 100644 index 000000000..a83e6c22d --- /dev/null +++ b/assimpTargets-debug.cmake.in @@ -0,0 +1,78 @@ +#---------------------------------------------------------------- +# Generated CMake target import file for configuration "Debug". +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +if(MSVC) + if( MSVC70 OR MSVC71 ) + set(MSVC_PREFIX "vc70") + elseif( MSVC80 ) + set(MSVC_PREFIX "vc80") + elseif( MSVC90 ) + set(MSVC_PREFIX "vc90") + elseif( MSVC10 ) + set(MSVC_PREFIX "vc100") + elseif( MSVC11 ) + set(MSVC_PREFIX "vc110") + elseif( MSVC12 ) + set(MSVC_PREFIX "vc120") + elseif( MSVC14 ) + set(MSVC_PREFIX "vc140") + else() + set(MSVC_PREFIX "vc150") + endif() + set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" ) + + set(sharedLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@") + set(importLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_IMPORT_LIBRARY_SUFFIX@") + + # Import target "assimp::assimp" for configuration "Debug" + set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(assimp::assimp PROPERTIES + IMPORTED_IMPLIB_DEBUG "${_IMPORT_PREFIX}/lib/${importLibraryName}" + IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/bin/${sharedLibraryName}" + ) + list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) + list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${importLibraryName}") + list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/bin/${sharedLibraryName}" ) + +else() + set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@" CACHE STRING "the suffix for the openrave libraries" ) + set(sharedLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@.@ASSIMP_VERSION_MAJOR@") + set_target_properties(assimp::assimp PROPERTIES + IMPORTED_SONAME_DEBUG "${sharedLibraryName}" + IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/${sharedLibraryName}" + ) + list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) + list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${sharedLibraryName}" ) +endif() + + + + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) + +get_filename_component(ASSIMP_ROOT_DIR "@CMAKE_INSTALL_PREFIX@" REALPATH) +set( ASSIMP_CXX_FLAGS ) # dynamically linked library +set( ASSIMP_LINK_FLAGS "" ) +set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_LIB_INSTALL_DIR@") +set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_INCLUDE_INSTALL_DIR@") +set( ASSIMP_LIBRARIES ${sharedLibraryName}) + +# for compatibility with 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_CFLAGS_OTHER + ASSIMP_LDFLAGS_OTHER + ASSIMP_LIBRARY_SUFFIX +) diff --git a/assimpTargets-release.cmake.in b/assimpTargets-release.cmake.in new file mode 100644 index 000000000..0b38e4e92 --- /dev/null +++ b/assimpTargets-release.cmake.in @@ -0,0 +1,75 @@ +#---------------------------------------------------------------- +# Generated CMake target import file for configuration "Release". +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +if(MSVC) + if( MSVC70 OR MSVC71 ) + set(MSVC_PREFIX "vc70") + elseif( MSVC80 ) + set(MSVC_PREFIX "vc80") + elseif( MSVC90 ) + set(MSVC_PREFIX "vc90") + elseif( MSVC10 ) + set(MSVC_PREFIX "vc100") + elseif( MSVC11 ) + set(MSVC_PREFIX "vc110") + elseif( MSVC12 ) + set(MSVC_PREFIX "vc120") + elseif( MSVC14 ) + set(MSVC_PREFIX "vc140") + else() + set(MSVC_PREFIX "vc150") + endif() + set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" ) + + set(sharedLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_SHARED_LIBRARY_SUFFIX@") + set(importLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_IMPORT_LIBRARY_SUFFIX@") + + # Import target "assimp::assimp" for configuration "Release" + set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(assimp::assimp PROPERTIES + IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/${importLibraryName}" + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/${sharedLibraryName}" + ) + list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) + list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${importLibraryName}") + list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/bin/${sharedLibraryName}" ) + +else() + set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@" CACHE STRING "the suffix for the openrave libraries" ) + set(sharedLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_SHARED_LIBRARY_SUFFIX@.@ASSIMP_VERSION_MAJOR@") + set_target_properties(assimp::assimp PROPERTIES + IMPORTED_SONAME_RELEASE "${sharedLibraryName}" + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/${sharedLibraryName}" + ) + list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) + list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${sharedLibraryName}" ) +endif() + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) + +get_filename_component(ASSIMP_ROOT_DIR "@CMAKE_INSTALL_PREFIX@" REALPATH) +set( ASSIMP_CXX_FLAGS ) # dynamically linked library +set( ASSIMP_LINK_FLAGS "" ) +set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_LIB_INSTALL_DIR@") +set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_INCLUDE_INSTALL_DIR@") +set( ASSIMP_LIBRARIES ${sharedLibraryName}) + +# for compatibility with 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_CFLAGS_OTHER + ASSIMP_LDFLAGS_OTHER + ASSIMP_LIBRARY_SUFFIX +) diff --git a/assimpTargets.cmake.in b/assimpTargets.cmake.in new file mode 100644 index 000000000..68e2c0dec --- /dev/null +++ b/assimpTargets.cmake.in @@ -0,0 +1,101 @@ +# Generated by CMake + +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5) + message(FATAL_ERROR "CMake >= 2.6.0 required") +endif() +cmake_policy(PUSH) +cmake_policy(VERSION 2.6) +#---------------------------------------------------------------- +# Generated CMake target import file. +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_targetsDefined) +set(_targetsNotDefined) +set(_expectedTargets) +foreach(_expectedTarget assimp::assimp) + list(APPEND _expectedTargets ${_expectedTarget}) + if(NOT TARGET ${_expectedTarget}) + list(APPEND _targetsNotDefined ${_expectedTarget}) + endif() + if(TARGET ${_expectedTarget}) + list(APPEND _targetsDefined ${_expectedTarget}) + endif() +endforeach() +if("${_targetsDefined}" STREQUAL "${_expectedTargets}") + unset(_targetsDefined) + unset(_targetsNotDefined) + unset(_expectedTargets) + set(CMAKE_IMPORT_FILE_VERSION) + cmake_policy(POP) + return() +endif() +if(NOT "${_targetsDefined}" STREQUAL "") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") +endif() +unset(_targetsDefined) +unset(_targetsNotDefined) +unset(_expectedTargets) + + +# Compute the installation prefix relative to this file. +get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +if(_IMPORT_PREFIX STREQUAL "/") + set(_IMPORT_PREFIX "") +endif() + +# Create imported target assimp::assimp +add_library(assimp::assimp SHARED IMPORTED) + +set_target_properties(assimp::assimp PROPERTIES + COMPATIBLE_INTERFACE_STRING "assimp_MAJOR_VERSION" + INTERFACE_assimp_MAJOR_VERSION "1" + INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include" + #INTERFACE_LINK_LIBRARIES "TxtUtils::TxtUtils;MealyMachine::MealyMachine" +) + +if(CMAKE_VERSION VERSION_LESS 2.8.12) + message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.") +endif() + +# Load information for each installed configuration. +get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +file(GLOB CONFIG_FILES "${_DIR}/assimpTargets-*.cmake") +foreach(f ${CONFIG_FILES}) + include(${f}) +endforeach() + +# Cleanup temporary variables. +set(_IMPORT_PREFIX) + +# Loop over all imported files and verify that they actually exist +foreach(target ${_IMPORT_CHECK_TARGETS} ) + foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) + if(NOT EXISTS "${file}" ) + message(FATAL_ERROR "The imported target \"${target}\" references the file + \"${file}\" +but this file does not exist. Possible reasons include: +* The file was deleted, renamed, or moved to another location. +* An install or uninstall procedure did not complete successfully. +* The installation package was faulty and contained + \"${CMAKE_CURRENT_LIST_FILE}\" +but not all the files it references. +") + endif() + endforeach() + unset(_IMPORT_CHECK_FILES_FOR_${target}) +endforeach() +unset(_IMPORT_CHECK_TARGETS) + +# This file does not depend on other imported targets which have +# been exported from the same project but in a separate export set. + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) +cmake_policy(POP) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index c238c7c4a..d163f73dc 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -910,6 +910,7 @@ IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) ADD_LIBRARY( assimp ${assimp_src} ) +ADD_LIBRARY(assimp::asimp ALIAS assimp) TARGET_INCLUDE_DIRECTORIES ( assimp PUBLIC $ From 4bd57f7577fe845a671ada3900f53a809c953ce0 Mon Sep 17 00:00:00 2001 From: Minmin Gong Date: Sat, 8 Sep 2018 12:46:06 -0700 Subject: [PATCH 02/22] Add IGNORE_GIT_HASH. --- CMakeLists.txt | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f1482fdfa..c53be5bba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,6 +110,11 @@ OPTION( INJECT_DEBUG_POSTFIX ON ) +OPTION ( IGNORE_GIT_HASH + "Don't call git to get the hash." + OFF +) + IF (IOS) IF (NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE "Release") @@ -153,23 +158,25 @@ SET( ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used # Enable C++1 globally set_property( GLOBAL PROPERTY CXX_STANDARD 11 ) -# Get the current working branch -EXECUTE_PROCESS( - COMMAND git rev-parse --abbrev-ref HEAD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - OUTPUT_VARIABLE GIT_BRANCH - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_QUIET -) +IF(NOT IGNORE_GIT_HASH) + # Get the current working branch + EXECUTE_PROCESS( + COMMAND git rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE GIT_BRANCH + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) -# Get the latest abbreviated commit hash of the working branch -EXECUTE_PROCESS( - COMMAND git log -1 --format=%h --no-show-signature - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - OUTPUT_VARIABLE GIT_COMMIT_HASH - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_QUIET -) + # Get the latest abbreviated commit hash of the working branch + EXECUTE_PROCESS( + COMMAND git log -1 --format=%h --no-show-signature + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) +ENDIF() IF(NOT GIT_COMMIT_HASH) SET(GIT_COMMIT_HASH 0) From dfc38b5e9a6c025149cd0a5d135b94938479ac9b Mon Sep 17 00:00:00 2001 From: Nicholas Woodfield Date: Fri, 5 Oct 2018 11:34:03 -0400 Subject: [PATCH 03/22] Update AssimpNet redirect After the exchange on twitter, I noticed that this readme never actually had a link pointing to the bitbucket repository that I maintain (originally the googlecode one, and then a fork of the googlecode one I didn't know about). This is very confusing for people who report issues, and I would like them to make sure they can report on a tracker that I keep tabs on. --- port/AssimpNET/Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/port/AssimpNET/Readme.md b/port/AssimpNET/Readme.md index dca57470c..bcbfebab1 100644 --- a/port/AssimpNET/Readme.md +++ b/port/AssimpNET/Readme.md @@ -1 +1 @@ -Please check the following github-repo for the source: https://github.com/kebby/assimp-net +Please check the following git-repo for the source: https://bitbucket.org/Starnick/assimpnet From f588568c534a737e523bac4367f80487099ec52b Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 5 Oct 2018 20:20:16 +0200 Subject: [PATCH 04/22] closes https://github.com/assimp/assimp/issues/2067: introduce /bigobj compiler flag --- CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ff139f22..9aa3efc8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,15 +217,13 @@ ENDIF( UNIX ) # Grouped compiler settings IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW) # hide all not-exported symbols - SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fPIC -fno-strict-aliasing -Wall -std=c++0x ${CMAKE_CXX_FLAGS}") + SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fPIC -fno-strict-aliasing -Wall -std=c++0x -mbig-obj ${CMAKE_CXX_FLAGS}") SET(CMAKE_C_FLAGS "-fPIC -fno-strict-aliasing ${CMAKE_C_FLAGS}") SET(LIBSTDC++_LIBRARIES -lstdc++) ELSEIF(MSVC) # enable multi-core compilation with MSVC ADD_COMPILE_OPTIONS(/MP) - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - ADD_COMPILE_OPTIONS( /bigobj ) - ENDIF() + ADD_COMPILE_OPTIONS( /bigobj ) # disable "elements of array '' will be default initialized" warning on MSVC2013 IF(MSVC12) ADD_COMPILE_OPTIONS(/wd4351) From 3cf5fbb945f2aa0f1421465627402ecef4ed9e28 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 5 Oct 2018 20:45:41 +0200 Subject: [PATCH 05/22] Update CMakeLists.txt Fix the switches. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9aa3efc8e..129f9f9fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,7 +217,7 @@ ENDIF( UNIX ) # Grouped compiler settings IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW) # hide all not-exported symbols - SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fPIC -fno-strict-aliasing -Wall -std=c++0x -mbig-obj ${CMAKE_CXX_FLAGS}") + SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fPIC -fno-strict-aliasing -Wall -std=c++0x -Wa,-mbig-obj ${CMAKE_CXX_FLAGS}") SET(CMAKE_C_FLAGS "-fPIC -fno-strict-aliasing ${CMAKE_C_FLAGS}") SET(LIBSTDC++_LIBRARIES -lstdc++) ELSEIF(MSVC) From d1f7472242f6d7ac7950e63834f0438880d5b490 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 5 Oct 2018 21:28:07 +0200 Subject: [PATCH 06/22] Update CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 129f9f9fc..ade45f719 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,7 +217,7 @@ ENDIF( UNIX ) # Grouped compiler settings IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW) # hide all not-exported symbols - SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fPIC -fno-strict-aliasing -Wall -std=c++0x -Wa,-mbig-obj ${CMAKE_CXX_FLAGS}") + SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fPIC -fno-strict-aliasing -Wall -std=c++0x ${CMAKE_CXX_FLAGS}") SET(CMAKE_C_FLAGS "-fPIC -fno-strict-aliasing ${CMAKE_C_FLAGS}") SET(LIBSTDC++_LIBRARIES -lstdc++) ELSEIF(MSVC) From a238c5c4b431b980c61c3971131f1c3ee0d03bff Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 6 Oct 2018 13:18:14 +0200 Subject: [PATCH 07/22] Update Build.md Prototype for build-doc. --- Build.md | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/Build.md b/Build.md index b548c1794..418749a0f 100644 --- a/Build.md +++ b/Build.md @@ -1,7 +1,54 @@ -# Build instructions +# Install CMake +Asset-Importer-Lib supports a lot of different OSes and platforms. We are using cmake to generate the build environment for these via cmake. So you have to make sure that you have a working cmake-installation on your system. You can download it at https://cmake.org/ +# Get the source +Make sure you have a working git-installation. Open a command prompt and clone the Asset-Importer-Lib via: +``` +git clone https://github.com/assimp/assimp.git +``` + +# Build instructions for Windows with Visual-Studio + +First you have to install Visual-Studio on your windows-system. You can get the Community-Version for free here: https://visualstudio.microsoft.com/de/downloads/ +To generate the build environment for your IDE open a command prompt, navigate to your repo and type: + +``` > cmake CMakeLists.txt -make -j4 +``` +This will generate the project files. -##UWP +# Build instructions for Windows with UWP See https://stackoverflow.com/questions/40803170/cmake-uwp-using-cmake-to-build-universal-windows-app + + +# Build instrcutions for Linux / Unix +Open a terminal and got to your repository. You can generate the projectfiles and build the library via: + +``` +cmake CMakeLists.txt +make -j4 +``` +The option -j descripes the number of parallel processes for the build. + +# CMake build options +The cmake-build-environment provides options to configure the build. The following options can be used: +- BUILD_SHARED_LIBS ( default ON ): Generation of shared libs ( dll for windows, so for Linux ). Set this to OFF to get a static lib. +- BUILD_FRAMEWORK ( default OFF, MacOnly): Build package as Mac OS X Framework bundle +- ASSIMP_DOUBLE_PRECISION( default OFF ): All data will be stored as double values. +- ASSIMP_OPT_BUILD_PACKAGES ( default OFF): Set to ON to generate CPack configuration files and packaging targets +- ASSIMP_ANDROID_JNIIOSYSTEM ( default OFF ): Android JNI IOSystem support is active +- ASSIMP_NO_EXPORT ( default OFF ): Disable Assimp's export functionality +- ASSIMP_BUILD_ZLIB ( default OFF ): Build your own zlib +- ASSIMP_BUILD_ASSIMP_TOOLS ( default ON ): If the supplementary tools for Assimp are built in addition to the library. +- ASSIMP_BUILD_SAMPLES ( default OFF ): If the official samples are built as well (needs Glut). +- ASSIMP_BUILD_TESTS ( default ON ): If the test suite for Assimp is built in addition to the library. +- ASSIMP_COVERALLS ( default OFF ): Enable this to measure test coverage. +- ASSIMP_WERROR( default OFF ): Treat warnings as errors. +- ASSIMP_ASAN ( default OFF ): Enable AddressSanitizer. +- ASSIMP_UBSAN ( default OFF ): Enable Undefined Behavior sanitizer. +- SYSTEM_IRRXML ( default OFF ): Use system installed Irrlicht/IrrXML library. +- BUILD_DOCS ( default OFF ): Build documentation using Doxygen. +- INJECT_DEBUG_POSTFIX( default ON ): Inject debug postfix in .a/.so lib names +- IGNORE_GIT_HASH ( default OFF ): Don't call git to get the hash. +- ASSIMP_INSTALL_PDB ( default ON ): Install MSVC debug files. + From f4b1d0bc3cf5b5173cdc594c3de5c5ecb93391eb Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 6 Oct 2018 13:45:09 +0200 Subject: [PATCH 08/22] Update Readme.md Add link to readme. --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index ac71a29db..1ba026d5a 100644 --- a/Readme.md +++ b/Readme.md @@ -115,7 +115,7 @@ __Exporters__: - FBX ( experimental ) ### Building ### -Take a look into the `INSTALL` file. Our build system is CMake, if you used CMake before there is a good chance you know what to do. +Take a look into the https://github.com/assimp/assimp/blob/master/Build.md file. Our build system is CMake, if you used CMake before there is a good chance you know what to do. ### Ports ### * [Android](port/AndroidJNI/README.md) From d4b0cd53ea9cfe20bb809c2bf440ea5f98597f14 Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sat, 6 Oct 2018 14:55:20 +0200 Subject: [PATCH 09/22] Replaced "../Include/" include from FBXDocumentUtil.h --- code/FBXDocumentUtil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/FBXDocumentUtil.h b/code/FBXDocumentUtil.h index acc8c4a5c..c0435a663 100644 --- a/code/FBXDocumentUtil.h +++ b/code/FBXDocumentUtil.h @@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef INCLUDED_AI_FBX_DOCUMENT_UTIL_H #define INCLUDED_AI_FBX_DOCUMENT_UTIL_H -#include "../include/assimp/defs.h" +#include #include #include #include "FBXDocument.h" From 531f30302f52a813f33fa27a03c4bc188c0341ee Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sat, 6 Oct 2018 14:58:06 +0200 Subject: [PATCH 10/22] Replaced "../Include/" include from 3DSHelper.h --- code/3DSHelper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/3DSHelper.h b/code/3DSHelper.h index a904abb20..6acc192de 100644 --- a/code/3DSHelper.h +++ b/code/3DSHelper.h @@ -58,7 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { namespace D3DS { -#include "./../include/assimp/Compiler/pushpack1.h" +#include // --------------------------------------------------------------------------- /** Discreet3DS class: Helper class for loading 3ds files. Defines chunks From d9a7ed19a8ace623ef5e20fdc481d1e62eeb7955 Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sat, 6 Oct 2018 14:59:20 +0200 Subject: [PATCH 11/22] Replaced "../Include/" include from 3DSHelper.h --- code/3DSHelper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/3DSHelper.h b/code/3DSHelper.h index 6acc192de..d67a7c14c 100644 --- a/code/3DSHelper.h +++ b/code/3DSHelper.h @@ -363,7 +363,7 @@ struct Texture { int iUVSrc; }; -#include "./../include/assimp/Compiler/poppack1.h" +#include // --------------------------------------------------------------------------- /** Helper structure representing a 3ds material */ From 99fc989af7024ac3f5edfa7d44ebf6a8ad413041 Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sat, 6 Oct 2018 15:01:42 +0200 Subject: [PATCH 12/22] Replaced "../Include/" include from MDLFileData.h --- code/MDLFileData.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/MDLFileData.h b/code/MDLFileData.h index 1215b2a80..f9be6761b 100644 --- a/code/MDLFileData.h +++ b/code/MDLFileData.h @@ -709,7 +709,7 @@ struct GroupFrame SimpleFrame *frames; } PACK_STRUCT; -#include "./../include/assimp/Compiler/poppack1.h" +#include // ------------------------------------------------------------------------------------- /** \struct IntFace_MDL7 From 463a7e80167f2a572a2661757a3aaffd3f426664 Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sat, 6 Oct 2018 15:02:58 +0200 Subject: [PATCH 13/22] Replaced "../Include/" include from MD3FileData.h --- code/MD3FileData.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/MD3FileData.h b/code/MD3FileData.h index 3f9741366..910813fc4 100644 --- a/code/MD3FileData.h +++ b/code/MD3FileData.h @@ -246,7 +246,7 @@ struct Vertex uint16_t NORMAL; } /*PACK_STRUCT*/; -#include "./../include/assimp/Compiler/poppack1.h" +#include // ------------------------------------------------------------------------------- /** @brief Unpack a Q3 16 bit vector to its full float3 representation From 91a805a082e5e1287184d571769226b10eb8a709 Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sat, 6 Oct 2018 15:05:18 +0200 Subject: [PATCH 14/22] Update HalfLifeFileData.h --- code/HalfLifeFileData.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/HalfLifeFileData.h b/code/HalfLifeFileData.h index 930980c80..7c55657d4 100644 --- a/code/HalfLifeFileData.h +++ b/code/HalfLifeFileData.h @@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_MDLFILEHELPER2_H_INC #define AI_MDLFILEHELPER2_H_INC -#include "./../include/assimp/Compiler/pushpack1.h" +#include namespace Assimp { namespace MDL { @@ -141,7 +141,7 @@ struct Header_HL2 { int32_t transitionindex; } /* PACK_STRUCT */; -#include "./../include/assimp/Compiler/poppack1.h" +#include } } // end namespaces From 8bb4b57d1d7f4fb77fbc8b6a818a9fd13347b05c Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sat, 6 Oct 2018 15:11:47 +0200 Subject: [PATCH 15/22] Replaced "../Include/" include from HMPFileData.h --- code/HMPFileData.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/HMPFileData.h b/code/HMPFileData.h index a8ad2deb0..08e8b3be3 100644 --- a/code/HMPFileData.h +++ b/code/HMPFileData.h @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { namespace HMP { -#include "./../include/assimp/Compiler/pushpack1.h" +#include #include // to make it easier for us, we test the magic word against both "endianesses" From d7bcd581748a29d6d0aee4b61af925b59c97c0b9 Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sat, 6 Oct 2018 15:15:43 +0200 Subject: [PATCH 16/22] Replaced "../Include/" include from MD4FileData.h --- code/MD4FileData.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/MD4FileData.h b/code/MD4FileData.h index e515808ac..ed3dc65e7 100644 --- a/code/MD4FileData.h +++ b/code/MD4FileData.h @@ -46,9 +46,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include "../include/assimp/types.h" -#include "../include/assimp/mesh.h" -#include "../include/assimp/anim.h" +#include +#include +#include #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) # pragma pack(push,1) From 7061493ead4abb250e418ff944a8a9cd158b7361 Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sat, 6 Oct 2018 15:16:40 +0200 Subject: [PATCH 17/22] Replaced "../Include/" include from HMPFileData.h --- code/HMPFileData.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/HMPFileData.h b/code/HMPFileData.h index 08e8b3be3..962f2f9c7 100644 --- a/code/HMPFileData.h +++ b/code/HMPFileData.h @@ -131,7 +131,7 @@ struct Vertex_HMP7 int8_t normal_x,normal_y; } PACK_STRUCT; -#include "./../include/assimp/Compiler/poppack1.h" +#include } //! namespace HMP } //! namespace Assimp From 47fcbfd3695f0ce2cd9f2e238c240c7a2f591f1b Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sat, 6 Oct 2018 15:19:56 +0200 Subject: [PATCH 18/22] Replaced "../Include/" include from glTF2Asset.h --- code/glTF2Asset.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/glTF2Asset.h b/code/glTF2Asset.h index d1a70ae0a..0def5b74d 100644 --- a/code/glTF2Asset.h +++ b/code/glTF2Asset.h @@ -170,7 +170,7 @@ namespace glTF2 #include #ifdef ASSIMP_API - #include "./../include/assimp/Compiler/pushpack1.h" + #include #endif //! For binary .glb files @@ -189,7 +189,7 @@ namespace glTF2 } PACK_STRUCT; #ifdef ASSIMP_API - #include "./../include/assimp/Compiler/poppack1.h" + #include #endif From 88c173a6f474ae9b8363d50a21bcb186a6e7c9f9 Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sat, 6 Oct 2018 15:20:28 +0200 Subject: [PATCH 19/22] Replaced "../Include/" include from glTFAsset.h --- code/glTFAsset.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/glTFAsset.h b/code/glTFAsset.h index bc79f72ec..b04692901 100644 --- a/code/glTFAsset.h +++ b/code/glTFAsset.h @@ -170,7 +170,7 @@ namespace glTF #define AI_GLB_MAGIC_NUMBER "glTF" #ifdef ASSIMP_API - #include "./../include/assimp/Compiler/pushpack1.h" + #include #endif //! For the KHR_binary_glTF extension (binary .glb file) @@ -185,7 +185,7 @@ namespace glTF } PACK_STRUCT; #ifdef ASSIMP_API - #include "./../include/assimp/Compiler/poppack1.h" + #include #endif From 716205fde007f1255326aacd2e111e319ac8d7b9 Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sat, 6 Oct 2018 15:22:10 +0200 Subject: [PATCH 20/22] Replaced "../Include/" include from irrXMLWrapper.h --- include/assimp/irrXMLWrapper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/assimp/irrXMLWrapper.h b/include/assimp/irrXMLWrapper.h index 70b20ebd3..296f26a32 100644 --- a/include/assimp/irrXMLWrapper.h +++ b/include/assimp/irrXMLWrapper.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // some long includes .... #include -#include "./../include/assimp/IOStream.hpp" +#include "IOStream.hpp" #include "BaseImporter.h" #include From 239c59d71508e32e9f1d98ff788f06748cb36808 Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sat, 6 Oct 2018 16:12:58 +0200 Subject: [PATCH 21/22] Fixed include: IFCReaderGen_4 instead of IFCReaderGen4 --- code/Importer/IFC/IFCReaderGen_4.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/Importer/IFC/IFCReaderGen_4.cpp b/code/Importer/IFC/IFCReaderGen_4.cpp index 7a312e691..fdefedb18 100644 --- a/code/Importer/IFC/IFCReaderGen_4.cpp +++ b/code/Importer/IFC/IFCReaderGen_4.cpp @@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ASSIMP_BUILD_NO_IFC_IMPORTER #include "AssimpPCH.h" -#include "IFCReaderGen4.h" +#include "IFCReaderGen_4.h" namespace Assimp { using namespace IFC; From e7da1c634dc5770d47e469598753023c6cbd571f Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sat, 6 Oct 2018 16:28:10 +0200 Subject: [PATCH 22/22] Fix: C4244 conversion warning --- code/D3MFImporter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/D3MFImporter.cpp b/code/D3MFImporter.cpp index e1a0d92d0..bf0e6a102 100644 --- a/code/D3MFImporter.cpp +++ b/code/D3MFImporter.cpp @@ -314,20 +314,20 @@ private: ++buf; comp[ 1 ] = *buf; ++buf; - diffuse.r = static_cast( strtol( comp, NULL, 16 ) ) / 255.0; + diffuse.r = static_cast( strtol( comp, NULL, 16 ) ) / ai_real(255.0); comp[ 0 ] = *buf; ++buf; comp[ 1 ] = *buf; ++buf; - diffuse.g = static_cast< ai_real >( strtol( comp, NULL, 16 ) ) / 255.0; + diffuse.g = static_cast< ai_real >( strtol( comp, NULL, 16 ) ) / ai_real(255.0); comp[ 0 ] = *buf; ++buf; comp[ 1 ] = *buf; ++buf; - diffuse.b = static_cast< ai_real >( strtol( comp, NULL, 16 ) ) / 255.0; + diffuse.b = static_cast< ai_real >( strtol( comp, NULL, 16 ) ) / ai_real(255.0); if(7 == len) return true; @@ -335,7 +335,7 @@ private: ++buf; comp[ 1 ] = *buf; ++buf; - diffuse.a = static_cast< ai_real >( strtol( comp, NULL, 16 ) ) / 255.0; + diffuse.a = static_cast< ai_real >( strtol( comp, NULL, 16 ) ) / ai_real(255.0); return true; }