From 17fc3eea8f890ad8e48f5e8664f75e03c38d9671 Mon Sep 17 00:00:00 2001 From: Mika Rautio Date: Mon, 5 Dec 2016 11:12:46 +0200 Subject: [PATCH 1/4] Do not build exporter if its importer is not built --- code/CMakeLists.txt | 1 + code/Exporter.cpp | 2 +- code/XFileExporter.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 17a30502a..4a201a536 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -197,6 +197,7 @@ MACRO(ADD_ASSIMP_IMPORTER name) SET(${name}_SRC "") SET(ASSIMP_IMPORTERS_DISABLED "${ASSIMP_IMPORTERS_DISABLED} ${name}") add_definitions(-DASSIMP_BUILD_NO_${name}_IMPORTER) + add_definitions(-DASSIMP_BUILD_NO_${name}_EXPORTER) ENDIF() ENDMACRO() diff --git a/code/Exporter.cpp b/code/Exporter.cpp index e6ab20fdf..bdfea82b6 100644 --- a/code/Exporter.cpp +++ b/code/Exporter.cpp @@ -101,7 +101,7 @@ Exporter::ExportFormatEntry gExporters[] = Exporter::ExportFormatEntry( "collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada), #endif -#ifndef ASSIMP_BUILD_NO_XFILE_EXPORTER +#ifndef ASSIMP_BUILD_NO_X_EXPORTER Exporter::ExportFormatEntry( "x", "X Files", "x", &ExportSceneXFile, aiProcess_MakeLeftHanded | aiProcess_FlipWindingOrder | aiProcess_FlipUVs), #endif diff --git a/code/XFileExporter.cpp b/code/XFileExporter.cpp index e3a46a1da..eeb5a1de1 100644 --- a/code/XFileExporter.cpp +++ b/code/XFileExporter.cpp @@ -41,7 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ASSIMP_BUILD_NO_EXPORT -#ifndef ASSIMP_BUILD_NO_XFILE_EXPORTER +#ifndef ASSIMP_BUILD_NO_X_EXPORTER #include "XFileExporter.h" #include "ConvertToLHProcess.h" #include "Bitmap.h" From f9cce7f59c5c4fa824d5e2f9f84d3fe2e09d88ad Mon Sep 17 00:00:00 2001 From: Mika Rautio Date: Mon, 5 Dec 2016 12:33:48 +0200 Subject: [PATCH 2/4] MinGW __stat64 support depends on MSVCRT version --- code/DefaultIOStream.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/DefaultIOStream.cpp b/code/DefaultIOStream.cpp index 11bad9b64..1907709e3 100644 --- a/code/DefaultIOStream.cpp +++ b/code/DefaultIOStream.cpp @@ -120,13 +120,13 @@ size_t DefaultIOStream::FileSize() const // // See here for details: // https://www.securecoding.cert.org/confluence/display/seccode/FIO19-C.+Do+not+use+fseek()+and+ftell()+to+compute+the+size+of+a+regular+file -#if defined _WIN32 +#if defined _WIN32 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601) struct __stat64 fileStat; int err = _stat64( mFilename.c_str(), &fileStat ); if (0 != err) return 0; mCachedSize = (size_t) (fileStat.st_size); -#elif defined __gnu_linux__ || defined __APPLE__ || defined __MACH__ +#elif defined __GNUC__ || defined __APPLE__ || defined __MACH__ struct stat fileStat; int err = stat(mFilename.c_str(), &fileStat ); if (0 != err) From 8929760b3e9b1003dd1e8bd59d3b7e8568db2f01 Mon Sep 17 00:00:00 2001 From: Mika Rautio Date: Mon, 5 Dec 2016 12:57:05 +0200 Subject: [PATCH 3/4] Add better MinGW support for IFCReaderGen big objects --- code/CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 4a201a536..3eafbdc62 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -463,9 +463,13 @@ ADD_ASSIMP_IMPORTER( IFC STEPFileEncoding.cpp STEPFileEncoding.h ) -if (MSVC AND ASSIMP_BUILD_IFC_IMPORTER) - set_source_files_properties(IFCReaderGen1.cpp IFCReaderGen2.cpp PROPERTIES COMPILE_FLAGS "/bigobj") -endif (MSVC AND ASSIMP_BUILD_IFC_IMPORTER) +if (ASSIMP_BUILD_IFC_IMPORTER) + if (MSVC) + set_source_files_properties(IFCReaderGen1.cpp IFCReaderGen2.cpp PROPERTIES COMPILE_FLAGS "/bigobj") + elseif(CMAKE_COMPILER_IS_MINGW) + set_source_files_properties(IFCReaderGen1.cpp IFCReaderGen2.cpp PROPERTIES COMPILE_FLAGS "-O2 -Wa,-mbig-obj") + endif() +endif (ASSIMP_BUILD_IFC_IMPORTER) ADD_ASSIMP_IMPORTER( XGL XGLLoader.cpp From 350ee2ff681a8e8a95f8c712c384ae02fcae282b Mon Sep 17 00:00:00 2001 From: Mika Rautio Date: Mon, 5 Dec 2016 13:01:16 +0200 Subject: [PATCH 4/4] Fix MinGW compilation support --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76a6d051e..a8f3d2488 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,6 +176,7 @@ ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fvisibility=hidden -Wall -Wno-long-long -pedantic -std=c++11" ) ELSEIF( CMAKE_COMPILER_IS_MINGW ) SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wno-long-long -pedantic -std=c++11" ) + add_definitions( -U__STRICT_ANSI__ ) ENDIF() if (ASSIMP_COVERALLS) @@ -329,7 +330,7 @@ ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) ADD_SUBDIRECTORY( code/ ) IF ( ASSIMP_BUILD_ASSIMP_TOOLS ) - IF ( WIN32 ) + IF ( WIN32 AND DirectX_D3DX9_LIBRARY ) option ( ASSIMP_BUILD_ASSIMP_VIEW "If the Assimp view tool is built. (requires DirectX)" ${DirectX_FOUND} ) IF ( ASSIMP_BUILD_ASSIMP_VIEW ) ADD_SUBDIRECTORY( tools/assimp_view/ )