Merge pull request #4123 from assimp/fix_no_export_build

Fix no export build
pull/4124/head
Kim Kulling 2021-10-17 16:00:30 +02:00 committed by GitHub
commit 11cb1a170f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 15 deletions

View File

@ -101,9 +101,11 @@ private:
std::vector<OpcPackageRelationship*> mRelations;
};
#endif // ASSIMP_BUILD_NO_3MF_EXPORTER
#endif // ASSIMP_BUILD_NO_EXPORT
} // Namespace D3MF
} // Namespace Assimp
#endif // ASSIMP_BUILD_NO_3MF_EXPORTER
#endif // ASSIMP_BUILD_NO_EXPORT

View File

@ -48,11 +48,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/defs.h>
#ifndef ASSIMP_BUILD_NO_EXPORT
// nothing really needed here - reserved for future use like properties
namespace Assimp {
void ASSIMP_API ExportSceneAssbin(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/);
}
#endif
#endif // AI_ASSBINEXPORTER_H_INC

View File

@ -43,13 +43,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "AssbinFileWriter.h"
#include "Common/assbin_chunks.h"
#include "PostProcessing/ProcessHelper.h"
#include <assimp/Exceptional.h>
#include <assimp/version.h>
#include <assimp/Exporter.hpp>
#include <assimp/IOStream.hpp>
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
@ -58,7 +56,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../contrib/zlib/zlib.h"
#endif
#include <time.h>
#include <ctime>
#if _MSC_VER
#pragma warning(push)
@ -277,7 +275,7 @@ public:
// empty
}
virtual ~AssbinChunkWriter() {
~AssbinChunkWriter() override {
if (container) {
container->Write(&magic, sizeof(uint32_t), 1);
container->Write(&cursor, sizeof(uint32_t), 1);
@ -288,26 +286,27 @@ public:
void *GetBufferPointer() { return buffer; }
// -------------------------------------------------------------------
virtual size_t Read(void * /*pvBuffer*/, size_t /*pSize*/, size_t /*pCount*/) {
size_t Read(void * /*pvBuffer*/, size_t /*pSize*/, size_t /*pCount*/) override {
return 0;
}
virtual aiReturn Seek(size_t /*pOffset*/, aiOrigin /*pOrigin*/) {
aiReturn Seek(size_t /*pOffset*/, aiOrigin /*pOrigin*/) override {
return aiReturn_FAILURE;
}
virtual size_t Tell() const {
size_t Tell() const override {
return cursor;
}
virtual void Flush() {
void Flush() override {
// not implemented
}
virtual size_t FileSize() const {
size_t FileSize() const override {
return cursor;
}
// -------------------------------------------------------------------
virtual size_t Write(const void *pvBuffer, size_t pSize, size_t pCount) {
size_t Write(const void *pvBuffer, size_t pSize, size_t pCount) override {
pSize *= pCount;
if (cursor + pSize > cur_size) {
Grow(cursor + pSize);

View File

@ -45,6 +45,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace Assimp;
#ifndef ASSIMP_BUILD_NO_EXPORT
class TestProgressHandler : public ProgressHandler {
public:
TestProgressHandler() :
@ -101,3 +103,5 @@ TEST_F(ExporterTest, ExporterIdTest) {
const aiExportFormatDesc *desc = exporter.GetExportFormatDescription(exportFormatCount);
EXPECT_EQ(nullptr, desc) << "More exporters than claimed";
}
#endif

View File

@ -233,6 +233,8 @@ unsigned int GetMeshUseCount(const aiNode *rootNode) {
return result;
}
#ifndef ASSIMP_BUILD_NO_EXPORT
TEST_F(utColladaImportExport, exportRootNodeMeshTest) {
Assimp::Importer importer;
Assimp::Exporter exporter;
@ -342,6 +344,8 @@ TEST_F(utColladaImportExport, exporterUniqueIdsTest) {
ImportAsNames(outFileNamed, scene);
}
#endif
class utColladaZaeImportExport : public AbstractImportExportBase {
public:
virtual bool importerTest() final {

View File

@ -66,6 +66,8 @@ const char *AICMD_MSG_DUMP_HELP =
FILE *out = nullptr;
bool shortened = false;
#ifndef ASSIMP_BUILD_NO_EXPORT
// -----------------------------------------------------------------------------------
int Assimp_Dump(const char *const *params, unsigned int num) {
const char *fail = "assimp dump: Invalid number of arguments. "
@ -162,3 +164,9 @@ 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;
}
#else
int Assimp_Dump(const char *const *, unsigned int ) {
printf("assimp dump: Export disabled.\n");
return AssimpCmdError::UnrecognizedCommand;
}
#endif