Revert "added zip reader/writer facade"

This reverts commit 3fbcc58e06.
This commit is contained in:
Igor Korsukov 2022-05-19 15:29:30 +03:00
parent 3fbcc58e06
commit 196cf66f83
49 changed files with 131 additions and 441 deletions

View file

@ -200,6 +200,7 @@ endif(BUILD_UNIT_TESTS)
add_subdirectory(share)
add_subdirectory(src/framework/global) # should be first to work pch
add_subdirectory(thirdparty/qzip)
add_subdirectory(src)
###########################################

View file

@ -218,7 +218,7 @@ set(MODULE_INCLUDE
)
set(MODULE_DEF ${ENGRAVING_INFRASTRUCTURE_DEF})
set(MODULE_LINK ${ENGRAVING_INFRASTRUCTURE_LINK})
set(MODULE_LINK ${ENGRAVING_INFRASTRUCTURE_LINK} qzip)
set(MODULE_USE_UNITY_NONE ON)
include(SetupModule)

View file

@ -27,7 +27,7 @@
#include <QDir>
#include <QDirIterator>
#include "serialization/zipreader.h"
#include "thirdparty/qzip/qzipreader_p.h"
#include "log.h"
@ -90,7 +90,7 @@ MscReader::IReader* MscReader::reader() const
if (!m_reader) {
switch (m_params.mode) {
case MscIoMode::Zip:
m_reader = new ZipFileReader();
m_reader = new ZipReader();
break;
case MscIoMode::Dir:
m_reader = new DirReader();
@ -234,7 +234,7 @@ QByteArray MscReader::readViewSettingsJsonFile() const
// Readers
// =======================================================================
MscReader::ZipFileReader::~ZipFileReader()
MscReader::ZipReader::~ZipReader()
{
delete m_zip;
if (m_selfDeviceOwner) {
@ -242,7 +242,7 @@ MscReader::ZipFileReader::~ZipFileReader()
}
}
bool MscReader::ZipFileReader::open(QIODevice* device, const QString& filePath)
bool MscReader::ZipReader::open(QIODevice* device, const QString& filePath)
{
m_device = device;
if (!m_device) {
@ -257,12 +257,12 @@ bool MscReader::ZipFileReader::open(QIODevice* device, const QString& filePath)
}
}
m_zip = new mu::ZipReader(m_device);
m_zip = new MQZipReader(m_device);
return true;
}
void MscReader::ZipFileReader::close()
void MscReader::ZipReader::close()
{
if (m_zip) {
m_zip->close();
@ -273,29 +273,29 @@ void MscReader::ZipFileReader::close()
}
}
bool MscReader::ZipFileReader::isOpened() const
bool MscReader::ZipReader::isOpened() const
{
return m_device ? m_device->isOpen() : false;
}
bool MscReader::ZipFileReader::isContainer() const
bool MscReader::ZipReader::isContainer() const
{
return true;
}
QStringList MscReader::ZipFileReader::fileList() const
QStringList MscReader::ZipReader::fileList() const
{
IF_ASSERT_FAILED(m_zip) {
return QStringList();
}
QStringList files;
std::vector<ZipReader::FileInfo> fileInfoList = m_zip->fileInfoList();
if (m_zip->status() != ZipReader::NoError) {
QVector<MQZipReader::FileInfo> fileInfoList = m_zip->fileInfoList();
if (m_zip->status() != MQZipReader::NoError) {
LOGD() << "failed read meta, status: " << m_zip->status();
}
for (const ZipReader::FileInfo& fi : fileInfoList) {
for (const MQZipReader::FileInfo& fi : fileInfoList) {
if (fi.isFile) {
files << fi.filePath;
}
@ -304,14 +304,14 @@ QStringList MscReader::ZipFileReader::fileList() const
return files;
}
QByteArray MscReader::ZipFileReader::fileData(const QString& fileName) const
QByteArray MscReader::ZipReader::fileData(const QString& fileName) const
{
IF_ASSERT_FAILED(m_zip) {
return QByteArray();
}
QByteArray data = m_zip->fileData(fileName);
if (m_zip->status() != ZipReader::NoError) {
if (m_zip->status() != MQZipReader::NoError) {
LOGD() << "failed read data, status: " << m_zip->status();
return QByteArray();
}

View file

@ -28,12 +28,9 @@
#include "mscio.h"
class MQZipReader;
class QXmlStreamReader;
namespace mu {
class ZipReader;
}
namespace mu::engraving {
class MscReader
{
@ -91,9 +88,9 @@ private:
virtual QByteArray fileData(const QString& fileName) const = 0;
};
struct ZipFileReader : public IReader
struct ZipReader : public IReader
{
~ZipFileReader() override;
~ZipReader() override;
bool open(QIODevice* device, const QString& filePath) override;
void close() override;
bool isOpened() const override;
@ -103,7 +100,7 @@ private:
private:
QIODevice* m_device = nullptr;
bool m_selfDeviceOwner = false;
ZipReader* m_zip = nullptr;
MQZipReader* m_zip = nullptr;
};
struct DirReader : public IReader

View file

@ -32,7 +32,7 @@
#include "containers.h"
#include "serialization/zipwriter.h"
#include "thirdparty/qzip/qzipwriter_p.h"
#include "log.h"
@ -94,7 +94,7 @@ MscWriter::IWriter* MscWriter::writer() const
if (!m_writer) {
switch (m_params.mode) {
case MscIoMode::Zip:
m_writer = new ZipFileWriter();
m_writer = new ZipWriter();
break;
case MscIoMode::Dir:
m_writer = new DirWriter();
@ -247,7 +247,7 @@ void MscWriter::Meta::addFile(const QString& file)
// Writers
// =======================================================================
MscWriter::ZipFileWriter::~ZipFileWriter()
MscWriter::ZipWriter::~ZipWriter()
{
delete m_zip;
if (m_selfDeviceOwner) {
@ -255,7 +255,7 @@ MscWriter::ZipFileWriter::~ZipFileWriter()
}
}
bool MscWriter::ZipFileWriter::open(QIODevice* device, const QString& filePath)
bool MscWriter::ZipWriter::open(QIODevice* device, const QString& filePath)
{
m_device = device;
if (!m_device) {
@ -270,12 +270,12 @@ bool MscWriter::ZipFileWriter::open(QIODevice* device, const QString& filePath)
}
}
m_zip = new ZipWriter(m_device);
m_zip = new MQZipWriter(m_device);
return true;
}
void MscWriter::ZipFileWriter::close()
void MscWriter::ZipWriter::close()
{
if (m_zip) {
m_zip->close();
@ -286,19 +286,19 @@ void MscWriter::ZipFileWriter::close()
}
}
bool MscWriter::ZipFileWriter::isOpened() const
bool MscWriter::ZipWriter::isOpened() const
{
return m_device ? m_device->isOpen() : false;
}
bool MscWriter::ZipFileWriter::addFileData(const QString& fileName, const QByteArray& data)
bool MscWriter::ZipWriter::addFileData(const QString& fileName, const QByteArray& data)
{
IF_ASSERT_FAILED(m_zip) {
return false;
}
m_zip->addFile(fileName, data);
if (m_zip->status() != ZipWriter::NoError) {
if (m_zip->status() != MQZipWriter::NoError) {
LOGE() << "failed write files to zip, status: " << m_zip->status();
return false;
}

View file

@ -28,12 +28,9 @@
#include "mscio.h"
class MQZipWriter;
class QTextStream;
namespace mu {
class ZipWriter;
}
namespace mu::engraving {
class MscWriter
{
@ -80,9 +77,9 @@ private:
virtual bool addFileData(const QString& fileName, const QByteArray& data) = 0;
};
struct ZipFileWriter : public IWriter
struct ZipWriter : public IWriter
{
~ZipFileWriter() override;
~ZipWriter() override;
bool open(QIODevice* device, const QString& filePath) override;
void close() override;
bool isOpened() const override;
@ -91,7 +88,7 @@ private:
private:
QIODevice* m_device = nullptr;
bool m_selfDeviceOwner = false;
ZipWriter* m_zip = nullptr;
MQZipWriter* m_zip = nullptr;
};
struct DirWriter : public IWriter

View file

@ -22,8 +22,7 @@
#include <QJsonDocument>
#include <QJsonObject>
#include "io/file.h"
#include <QFile>
#include "factory.h"
#include "score.h"
@ -182,9 +181,9 @@ bool Score::sanityCheck(const QString& name)
json["error"] = error.trimmed().replace("\n", "\\n");
}
QJsonDocument jsonDoc(json);
io::File fp(name);
if (!fp.open(io::IODevice::WriteOnly)) {
LOGE() << "Failed open file: " << name;
QFile fp(name);
if (!fp.open(QIODevice::WriteOnly)) {
LOGD("Open <%s> failed", qPrintable(name));
return false;
}
fp.write(jsonDoc.toJson(QJsonDocument::Compact));

View file

@ -57,11 +57,6 @@ public:
XmlReader(QIODevice* d)
: XmlStreamReader(d) {}
XmlReader(const mu::io::ByteArray& d)
: XmlStreamReader(d) {}
XmlReader(mu::io::IODevice* d)
: XmlStreamReader(d) {}
XmlReader(const XmlReader&) = delete;
XmlReader& operator=(const XmlReader&) = delete;

View file

@ -35,6 +35,7 @@ set(MODULE_TEST_SRC
)
set(MODULE_TEST_LINK
qzip
engraving
fonts
)

View file

@ -74,6 +74,7 @@ set(MODULE_TEST_SRC
)
set(MODULE_TEST_LINK
qzip
engraving
fonts
)

View file

@ -99,13 +99,6 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/serialization/xmlstreamreader.h
${CMAKE_CURRENT_LIST_DIR}/serialization/xmlstreamwriter.cpp
${CMAKE_CURRENT_LIST_DIR}/serialization/xmlstreamwriter.h
${CMAKE_CURRENT_LIST_DIR}/serialization/zipreader.cpp
${CMAKE_CURRENT_LIST_DIR}/serialization/zipreader.h
${CMAKE_CURRENT_LIST_DIR}/serialization/zipwriter.cpp
${CMAKE_CURRENT_LIST_DIR}/serialization/zipwriter.h
${CMAKE_CURRENT_LIST_DIR}/serialization/internal/qzip.cpp
${CMAKE_CURRENT_LIST_DIR}/serialization/internal/qzipreader_p.h
${CMAKE_CURRENT_LIST_DIR}/serialization/internal/qzipwriter_p.h
)
if (NOT NO_GLOBAL_INTERNAL)
@ -132,25 +125,8 @@ set(FS_LIB )
# set(FS_LIB stdc++fs)
#endif()
include(GetCompilerInfo)
set(Z_LIB )
if (CC_IS_MSVC)
include(FindStaticLibrary)
set(Z_LIB zlibstat)
set(Z_INCLUDE ${PROJECT_SOURCE_DIR}/dependencies/include/zlib)
elseif (CC_IS_EMSCRIPTEN)
#zlib included in main linker
else ()
set(Z_LIB z)
endif ()
set(MODULE_INCLUDE
${Z_INCLUDE}
)
set(MODULE_LINK
${FS_LIB}
${Z_LIB}
)
if (OS_IS_MAC)

View file

@ -209,8 +209,3 @@ size_t IODevice::write(const ByteArray& ba)
{
return write(ba.constData(), ba.size());
}
size_t IODevice::write(const QByteArray& ba)
{
return write(reinterpret_cast<const uint8_t*>(ba.constData()), ba.size());
}

View file

@ -24,7 +24,6 @@
#define MU_IO_IODEVICE_H
#include <cstdint>
#include <QByteArray>
#include "bytearray.h"
namespace mu::io {
@ -60,7 +59,6 @@ public:
size_t write(const uint8_t* data, size_t len);
size_t write(const ByteArray& ba);
size_t write(const QByteArray& ba);
protected:

View file

@ -35,17 +35,6 @@ XmlStreamReader::XmlStreamReader(const QByteArray& data)
m_reader = new QXmlStreamReader(data);
}
XmlStreamReader::XmlStreamReader(io::IODevice* device)
{
io::ByteArray data = device->readAll();
setData(data);
}
XmlStreamReader::XmlStreamReader(const io::ByteArray& data)
{
setData(data);
}
XmlStreamReader::~XmlStreamReader()
{
delete m_reader;
@ -57,13 +46,6 @@ void XmlStreamReader::setData(const QByteArray& data)
m_reader->addData(data);
}
void XmlStreamReader::setData(const io::ByteArray& data)
{
m_reader->clear();
QByteArray ba(reinterpret_cast<const char*>(data.constData()), data.size());
m_reader->addData(ba);
}
bool XmlStreamReader::readNextStartElement()
{
return m_reader->readNextStartElement();

View file

@ -23,8 +23,6 @@
#define MU_GLOBAL_XMLSTREAMREADER_H
#include <vector>
#include "io/iodevice.h"
#include "io/bytearray.h"
#include <QIODevice>
#include <QByteArray>
@ -66,12 +64,9 @@ public:
explicit XmlStreamReader(QIODevice* device);
explicit XmlStreamReader(const QByteArray& data);
explicit XmlStreamReader(io::IODevice* device);
explicit XmlStreamReader(const io::ByteArray& data);
virtual ~XmlStreamReader();
void setData(const QByteArray& data);
void setData(const io::ByteArray& data);
bool readNextStartElement();
bool atEnd() const;

View file

@ -39,16 +39,8 @@ XmlStreamWriter::XmlStreamWriter(QIODevice* dev)
m_stream->setCodec("UTF-8");
}
XmlStreamWriter::XmlStreamWriter(io::IODevice* dev)
{
m_device = dev;
m_stream = new QTextStream(&m_data);
m_stream->setCodec("UTF-8");
}
XmlStreamWriter::~XmlStreamWriter()
{
flush();
delete m_stream;
}
@ -57,12 +49,6 @@ void XmlStreamWriter::setDevice(QIODevice* dev)
m_stream->setDevice(dev);
}
void XmlStreamWriter::setDevice(io::IODevice* dev)
{
m_device = dev;
m_stream->setString(&m_data);
}
void XmlStreamWriter::setString(QString* string, QIODevice::OpenMode openMode)
{
m_stream->setString(string, openMode);
@ -71,9 +57,6 @@ void XmlStreamWriter::setString(QString* string, QIODevice::OpenMode openMode)
void XmlStreamWriter::flush()
{
m_stream->flush();
if (m_device) {
m_device->write(m_data.toUtf8());
}
}
void XmlStreamWriter::putLevel()

View file

@ -26,8 +26,6 @@
#include <QIODevice>
#include <QString>
#include "io/iodevice.h"
class QTextStream;
namespace mu {
@ -36,11 +34,9 @@ class XmlStreamWriter
public:
XmlStreamWriter();
explicit XmlStreamWriter(QIODevice* dev);
explicit XmlStreamWriter(io::IODevice* dev);
virtual ~XmlStreamWriter();
void setDevice(QIODevice* dev);
void setDevice(io::IODevice* dev);
void setString(QString* string, QIODevice::OpenMode openMode = QIODevice::ReadWrite);
void flush();
@ -68,9 +64,6 @@ private:
//! NOTE Temporary implementation
QTextStream* m_stream = nullptr;
io::IODevice* m_device = nullptr;
QString m_data;
};
}

View file

@ -1,99 +0,0 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "zipreader.h"
#include <QBuffer>
#include "internal/qzipreader_p.h"
using namespace mu;
struct ZipReader::Impl
{
MQZipReader* zip = nullptr;
QBuffer buf;
bool isClosed = false;
};
ZipReader::ZipReader(QIODevice* device)
{
m_impl = new Impl();
m_impl->zip = new MQZipReader(device);
}
ZipReader::ZipReader(io::IODevice* device)
{
m_device = device;
m_impl = new Impl();
m_impl->zip = new MQZipReader(&m_impl->buf);
}
ZipReader::~ZipReader()
{
close();
delete m_impl->zip;
delete m_impl;
}
void ZipReader::close()
{
if (m_impl->isClosed) {
return;
}
m_impl->isClosed = true;
m_impl->zip->close();
if (m_device) {
QByteArray data = m_impl->buf.readAll();
m_device->write(data);
m_device->close();
}
}
ZipReader::Status ZipReader::status() const
{
return static_cast<Status>(m_impl->zip->status());
}
std::vector<ZipReader::FileInfo> ZipReader::fileInfoList() const
{
std::vector<FileInfo> ret;
QVector<MQZipReader::FileInfo> qfis = m_impl->zip->fileInfoList();
ret.reserve(qfis.size());
for (const MQZipReader::FileInfo& qfi : qfis) {
FileInfo fi;
fi.filePath = qfi.filePath;
fi.isDir = qfi.isDir;
fi.isFile = qfi.isFile;
fi.isSymLink = qfi.isSymLink;
fi.size = qfi.size;
ret.push_back(std::move(fi));
}
return ret;
}
QByteArray ZipReader::fileData(const QString& fileName) const
{
return m_impl->zip->fileData(fileName);
}

View file

@ -1,71 +0,0 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_GLOBAL_ZIPREADER_H
#define MU_GLOBAL_ZIPREADER_H
#include <vector>
#include <QIODevice>
#include "io/iodevice.h"
namespace mu {
class ZipReader
{
public:
enum Status {
NoError,
FileReadError,
FileOpenError,
FilePermissionsError,
FileError
};
struct FileInfo
{
QString filePath;
bool isDir = false;
bool isFile = false;
bool isSymLink = false;
qint64 size = 0;
bool isValid() const { return isDir || isFile || isSymLink; }
};
explicit ZipReader(QIODevice* device);
explicit ZipReader(io::IODevice* device);
~ZipReader();
void close();
Status status() const;
std::vector<FileInfo> fileInfoList() const;
QByteArray fileData(const QString& fileName) const;
private:
struct Impl;
Impl* m_impl = nullptr;
io::IODevice* m_device = nullptr;
};
}
#endif // MU_GLOBAL_ZIPREADER_H

View file

@ -1,79 +0,0 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "zipwriter.h"
#include <QBuffer>
#include "internal/qzipwriter_p.h"
using namespace mu;
struct ZipWriter::Impl
{
MQZipWriter* zip = nullptr;
QBuffer buf;
bool isClosed = false;
};
ZipWriter::ZipWriter(QIODevice* device)
{
m_impl = new Impl();
m_impl->zip = new MQZipWriter(device);
}
ZipWriter::ZipWriter(io::IODevice* device)
{
m_device = device;
m_impl = new Impl();
m_impl->zip = new MQZipWriter(&m_impl->buf);
}
ZipWriter::~ZipWriter()
{
delete m_impl->zip;
delete m_impl;
}
void ZipWriter::close()
{
if (m_impl->isClosed) {
return;
}
m_impl->isClosed = true;
m_impl->zip->close();
if (m_device) {
QByteArray data = m_impl->buf.readAll();
m_device->write(data);
m_device->close();
}
}
ZipWriter::Status ZipWriter::status() const
{
return static_cast<Status>(m_impl->zip->status());
}
void ZipWriter::addFile(const QString& fileName, const QByteArray& data)
{
m_impl->zip->addFile(fileName, data);
}

View file

@ -1,55 +0,0 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_GLOBAL_ZIPWRITER_H
#define MU_GLOBAL_ZIPWRITER_H
#include "io/iodevice.h"
namespace mu {
class ZipWriter
{
public:
enum Status {
NoError,
FileWriteError,
FileOpenError,
FilePermissionsError,
FileError
};
explicit ZipWriter(QIODevice* device);
explicit ZipWriter(io::IODevice* device);
~ZipWriter();
void close();
Status status() const;
void addFile(const QString& fileName, const QByteArray& data);
private:
struct Impl;
Impl* m_impl = nullptr;
io::IODevice* m_device = nullptr;
};
}
#endif // MU_GLOBAL_ZIPWRITER_H

View file

@ -67,6 +67,10 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/view/devtools/midiportdevmodel.h
)
set(MODULE_LINK
qzip
)
if (OS_IS_MAC)
find_library(CoreMIDI NAMES CoreMIDI)
find_library(CoreAudio NAMES CoreAudio)

View file

@ -40,6 +40,7 @@ set(MODULE_SRC
set(MODULE_LINK
engraving
qzip
)
include(${PROJECT_SOURCE_DIR}/build/module.cmake)

View file

@ -30,6 +30,7 @@ set(MODULE_SRC
)
set(MODULE_LINK
qzip
engraving
)

View file

@ -31,6 +31,7 @@ set(MODULE_SRC
)
set(MODULE_LINK
qzip
engraving
)

View file

@ -32,6 +32,7 @@ set(MODULE_SRC
set(MODULE_LINK
rtf2html # for capella
qzip
engraving
)

View file

@ -31,7 +31,7 @@
#include <QRegularExpression>
#include "libmscore/masterscore.h"
#include "serialization/internal/qzipreader_p.h"
#include "thirdparty/qzip/qzipreader_p.h"
#include "capella.h"
#include "log.h"

View file

@ -74,6 +74,7 @@ set(MODULE_SRC
set(MODULE_LINK
engraving
qzip
)
include(${PROJECT_SOURCE_DIR}/build/module.cmake)

View file

@ -29,7 +29,7 @@
#include "libmscore/part.h"
#include "libmscore/staff.h"
#include "serialization/internal/qzipreader_p.h"
#include "thirdparty/qzip/qzipreader_p.h"
using namespace mu::engraving;

View file

@ -41,6 +41,7 @@ set(MODULE_SRC
set(MODULE_LINK
engraving
qzip
)
include(${PROJECT_SOURCE_DIR}/build/module.cmake)

View file

@ -42,6 +42,7 @@ set(MODULE_SRC
set(MODULE_LINK
beatroot
engraving
qzip
)
include(${PROJECT_SOURCE_DIR}/build/module.cmake)

View file

@ -31,6 +31,7 @@ set(MODULE_SRC
set(MODULE_LINK
engraving
qzip
)
include(${PROJECT_SOURCE_DIR}/build/module.cmake)

View file

@ -41,6 +41,7 @@ set(MODULE_SRC
set(MODULE_LINK
engraving
qzip
)
include(${PROJECT_SOURCE_DIR}/build/module.cmake)

View file

@ -46,7 +46,7 @@
#include "containers.h"
#include "serialization/internal/qzipwriter_p.h"
#include "thirdparty/qzip/qzipwriter_p.h"
#include "engraving/style/style.h"
#include "engraving/rw/xml.h"

View file

@ -29,7 +29,7 @@
#include <QXmlSchemaValidator>
#include <QBuffer>
#include "serialization/internal/qzipreader_p.h"
#include "thirdparty/qzip/qzipreader_p.h"
#include "importmxml.h"
#include "log.h"

View file

@ -35,6 +35,7 @@ set(MODULE_SRC
set(MODULE_LINK
engraving
qzip
)
include(${PROJECT_SOURCE_DIR}/build/module.cmake)

View file

@ -36,5 +36,7 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/internal/languageunpacker.h
)
set(MODULE_LINK qzip)
include(${PROJECT_SOURCE_DIR}/build/module.cmake)

View file

@ -25,7 +25,7 @@
#include <QFileInfo>
#include <QStorageInfo>
#include "serialization/internal/qzipreader_p.h"
#include "thirdparty/qzip/qzipreader_p.h"
#include "log.h"
#include "../ilanguageunpacker.h"
#include "languageserrors.h"

View file

@ -197,6 +197,7 @@ if (CC_IS_EMSCRIPTEN)
list(APPEND MSCORE_APPEND_SRC $<TARGET_OBJECTS:${link}>)
endforeach()
list(APPEND MSCORE_APPEND_SRC $<TARGET_OBJECTS:qzip>)
list(APPEND MSCORE_APPEND_SRC $<TARGET_OBJECTS:sndfile>)
list(APPEND MSCORE_APPEND_SRC $<TARGET_OBJECTS:fluidsynth>)
endif()

View file

@ -165,9 +165,21 @@ else (USE_SYSTEM_FREETYPE)
set(FREETYPE_LIB mscore_freetype)
endif (USE_SYSTEM_FREETYPE)
set(Z_LIB )
if (MSVC)
include(FindStaticLibrary)
set(Z_LIB zlibstat)
elseif (CC_IS_EMSCRIPTEN)
#zlib included in main linker
else ()
set(Z_LIB z)
endif ()
set(MODULE_LINK
Qt5::Svg
${FREETYPE_LIB}
qzip
${Z_LIB}
engraving
commonscene
uicomponents

View file

@ -78,6 +78,7 @@ set(MODULE_UI
)
set(MODULE_LINK
qzip
engraving
commonscene
)

View file

@ -23,8 +23,8 @@
#include <QMetaEnum>
#include "serialization/internal/qzipreader_p.h"
#include "serialization/internal/qzipwriter_p.h"
#include "thirdparty/qzip/qzipreader_p.h"
#include "thirdparty/qzip/qzipwriter_p.h"
#include "translation.h"
#include "mimedatautils.h"

View file

@ -34,8 +34,8 @@
#include <QResizeEvent>
#include <QToolTip>
#include "serialization/internal/qzipreader_p.h"
#include "serialization/internal/qzipwriter_p.h"
#include "thirdparty/qzip/qzipreader_p.h"
#include "thirdparty/qzip/qzipwriter_p.h"
#include "actions/actiontypes.h"
#include "commonscene/commonscenetypes.h"

View file

@ -56,5 +56,9 @@ if (NOT MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VER
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-copy")
endif (NOT MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0)
set(MODULE_LINK
qzip
)
include(${PROJECT_SOURCE_DIR}/build/module.cmake)

View file

@ -25,8 +25,8 @@
#include "stringutils.h"
#include "serialization/internal/qzipreader_p.h"
#include "serialization/internal/qzipwriter_p.h"
#include "thirdparty/qzip/qzipreader_p.h"
#include "thirdparty/qzip/qzipwriter_p.h"
#include "global/xmlreader.h"
#include "global/xmlwriter.h"

47
thirdparty/qzip/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,47 @@
#=============================================================================
# MuseScore
# Music Composition & Notation
#
# Copyright (C) 2014 Werner Schweer
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation and appearing in
# the file LICENSE.GPL
#=============================================================================
set(MODULE qzip)
set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/qzip.cpp
${CMAKE_CURRENT_LIST_DIR}/qzipreader_p.h
${CMAKE_CURRENT_LIST_DIR}/qzipwriter_p.h
)
include(GetPlatformInfo)
include(GetCompilerInfo)
set(Z_LIB )
if (CC_IS_MSVC)
include(FindStaticLibrary)
set(Z_LIB zlibstat)
set(Z_INCLUDE ${PROJECT_SOURCE_DIR}/dependencies/include/zlib)
elseif (CC_IS_EMSCRIPTEN)
#zlib included in main linker
else ()
set(Z_LIB z)
endif ()
set(MODULE_INCLUDE
${Z_INCLUDE}
)
set(MODULE_LINK
${Z_LIB}
)
set(MODULE_NOT_LINK_GLOBAL ON)
include(SetupModule)
target_no_warning(${MODULE} -Wimplicit-fallthrough=0)
target_no_warning(${MODULE} -Wno-conversion)