diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci_build.yml index 014f9a18b28..947667de083 100644 --- a/.github/workflows/ci_build.yml +++ b/.github/workflows/ci_build.yml @@ -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: @@ -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 @@ -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" @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a415ca506a..fdc3eedc0ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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` diff --git a/README.md b/README.md index a15c89f03ec..89d73c6f194 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/Verovio.xcodeproj/project.pbxproj b/Verovio.xcodeproj/project.pbxproj index 6a55d542017..111c13c9f03 100644 --- a/Verovio.xcodeproj/project.pbxproj +++ b/Verovio.xcodeproj/project.pbxproj @@ -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; @@ -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; diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 5cddd3ed514..0c865ce37df 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -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) @@ -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 diff --git a/emscripten/buildToolkit b/emscripten/buildToolkit index b6f20e5a7ae..afde9dd2b76 100755 --- a/emscripten/buildToolkit +++ b/emscripten/buildToolkit @@ -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"); diff --git a/include/vrv/staff.h b/include/vrv/staff.h index 51cbdbd9346..cd68fe3eaa4 100644 --- a/include/vrv/staff.h +++ b/include/vrv/staff.h @@ -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> m_dashes; + +protected: + // +private: + // +}; + //---------------------------------------------------------------------------- // Staff //---------------------------------------------------------------------------- @@ -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> m_dashes; - -protected: - // -private: - // -}; - } // namespace vrv #endif diff --git a/include/win32/win_getopt.h b/include/win32/win_getopt.h index 1dd690ee212..d8dd0019aee 100644 --- a/include/win32/win_getopt.h +++ b/include/win32/win_getopt.h @@ -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 */ @@ -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) */ @@ -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; diff --git a/setup.py b/setup.py index fc1f38b2709..a310909ee60 100644 --- a/setup.py +++ b/setup.py @@ -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', diff --git a/src/accid.cpp b/src/accid.cpp index 4f3ba9b2dea..73a12003ff8 100644 --- a/src/accid.cpp +++ b/src/accid.cpp @@ -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; diff --git a/src/measure.cpp b/src/measure.cpp index 4439fe36ce8..7b566400378 100644 --- a/src/measure.cpp +++ b/src/measure.cpp @@ -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(DURATION_4) / DUR_MAX + * 60.0 / m_currentTempo * 1000.0 + + 0.5; std::vector::const_iterator iter; for (iter = m_realTimeOffsetMilliseconds.begin(); iter != m_realTimeOffsetMilliseconds.end(); ++iter) { if ((time >= *iter) && (time <= *iter + timeDuration)) return repeat; diff --git a/src/midifunctor.cpp b/src/midifunctor.cpp index cdff91503cc..5bf7f6246e8 100644 --- a/src/midifunctor.cpp +++ b/src/midifunctor.cpp @@ -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(DURATION_4) / DUR_MAX; m_currentScoreTime += scoreTimeIncrement; m_currentRealTimeSeconds += scoreTimeIncrement * 60.0 / tempo; m_multiRestFactor = 1; @@ -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(DURATION_4) / DUR_MAX; double startTime = m_totalTime + pedalTime; int tpq = m_midiFile->getTPQ(); diff --git a/src/view_neume.cpp b/src/view_neume.cpp index eeeaed614b1..971a8bf3304 100644 --- a/src/view_neume.cpp +++ b/src/view_neume.cpp @@ -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 params; params.push_back(drawingParams());