Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading to C++20 #3578

Merged
merged 47 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
cea08b7
changeless
lpugin Mar 23, 2022
5bd4930
Merge branch 'develop' into develop-pypi
lpugin Mar 23, 2022
5745ba7
Merge branch 'develop' into develop-pypi
lpugin Mar 23, 2022
ad213b9
Merge branch 'develop-pypi' of github.com:rism-ch/verovio into develo…
ahankinson Mar 24, 2022
d434ec7
Merge branch 'develop' into develop-pypi
ahankinson Mar 24, 2022
bf6badb
Merge branch 'develop' into develop-pypi
ahankinson Mar 25, 2022
3ac2eaa
Merge branch 'develop-mensural' into develop-pypi
lpugin May 26, 2022
59b1d23
Merge branch 'develop' into develop-pypi
ahankinson Jun 2, 2022
e745a22
Merge pull request #2915 from rism-digital/develop
lpugin Jun 7, 2022
5d4eabe
Merge branch 'develop' into develop-pypi
ahankinson Jun 7, 2022
8ca8fff
Merge branch 'develop' into develop-pypi
ahankinson Jun 8, 2022
b00b993
Merge branch 'develop-mensural' into develop-pypi
lpugin Jul 15, 2022
8f0973c
Merge branch 'develop' into develop-pypi
ahankinson Nov 4, 2022
927827e
Merge branch 'develop' into develop-pypi
ahankinson Nov 7, 2022
1133564
Merge pull request #3107 from rism-digital/develop
ahankinson Nov 9, 2022
7cb6a02
Merge branch 'develop' into develop-pypi
ahankinson Nov 9, 2022
6824fad
Merge branch 'develop' into develop-pypi
lpugin Nov 23, 2022
9725f25
Merge branch 'develop' into develop-pypi
lpugin Dec 12, 2022
9b90349
Merge branch 'develop' into develop-pypi
lpugin Jan 11, 2023
8dc3cc1
Merge branch 'develop-pae' into develop-pypi
lpugin Feb 16, 2023
8bde0c2
Merge branch 'develop' into develop-pypi
ahankinson Feb 20, 2023
ec1dbc6
Merge branch 'develop' into develop-pypi
ahankinson Feb 28, 2023
400d8e9
Merge branch 'develop' into develop-pypi
ahankinson Feb 28, 2023
f2a321f
Merge branch 'develop' into develop-pypi
lpugin Jul 3, 2023
41140f2
Merge branch 'develop' into develop-pypi
lpugin Dec 15, 2023
6ffba7f
Try C++20
lpugin Jan 19, 2024
6971b2e
add quotes
lpugin Jan 19, 2024
c6cd614
rename branch
lpugin Jan 19, 2024
3921011
Reset cache
lpugin Jan 19, 2024
199368a
Change C++ version in emscripten
lpugin Jan 19, 2024
29fbb92
Move LedgerLine up for some compilers
lpugin Jan 19, 2024
c858185
Remove clang 6.0 and add 10
lpugin Jan 19, 2024
4e37f51
Change g++ and clang CI to 10 to 12 versions
lpugin Jan 19, 2024
c03b92d
Change xcode to c++20
lpugin Jan 19, 2024
9b80afe
Try g++12 on ubuntu 22.04
lpugin Jan 19, 2024
ae148e7
Merge C++20 test
lpugin Jan 20, 2024
5df899b
Use C++20 contains()
lpugin Jan 23, 2024
b933752
Try to use getopt.h on windows
lpugin Jan 25, 2024
3d4f5d1
Revert "Try to use getopt.h on windows"
lpugin Jan 25, 2024
1b3c74e
Make char * const
lpugin Jan 25, 2024
44c829c
Change another char * to const
lpugin Jan 25, 2024
f0f71b2
Change one more to const
lpugin Jan 25, 2024
a5d89df
One more
lpugin Jan 25, 2024
5ef32ed
Fix compiler warning warning C5055
lpugin Jan 25, 2024
533f30d
Fix compiler warning C4305
lpugin Jan 25, 2024
46e8e90
Fix formatting
lpugin Jan 25, 2024
98e5533
Adjust README and CHANGELOG
lpugin Jan 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
# but only for the branches specified
branches:
# Push events on develop branch
- develop
- 'develop'
# Push events on ci-test branch (uncomment if needed for testing purposes)
# - ci-test
paths-ignore:
Expand Down Expand Up @@ -44,7 +44,7 @@ env:
# emscripten
EM_VERSION: latest
EM_CACHE_FOLDER: "emsdk-cache"
EM_CACHE_ID: 2
EM_CACHE_ID: 3

# gh-pages
GH_PAGES_REPO: ${{ github.repository_owner }}/verovio.org # works from rism-digital and from forks
Expand Down Expand Up @@ -74,10 +74,6 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
compiler: g++
version: "9"

- os: ubuntu-20.04
compiler: g++
version: "10"
Expand All @@ -86,13 +82,17 @@ jobs:
compiler: g++
version: "11"

- os: ubuntu-22.04
compiler: g++
version: "12"

- os: ubuntu-20.04
compiler: clang
version: "6.0"
version: "10"

- os: ubuntu-20.04
compiler: clang
version: "9"
version: "11"

- os: ubuntu-20.04
compiler: clang
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [unreleased]
* Support for `fTrem@unitdur` (@eNote-GmbH)
* Upgrade to C++20

## [4.1.0] - 2023-12-15
* Support for staves ordered by `scoreDef`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

Verovio is a fast, portable and lightweight library for engraving [Music Encoding Initiative (MEI)](http://www.music-encoding.org) digital scores into SVG images. Verovio also contains on-the-fly converters to render [Plaine & Easie Code](https://www.iaml.info/plaine-easie-code), [Humdrum](https://www.humdrum.org), [Musedata](https://musedata.org), [MusicXML](https://www.musicxml.com), [EsAC](http://esac-data.org), and [ABC](https://en.wikipedia.org/wiki/ABC_notation) digital scores.

Verovio is written in standard 2017 C++ and can be compiled as a standalone command-line tool, used as a compiled music-rendering library for applications (Qt, python), or compiled into Javascript using the Emscripten LLVM-to-JavaScript compiler. Check out the JavaScript toolkit version of verovio running in the [MEI Viewer](http://www.verovio.org/mei-viewer.xhtml) as well as the [app](http://www.verovio.org/app.html) or [tutorials](https://book.verovio.org/first-steps/) for web integration and user interaction.
Verovio is written in standard 2020 C++ and can be compiled as a standalone command-line tool, used as a compiled music-rendering library for applications (Qt, python), or compiled into Javascript using the Emscripten LLVM-to-JavaScript compiler. Check out the JavaScript toolkit version of verovio running in the [MEI Viewer](http://www.verovio.org/mei-viewer.xhtml) as well as the [app](http://www.verovio.org/app.html) or [tutorials](https://book.verovio.org/first-steps/) for web integration and user interaction.

![Choice interaction](https://raw.githubusercontent.com/rism-digital/verovio.org/gh-pages/movies/reflow.gif)

Expand Down
4 changes: 2 additions & 2 deletions Verovio.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5024,7 +5024,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
Expand Down Expand Up @@ -5083,7 +5083,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
Expand Down
4 changes: 2 additions & 2 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if(MSVC)
add_definitions(/wd4244) # suppress warning of possible loss of precision
add_definitions(-DNO_PAE_SUPPORT) # regex is working differently under Windows so PAE is not supported (yet)
add_definitions(-DUSE_PAE_OLD_PARSER)
add_definitions(/std:c++17)
add_definitions(/std:c++20)
include_directories(../include/win32)
else()
if(CMAKE_BUILD_TYPE MATCHES Debug)
Expand All @@ -60,7 +60,7 @@ else()
# jsonxx raises -Wdollar-in-identifier-extension
# gcc 8.3.1 does not like -Wdollar-in-identifier-extension option.
add_definitions(-Wall -W -pedantic -Wno-unused-parameter -Wno-dollar-in-identifier-extension)
add_definitions(-std=c++17)
add_definitions(-std=c++20)

# extra warnings similar to Xcode compiling settings (most probably covered by -Wall):
# https://github.com/llvm-mirror/clang/blob/master/include/clang/Basic/DiagnosticGroups.td
Expand Down
2 changes: 1 addition & 1 deletion emscripten/buildToolkit
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ my ($lightQ, $version, $chattyQ, $helpQ, $exclusion, $wasmQ, $makeQ, $modularize
my ($nopae, $nohumdrum, $nomusicxml, $nodarms);
my ($FLAGS_NAME, $VERSION, $CHATTY);

my $cpp = 17; # c++ version to compile (11, 14, 17)
my $cpp = 20; # c++ version to compile (11, 14, 17)
my $VEROVIO_ROOT = "..";

Getopt::Long::Configure("bundling");
Expand Down
86 changes: 43 additions & 43 deletions include/vrv/staff.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,49 @@ class Syl;
class TimeSpanningInterface;
class Tuning;

//----------------------------------------------------------------------------
// LedgerLine
//----------------------------------------------------------------------------

/**
* This is a class with no MEI equivalent for representing legder lines.
* A ledger line is represented by a list of dashes.
* Each dash is represented by a pair of points (left - right).
*/
class LedgerLine {
public:
/**
* @name Constructors, destructors, reset methods
* Reset method reset all attribute classes
*/
///@{
LedgerLine();
virtual ~LedgerLine();
virtual void Reset();
///@}

/**
* Add a dash to the ledger line object.
* If necessary merges overlapping dashes.
*/
void AddDash(int left, int right, int extension);

protected:
//
private:
//
public:
/**
* A list of dashes relative to the staff position.
*/
std::list<std::pair<int, int>> m_dashes;

protected:
//
private:
//
};

//----------------------------------------------------------------------------
// Staff
//----------------------------------------------------------------------------
Expand Down Expand Up @@ -249,49 +292,6 @@ class Staff : public Object,
///@}
};

//----------------------------------------------------------------------------
// LedgerLine
//----------------------------------------------------------------------------

/**
* This is a class with no MEI equivalent for representing legder lines.
* A ledger line is represented by a list of dashes.
* Each dash is represented by a pair of points (left - right).
*/
class LedgerLine {
public:
/**
* @name Constructors, destructors, reset methods
* Reset method reset all attribute classes
*/
///@{
LedgerLine();
virtual ~LedgerLine();
virtual void Reset();
///@}

/**
* Add a dash to the ledger line object.
* If necessary merges overlapping dashes.
*/
void AddDash(int left, int right, int extension);

protected:
//
private:
//
public:
/**
* A list of dashes relative to the staff position.
*/
std::list<std::pair<int, int>> m_dashes;

protected:
//
private:
//
};

} // namespace vrv

#endif
6 changes: 3 additions & 3 deletions include/win32/win_getopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int optopt = '?'; /* character checked for validity */
#undef optreset /* see getopt.h */
#define optreset __mingw_optreset
int optreset; /* reset getopt */
char *optarg; /* argument associated with option */
const char *optarg; /* argument associated with option */
#endif

//extern int optind; /* index of first non-option in argv */
Expand Down Expand Up @@ -76,7 +76,7 @@ static int parse_long_options(char * const *, const char *,
static int gcd(int, int);
static void permute_args(int, int, int, char * const *);

static char *place = EMSG; /* option letter processing */
static const char *place = EMSG; /* option letter processing */

/* XXX: set optreset to 1 rather than these two */
static int nonopt_start = -1; /* first non option argument (for permute) */
Expand Down Expand Up @@ -243,7 +243,7 @@ static int
parse_long_options(char * const *nargv, const char *options,
const struct option *long_options, int *idx, int short_too)
{
char *current_argv, *has_equal;
const char *current_argv, *has_equal;
size_t current_argv_len;
int i, ambiguous, match;

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ def get_version() -> str:
# extra compile arguments
EXTRA_COMPILE_ARGS = ['-DPYTHON_BINDING']
if platform.system() != 'Windows':
EXTRA_COMPILE_ARGS += ['-std=c++17',
EXTRA_COMPILE_ARGS += ['-std=c++20',
'-Wno-write-strings', '-Wno-overloaded-virtual', '-g0']
else:
EXTRA_COMPILE_ARGS += ['/std:c++17',
EXTRA_COMPILE_ARGS += ['/std:c++20',
'-DNO_PAE_SUPPORT']

verovio_module = Extension('verovio._verovio',
Expand Down
2 changes: 1 addition & 1 deletion src/accid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void Accid::AdjustX(LayerElement *element, const Doc *doc, int staffSize, std::v
leftAccids.push_back(accid);
return;
}
if (adjustedAccids.count(accid) == 0) return;
if (!adjustedAccids.contains(accid)) return;
}

int xRelShift = 0;
Expand Down
5 changes: 3 additions & 2 deletions src/measure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,9 @@ const Staff *Measure::GetBottomVisibleStaff() const
int Measure::EnclosesTime(int time) const
{
int repeat = 1;
double timeDuration
= m_measureAligner.GetRightAlignment()->GetTime() * DURATION_4 / DUR_MAX * 60.0 / m_currentTempo * 1000.0 + 0.5;
double timeDuration = m_measureAligner.GetRightAlignment()->GetTime() * static_cast<int>(DURATION_4) / DUR_MAX
* 60.0 / m_currentTempo * 1000.0
+ 0.5;
std::vector<double>::const_iterator iter;
for (iter = m_realTimeOffsetMilliseconds.begin(); iter != m_realTimeOffsetMilliseconds.end(); ++iter) {
if ((time >= *iter) && (time <= *iter + timeDuration)) return repeat;
Expand Down
6 changes: 3 additions & 3 deletions src/midifunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ FunctorCode InitMaxMeasureDurationFunctor::VisitMeasureEnd(Measure *measure)
const double tempo = this->GetAdjustedTempo();
measure->SetCurrentTempo(tempo);

const double scoreTimeIncrement
= measure->m_measureAligner.GetRightAlignment()->GetTime() * m_multiRestFactor * DURATION_4 / DUR_MAX;
const double scoreTimeIncrement = measure->m_measureAligner.GetRightAlignment()->GetTime() * m_multiRestFactor
* static_cast<int>(DURATION_4) / DUR_MAX;
m_currentScoreTime += scoreTimeIncrement;
m_currentRealTimeSeconds += scoreTimeIncrement * 60.0 / tempo;
m_multiRestFactor = 1;
Expand Down Expand Up @@ -698,7 +698,7 @@ FunctorCode GenerateMIDIFunctor::VisitPedal(const Pedal *pedal)
{
if (!pedal->HasDir()) return FUNCTOR_CONTINUE;

double pedalTime = pedal->GetStart()->GetAlignment()->GetTime() * DURATION_4 / DUR_MAX;
double pedalTime = pedal->GetStart()->GetAlignment()->GetTime() * static_cast<int>(DURATION_4) / DUR_MAX;
double startTime = m_totalTime + pedalTime;
int tpq = m_midiFile->getTPQ();

Expand Down
8 changes: 4 additions & 4 deletions src/view_neume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ void View::DrawNc(DeviceContext *dc, LayerElement *element, Layer *layer, Staff
struct drawingParams {
wchar_t fontNo = SMUFL_E990_chantPunctum;
wchar_t fontNoLiq[5] = {};
float xOffset = 0;
float yOffset = 0;
float xOffsetLiq[5] = { 0, 0, 0, 0, 0 };
float yOffsetLiq[5] = { 0, 0, 0, 0, 0 };
double xOffset = 0;
double yOffset = 0;
double xOffsetLiq[5] = { 0, 0, 0, 0, 0 };
double yOffsetLiq[5] = { 0, 0, 0, 0, 0 };
};
std::vector<drawingParams> params;
params.push_back(drawingParams());
Expand Down
Loading