closes https://github.com/assimp/assimp/issues/3275 : fix the build when all exporters are disabled.

issue_3275
Kim Kulling 2020-07-07 19:03:48 +02:00
parent 10c709831f
commit 75d0a818fd
6 changed files with 21 additions and 16 deletions

View File

@ -128,7 +128,7 @@ void M3DWrapper::reset() {
}
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();
saved_output_ = m3d_save(m3d_, quality, flags, &size);
return saved_output_;

View File

@ -254,6 +254,11 @@ MACRO(ADD_ASSIMP_IMPORTER name)
ENDMACRO()
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
# 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}")
LIST(APPEND ASSIMP_EXPORTER_SRCS ${ARGN})
SOURCE_GROUP(AssetLib\\${name} FILES ${ARGN})
ELSEIF( NOT ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT )
message("here")
set(ASSIMP_EXPORTER_ENABLED FALSE)
ELSE()
SET(ASSIMP_EXPORTERS_DISABLED "${ASSIMP_EXPORTERS_DISABLED} ${name}")
add_definitions(-DASSIMP_BUILD_NO_${name}_EXPORTER)

View File

@ -139,6 +139,9 @@ void ExportSceneM3DA(const char*, IOSystem*, const aiScene*, const ExportPropert
void ExportAssimp2Json(const char* , IOSystem*, const aiScene* , const Assimp::ExportProperties*);
#endif
#if (_MSC_VER > 1200)
# pragma warning( disable : 4100 )
#endif
static void setupExporterArray(std::vector<Exporter::ExportFormatEntry> &exporters) {
#ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada));

View File

@ -46,24 +46,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/Importer.hpp>
#include <assimp/postprocess.h>
using namespace Assimp;
TEST(ut3DImportExport, importBoxA) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3D/box_a.3d", aiProcess_ValidateDataStructure);
ASSERT_NE(nullptr, scene);
}
TEST(ut3DImportExport, importBoxD) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3D/box_d.3d", aiProcess_ValidateDataStructure);
ASSERT_NE(nullptr, scene);
}
TEST(ut3DImportExport, importBoxUC) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3D/box.uc", aiProcess_ValidateDataStructure);

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,

View File

@ -45,6 +45,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Main.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 =
"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 -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;
bool shortened = false;
@ -77,7 +76,7 @@ int Assimp_Dump(const char *const *params, unsigned int num) {
return AssimpCmdError::Success;
}
// asssimp dump in out [options]
// assimp dump in out [options]
if (num < 1) {
printf("%s", fail);
return AssimpCmdError::InvalidNumberOfArguments;
@ -136,7 +135,7 @@ int Assimp_Dump(const char *const *params, unsigned int num) {
// import the main model
const aiScene *scene = ImportModel(import, in);
if (!scene) {
if (nullptr == scene) {
printf("assimp dump: Unable to load input file %s\n", in.c_str());
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());
return AssimpCmdError::Success;
}