closes https://github.com/assimp/assimp/issues/3275 : fix the build when all exporters are disabled.
parent
10c709831f
commit
75d0a818fd
|
@ -128,7 +128,7 @@ void M3DWrapper::reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *M3DWrapper::Save(int quality, int flags, unsigned int &size) {
|
unsigned char *M3DWrapper::Save(int quality, int flags, unsigned int &size) {
|
||||||
#if (!(ASSIMP_BUILD_NO_EXPORT || ASSIMP_BUILD_NO_M3D_EXPORTER))
|
#if (!(ASSIMP_BUILD_NO_EXPORT || !ASSIMP_BUILD_NO_M3D_EXPORTER))
|
||||||
ClearSave();
|
ClearSave();
|
||||||
saved_output_ = m3d_save(m3d_, quality, flags, &size);
|
saved_output_ = m3d_save(m3d_, quality, flags, &size);
|
||||||
return saved_output_;
|
return saved_output_;
|
||||||
|
|
|
@ -254,6 +254,11 @@ MACRO(ADD_ASSIMP_IMPORTER name)
|
||||||
ENDMACRO()
|
ENDMACRO()
|
||||||
|
|
||||||
if (NOT ASSIMP_NO_EXPORT)
|
if (NOT ASSIMP_NO_EXPORT)
|
||||||
|
IF( NOT ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT )
|
||||||
|
message("here")
|
||||||
|
set(ASSIMP_EXPORTER_ENABLED FALSE)
|
||||||
|
set( ASSIMP_NO_EXPORT ON )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
# if this variable is set to TRUE, the user can manually disable exporters by setting
|
# if this variable is set to TRUE, the user can manually disable exporters by setting
|
||||||
# ASSIMP_BUILD_XXX_EXPORTER to FALSE for each exporter
|
# ASSIMP_BUILD_XXX_EXPORTER to FALSE for each exporter
|
||||||
|
@ -279,6 +284,9 @@ if (NOT ASSIMP_NO_EXPORT)
|
||||||
SET(ASSIMP_EXPORTERS_ENABLED "${ASSIMP_EXPORTERS_ENABLED} ${name}")
|
SET(ASSIMP_EXPORTERS_ENABLED "${ASSIMP_EXPORTERS_ENABLED} ${name}")
|
||||||
LIST(APPEND ASSIMP_EXPORTER_SRCS ${ARGN})
|
LIST(APPEND ASSIMP_EXPORTER_SRCS ${ARGN})
|
||||||
SOURCE_GROUP(AssetLib\\${name} FILES ${ARGN})
|
SOURCE_GROUP(AssetLib\\${name} FILES ${ARGN})
|
||||||
|
ELSEIF( NOT ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT )
|
||||||
|
message("here")
|
||||||
|
set(ASSIMP_EXPORTER_ENABLED FALSE)
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(ASSIMP_EXPORTERS_DISABLED "${ASSIMP_EXPORTERS_DISABLED} ${name}")
|
SET(ASSIMP_EXPORTERS_DISABLED "${ASSIMP_EXPORTERS_DISABLED} ${name}")
|
||||||
add_definitions(-DASSIMP_BUILD_NO_${name}_EXPORTER)
|
add_definitions(-DASSIMP_BUILD_NO_${name}_EXPORTER)
|
||||||
|
|
|
@ -139,6 +139,9 @@ void ExportSceneM3DA(const char*, IOSystem*, const aiScene*, const ExportPropert
|
||||||
void ExportAssimp2Json(const char* , IOSystem*, const aiScene* , const Assimp::ExportProperties*);
|
void ExportAssimp2Json(const char* , IOSystem*, const aiScene* , const Assimp::ExportProperties*);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (_MSC_VER > 1200)
|
||||||
|
# pragma warning( disable : 4100 )
|
||||||
|
#endif
|
||||||
static void setupExporterArray(std::vector<Exporter::ExportFormatEntry> &exporters) {
|
static void setupExporterArray(std::vector<Exporter::ExportFormatEntry> &exporters) {
|
||||||
#ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER
|
#ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER
|
||||||
exporters.push_back(Exporter::ExportFormatEntry("collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada));
|
exporters.push_back(Exporter::ExportFormatEntry("collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada));
|
||||||
|
|
|
@ -46,24 +46,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/postprocess.h>
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
|
||||||
TEST(ut3DImportExport, importBoxA) {
|
TEST(ut3DImportExport, importBoxA) {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3D/box_a.3d", aiProcess_ValidateDataStructure);
|
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3D/box_a.3d", aiProcess_ValidateDataStructure);
|
||||||
ASSERT_NE(nullptr, scene);
|
ASSERT_NE(nullptr, scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(ut3DImportExport, importBoxD) {
|
TEST(ut3DImportExport, importBoxD) {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3D/box_d.3d", aiProcess_ValidateDataStructure);
|
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3D/box_d.3d", aiProcess_ValidateDataStructure);
|
||||||
ASSERT_NE(nullptr, scene);
|
ASSERT_NE(nullptr, scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(ut3DImportExport, importBoxUC) {
|
TEST(ut3DImportExport, importBoxUC) {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3D/box.uc", aiProcess_ValidateDataStructure);
|
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3D/box.uc", aiProcess_ValidateDataStructure);
|
||||||
|
|
|
@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2020, assimp team
|
Copyright (c) 2006-2020, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
|
|
@ -45,6 +45,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "Main.h"
|
#include "Main.h"
|
||||||
#include "PostProcessing/ProcessHelper.h"
|
#include "PostProcessing/ProcessHelper.h"
|
||||||
|
#include "Common/assbin_chunks.h"
|
||||||
|
#include <assimp/DefaultIOSystem.h>
|
||||||
|
#include "AssetLib/Assbin/AssbinFileWriter.h"
|
||||||
|
#include "AssetLib/Assxml/AssxmlFileWriter.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
const char *AICMD_MSG_DUMP_HELP =
|
const char *AICMD_MSG_DUMP_HELP =
|
||||||
"assimp dump <model> [<out>] [-b] [-s] [-z] [common parameters]\n"
|
"assimp dump <model> [<out>] [-b] [-s] [-z] [common parameters]\n"
|
||||||
|
@ -56,13 +62,6 @@ const char *AICMD_MSG_DUMP_HELP =
|
||||||
"\t -cdefault Default post processing: runs all recommended steps\n"
|
"\t -cdefault Default post processing: runs all recommended steps\n"
|
||||||
"\t -cfull Fires almost all post processing steps \n";
|
"\t -cfull Fires almost all post processing steps \n";
|
||||||
|
|
||||||
#include "Common/assbin_chunks.h"
|
|
||||||
#include <assimp/DefaultIOSystem.h>
|
|
||||||
#include "AssetLib/Assbin/AssbinFileWriter.h"
|
|
||||||
#include "AssetLib/Assxml/AssxmlFileWriter.h"
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
FILE *out = nullptr;
|
FILE *out = nullptr;
|
||||||
bool shortened = false;
|
bool shortened = false;
|
||||||
|
|
||||||
|
@ -77,7 +76,7 @@ int Assimp_Dump(const char *const *params, unsigned int num) {
|
||||||
return AssimpCmdError::Success;
|
return AssimpCmdError::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
// asssimp dump in out [options]
|
// assimp dump in out [options]
|
||||||
if (num < 1) {
|
if (num < 1) {
|
||||||
printf("%s", fail);
|
printf("%s", fail);
|
||||||
return AssimpCmdError::InvalidNumberOfArguments;
|
return AssimpCmdError::InvalidNumberOfArguments;
|
||||||
|
@ -136,7 +135,7 @@ int Assimp_Dump(const char *const *params, unsigned int num) {
|
||||||
|
|
||||||
// import the main model
|
// import the main model
|
||||||
const aiScene *scene = ImportModel(import, in);
|
const aiScene *scene = ImportModel(import, in);
|
||||||
if (!scene) {
|
if (nullptr == scene) {
|
||||||
printf("assimp dump: Unable to load input file %s\n", in.c_str());
|
printf("assimp dump: Unable to load input file %s\n", in.c_str());
|
||||||
return AssimpCmdError::FailedToLoadInputFile;
|
return AssimpCmdError::FailedToLoadInputFile;
|
||||||
}
|
}
|
||||||
|
@ -160,5 +159,6 @@ int Assimp_Dump(const char *const *params, unsigned int num) {
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("assimp dump: Wrote output dump %s\n", cur_out.c_str());
|
printf("assimp dump: Wrote output dump %s\n", cur_out.c_str());
|
||||||
|
|
||||||
return AssimpCmdError::Success;
|
return AssimpCmdError::Success;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue