Skip to content

Commit

Permalink
Merge pull request #8765 from cbjeukendrup/engraving_unity
Browse files Browse the repository at this point in the history
Enable Unity Build for Engraving module
  • Loading branch information
RomanPudashkin authored Aug 6, 2021
2 parents 77a7e30 + b4a4e41 commit b7d8f7b
Show file tree
Hide file tree
Showing 41 changed files with 181 additions and 167 deletions.
39 changes: 21 additions & 18 deletions build/config.h.in
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
//=============================================================================
// MusE
// Linux Music Editor
//
// Copyright (C) 2002-2010 by Werner Schweer 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 2.
//
// 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, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
/*
* 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 MUSESCORE_CONFIG_H
#define MUSESCORE_CONFIG_H
Expand Down
7 changes: 3 additions & 4 deletions ninja_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function do_build() {

BUILD_TYPE=$1

cmake -GNinja \
cmake .. -GNinja \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DCMAKE_INSTALL_PREFIX="${MUSESCORE_INSTALL_DIR}" \
-DMSCORE_INSTALL_SUFFIX="${MUSESCORE_INSTALL_SUFFIX}" \
Expand All @@ -72,13 +72,12 @@ function do_build() {
-DTELEMETRY_TRACK_ID="${MUSESCORE_TELEMETRY_ID}" \
-DCRASH_REPORT_URL="${MUSESCORE_CRASHREPORT_URL}" \
-DBUILD_JACK="${MUSESCORE_BUILD_JACK}" \
-DBUILD_WEBENGINE="${MUSESCORE_BUILD_WEBENGINE}" \
-DBUILD_VST="${MUSESCORE_BUILD_VST}" \
-DVST3_SDK_PATH="${MUSESCORE_VST3_SDK_PATH}" \
-DDOWNLOAD_SOUNDFONT="${MUSESCORE_DOWNLOAD_SOUNDFONT}" \
-DBUILD_UNIT_TESTS="${MUSESCORE_BUILD_UNIT_TESTS}" \
-DCMAKE_SKIP_RPATH="${MUSESCORE_NO_RPATH}" ..
-DYOUTUBE_API_KEY="${MUSESCORE_YOUTUBE_API_KEY}" \
-DCMAKE_SKIP_RPATH="${MUSESCORE_NO_RPATH}" \
-DYOUTUBE_API_KEY="${MUSESCORE_YOUTUBE_API_KEY}"

ninja -j $JOBS
}
Expand Down
7 changes: 6 additions & 1 deletion src/engraving/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,19 @@ else()

endif()

set_source_files_properties( # For these files, Unity Build does not work
${CMAKE_CURRENT_LIST_DIR}/compat/read114.cpp
${CMAKE_CURRENT_LIST_DIR}/compat/read206.cpp
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON
)

set(MODULE_INCLUDE
${PROJECT_SOURCE_DIR}/thirdparty/dtl
)

set(MODULE_LINK ${MODULE_LINK} midi_old qzip)

set(MODULE_NOT_LINK_GLOBAL ON)
set(MODULE_USE_UNITY_NONE ON) # not work
include(SetupModule)

set_property(TARGET ${MODULE} APPEND PROPERTY AUTOMOC_MACRO_NAMES "BEGIN_QT_REGISTERED_ENUM")
8 changes: 4 additions & 4 deletions src/engraving/libmscore/accidental.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ void Accidental::read(XmlReader& e)
_role = r;
}
} else if (tag == "small") {
_small = e.readInt();
m_isSmall = e.readInt();
} else if (Element::readProperties(e)) {
} else {
e.unknown();
Expand Down Expand Up @@ -381,7 +381,7 @@ void Accidental::layout()
}

qreal m = parent() ? parent()->mag() : 1.0;
if (_small) {
if (m_isSmall) {
m *= score()->styleD(Sid::smallNoteMag);
}
setMag(m);
Expand Down Expand Up @@ -599,7 +599,7 @@ QVariant Accidental::getProperty(Pid propertyId) const
{
switch (propertyId) {
case Pid::ACCIDENTAL_TYPE: return int(_accidentalType);
case Pid::SMALL: return _small;
case Pid::SMALL: return m_isSmall;
case Pid::ACCIDENTAL_BRACKET: return int(bracket());
case Pid::ROLE: return int(role());
default:
Expand Down Expand Up @@ -634,7 +634,7 @@ bool Accidental::setProperty(Pid propertyId, const QVariant& v)
setAccidentalType(AccidentalType(v.toInt()));
break;
case Pid::SMALL:
_small = v.toBool();
m_isSmall = v.toBool();
break;
case Pid::ACCIDENTAL_BRACKET:
_bracket = AccidentalBracket(v.toInt());
Expand Down
8 changes: 4 additions & 4 deletions src/engraving/libmscore/accidental.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ struct SymElement {
//---------------------------------------------------------
// @@ Accidental
// @P role enum (Accidental.AUTO, .USER) (read only)
// @P small bool
// @P isSmall bool
//---------------------------------------------------------

class Accidental final : public Element
{
QList<SymElement> el;
AccidentalType _accidentalType { AccidentalType::NONE };
bool _small { false };
bool m_isSmall { false };
AccidentalBracket _bracket { AccidentalBracket::NONE };
AccidentalRole _role { AccidentalRole::AUTO };

Expand Down Expand Up @@ -124,8 +124,8 @@ class Accidental final : public Element

void setRole(AccidentalRole r) { _role = r; }

bool small() const { return _small; }
void setSmall(bool val) { _small = val; }
bool isSmall() const { return m_isSmall; }
void setSmall(bool val) { m_isSmall = val; }

void undoSetSmall(bool val);

Expand Down
10 changes: 5 additions & 5 deletions src/engraving/libmscore/beam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ void Beam::layout1()

int staffIdx = -1;
for (ChordRest* cr : qAsConst(_elements)) {
qreal m = cr->small() ? score()->styleD(Sid::smallNoteMag) : 1.0;
qreal m = cr->isSmall() ? score()->styleD(Sid::smallNoteMag) : 1.0;
mag = qMax(mag, m);
if (cr->isChord()) {
c2 = toChord(cr);
Expand Down Expand Up @@ -1594,11 +1594,11 @@ void Beam::computeStemLen(const std::vector<ChordRest*>& cl, qreal& py1, int bea
qreal firstStemLenPoints = bm.l * _spStaff4;
const qreal sgn = (firstStemLenPoints < 0 ? -1.0 : 1.0);
const PointF p1 = cl[0]->stemPosBeam();
bool small = true;
bool isSmall = true;
for (const ChordRest* cr : cl) {
if (cr->isChord()) {
if (!cr->small()) {
small = false;
if (!cr->isSmall()) {
isSmall = false;
}

const qreal minAbsLen = toChord(cr)->minAbsStemLength();
Expand All @@ -1616,7 +1616,7 @@ void Beam::computeStemLen(const std::vector<ChordRest*>& cl, qreal& py1, int bea
}

py1 += (dy + bm.l) * _spStaff4;
if (small && !staff()->isTabStaff(Fraction(0, 1))) {
if (isSmall && !staff()->isTabStaff(Fraction(0, 1))) {
const qreal offset = (beamLevels == 4) ? _beamDist / 2.0 : 0.0;

if (bm.l > 0) {
Expand Down
12 changes: 6 additions & 6 deletions src/engraving/libmscore/chord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1354,13 +1354,13 @@ qreal Chord::defaultStemLength() const
qreal shortest = score()->styleS(Sid::shortestStem).val();
if (hookIdx) {
if (up()) {
shortest = qMax(shortest, small() ? 2.0 : 3.0);
shortest = qMax(shortest, isSmall() ? 2.0 : 3.0);
} else {
shortest = qMax(shortest, small() ? 2.25 : 3.5);
shortest = qMax(shortest, isSmall() ? 2.25 : 3.5);
}
}

qreal normalStemLen = small() ? 2.5 : 3.5;
qreal normalStemLen = isSmall() ? 2.5 : 3.5;
if (hookIdx && tab == 0) {
if (up() && durationType().dots()) {
//
Expand Down Expand Up @@ -2878,7 +2878,7 @@ QVariant Chord::getProperty(Pid propertyId) const
{
switch (propertyId) {
case Pid::NO_STEM: return noStem();
case Pid::SMALL: return small();
case Pid::SMALL: return isSmall();
case Pid::STEM_DIRECTION: return QVariant::fromValue<Direction>(stemDirection());
case Pid::PLAY: return isChordPlayable();
default:
Expand Down Expand Up @@ -3128,7 +3128,7 @@ void Chord::removeMarkings(bool keepTremolo)
qreal Chord::chordMag() const
{
qreal m = 1.0;
if (small()) {
if (isSmall()) {
m *= score()->styleD(Sid::smallNoteMag);
}
if (_noteType != NoteType::NORMAL) {
Expand Down Expand Up @@ -3655,7 +3655,7 @@ void Chord::layoutArticulations()
}
const Staff* st = staff();
const StaffType* staffType = st->staffTypeForElement(this);
qreal mag = (staffType->small() ? score()->styleD(Sid::smallStaffMag) : 1.0) * staffType->userMag();
qreal mag = (staffType->isSmall() ? score()->styleD(Sid::smallStaffMag) : 1.0) * staffType->userMag();
qreal _spatium = score()->spatium() * mag;
qreal _spStaff = _spatium * staffType->lineDistance().val();

Expand Down
22 changes: 11 additions & 11 deletions src/engraving/libmscore/chordrest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ namespace Ms {
ChordRest::ChordRest(Score* s)
: DurationElement(s)
{
_staffMove = 0;
_beam = 0;
_tabDur = 0;
_up = true;
_beamMode = Beam::Mode::AUTO;
_small = false;
_melismaEnd = false;
_staffMove = 0;
_beam = 0;
_tabDur = 0;
_up = true;
_beamMode = Beam::Mode::AUTO;
m_isSmall = false;
_melismaEnd = false;
_crossMeasure = CrossMeasure::UNKNOWN;
}

Expand All @@ -93,7 +93,7 @@ ChordRest::ChordRest(const ChordRest& cr, bool link)

_beamMode = cr._beamMode;
_up = cr._up;
_small = cr._small;
m_isSmall = cr.m_isSmall;
_melismaEnd = cr._melismaEnd;
_crossMeasure = cr._crossMeasure;

Expand Down Expand Up @@ -276,7 +276,7 @@ bool ChordRest::readProperties(XmlReader& e)
qDebug("ChordRest: %s obsolete", tag.toLocal8Bit().data());
e.skipCurrentElement();
} else if (tag == "small") {
_small = e.readInt();
m_isSmall = e.readInt();
} else if (tag == "duration") {
setTicks(e.readFraction());
} else if (tag == "ticklen") { // obsolete (version < 1.12)
Expand Down Expand Up @@ -397,7 +397,7 @@ void ChordRest::readAddConnector(ConnectorInfoReader* info, bool pasteMode)

void ChordRest::setSmall(bool val)
{
_small = val;
m_isSmall = val;
}

//---------------------------------------------------------
Expand Down Expand Up @@ -893,7 +893,7 @@ void ChordRest::localSpatiumChanged(qreal oldValue, qreal newValue)
QVariant ChordRest::getProperty(Pid propertyId) const
{
switch (propertyId) {
case Pid::SMALL: return QVariant(small());
case Pid::SMALL: return QVariant(isSmall());
case Pid::BEAM_MODE: return int(beamMode());
case Pid::STAFF_MOVE: return staffMove();
case Pid::DURATION_TYPE: return QVariant::fromValue(actualDurationType());
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/libmscore/chordrest.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ChordRest : public DurationElement
Beam* _beam;
Beam::Mode _beamMode;
bool _up; // actual stem direction
bool _small;
bool m_isSmall;
bool _melismaEnd;

// CrossMeasure: combine 2 tied notes if across a bar line and can be combined in a single duration
Expand Down Expand Up @@ -119,7 +119,7 @@ class ChordRest : public DurationElement
bool up() const { return _up; }
void setUp(bool val) { _up = val; }

bool small() const { return _small; }
bool isSmall() const { return m_isSmall; }
void setSmall(bool val);
void undoSetSmall(bool val);

Expand Down
8 changes: 4 additions & 4 deletions src/engraving/libmscore/clef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Clef::Clef(Score* s)
qreal Clef::mag() const
{
qreal mag = staff() ? staff()->staffMag(tick()) : 1.0;
if (_small) {
if (m_isSmall) {
mag *= score()->styleD(Sid::smallClefMag);
}
return mag;
Expand Down Expand Up @@ -327,8 +327,8 @@ Element* Clef::drop(EditData& data)

void Clef::setSmall(bool val)
{
if (val != _small) {
_small = val;
if (val != m_isSmall) {
m_isSmall = val;
}
}

Expand Down Expand Up @@ -525,7 +525,7 @@ QVariant Clef::getProperty(Pid propertyId) const
case Pid::CLEF_TYPE_CONCERT: return int(_clefTypes._concertClef);
case Pid::CLEF_TYPE_TRANSPOSING: return int(_clefTypes._transposingClef);
case Pid::SHOW_COURTESY: return showCourtesy();
case Pid::SMALL: return small();
case Pid::SMALL: return isSmall();
default:
return Element::getProperty(propertyId);
}
Expand Down
6 changes: 3 additions & 3 deletions src/engraving/libmscore/clef.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ class ClefInfo
/// Graphic representation of a clef.
//
// @P showCourtesy bool show/hide courtesy clef when applicable
// @P small bool small, mid-staff clef (read only, set by layout)
// @P isSmall bool small, mid-staff clef (read only, set by layout)
//---------------------------------------------------------

class Clef final : public Element
{
SymId symId;
bool _showCourtesy = true;
bool _small = false;
bool m_isSmall = false;
bool _forInstrumentChange = false;

ClefTypeList _clefTypes { ClefType::INVALID };
Expand All @@ -167,7 +167,7 @@ class Clef final : public Element

bool isEditable() const override { return false; }

bool small() const { return _small; }
bool isSmall() const { return m_isSmall; }
void setSmall(bool val);

bool showCourtesy() const { return _showCourtesy; }
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3344,7 +3344,7 @@ void Score::cmdSlashFill()
p.segment = s;
p.staffIdx = staffIdx;
p.line = line;
p.fret = FRET_NONE;
p.fret = INVALID_FRET_INDEX;
_is.setRest(false); // needed for tab
nv = noteValForPosition(p, AccidentalType::NONE, error);
}
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/libmscore/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4634,7 +4634,7 @@ void Score::undoChangeClef(Staff* ostaff, Element* e, ClefType ct, bool forInstr
Clef* gclef = 0;
Fraction tick = e->tick();
Fraction rtick = e->rtick();
bool small = (st == SegmentType::Clef);
bool isSmall = (st == SegmentType::Clef);
for (Staff* staff : ostaff->staffList()) {
// if (staff->staffType(tick)->group() != ClefInfo::staffGroup(ct))
// continue;
Expand Down Expand Up @@ -4715,7 +4715,7 @@ void Score::undoChangeClef(Staff* ostaff, Element* e, ClefType ct, bool forInstr
if (forInstrumentChange) {
clef->setForInstrumentChange(true);
}
clef->setSmall(small);
clef->setSmall(isSmall);
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/engraving/libmscore/element.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ namespace Ms {
#define VOICES 4
#endif

// Defined in Windows headers, conflicts with member functions named small().
#undef small

enum class Pid;
enum class SmuflAnchorId;
class StaffType;
Expand Down
Loading

0 comments on commit b7d8f7b

Please sign in to comment.