diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 57c8328..4ed7e5d 100755 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,4 +1,4 @@ -v2.0 (2022-5-8) +v2.0 (2022-5-10) - Changed project name to rsgain - Added "Easy Mode" with recursive directory scanning. Old command line syntax now known as "Custom Mode" - Added multithreaded scanning diff --git a/CMakeLists.txt b/CMakeLists.txt index fbbdfd6..d760298 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,12 @@ project( set(CMAKE_C_STANDARD 99) set(CMAKE_CXX_STANDARD 20) set(EXECUTABLE_TITLE "rsgain") + +# GCC 9 and earlier are not supported due to C++20 features +if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10) + message(FATAL_ERROR "GCC 10 and later supported only") +endif () + configure_file( "${PROJECT_SOURCE_DIR}/config/config.h.in" "${PROJECT_BINARY_DIR}/config.h" @@ -166,7 +172,7 @@ else () if (NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") endif() - set(CPACK_DEBIAN_PACKAGE_DEPENDS "libavcodec58 (>= 4.2.4), libavutil56 (>= 4.2.4), libswresample3 (>= 4.2.4), libavformat58 (>= 4.2.4), libtag1v5 (>= 1.11.1), libebur128-1 (>=1.2.4), libc6 (>=2.29)") + set(CPACK_DEBIAN_PACKAGE_DEPENDS "libavcodec58 (>= 4.2.4), libavutil56 (>= 4.2.4), libswresample3 (>= 4.2.4), libavformat58 (>= 4.2.4), libtag1v5 (>= 1.11.1), libebur128-1 (>=1.2.4), libc6 (>=2.29), libstdc++6 (>=10.2)") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "complexlogic") set(CPACK_DEBIAN_PACKAGE_SECTION "utils") set(CPACK_DEBIAN_ARCHIVE_TYPE "gnutar") diff --git a/docs/BUILDING.md b/docs/BUILDING.md index 7de8c13..830d2fd 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -9,8 +9,13 @@ rsgain builds natively on Unix and Windows, and features a cross-platform CMake + libavutil - inih +rsgain uses a few C++20 features, and as such requires a relatively modern compiler to build: +- On Windows, use Visual Studio 2022 +- On Linux, use GCC 11 or later if possible. rsgain will also build with GCC 10, but the time elapsed statistical output will be disabled (no effect on core functionality). GCC versions 9 and earlier are not supported. +- On macOS, the latest available Xcode for your machine should work. + ## Unix -Before starting, make sure you have the build tools Git, CMake, pkg-config, and GCC installed. +Before starting, make sure you have the build tools Git, CMake and pkg-config installed. Install the required dependencies: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ce8c94f..d338660 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,11 @@ if (WIN32) add_executable(${EXECUTABLE_TITLE} "rsgain.c" "scan.cpp" "output.c" "tag.cpp" "easymode.cpp" "${PROJECT_BINARY_DIR}/rsgain.manifest") else() add_executable(${EXECUTABLE_TITLE} "rsgain.c" "scan.cpp" "output.c" "tag.cpp" "easymode.cpp") + + # GCC 10 requires linking with pthread for some reason + if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11) + target_link_libraries(${EXECUTABLE_TITLE} pthread) + endif () endif() set (EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}") diff --git a/src/easymode.cpp b/src/easymode.cpp index c686415..ba13e40 100755 --- a/src/easymode.cpp +++ b/src/easymode.cpp @@ -610,7 +610,8 @@ void scan_easy(const char *directory, const char *overrides_file) } output(COLOR_GREEN "Scanning Complete" COLOR_OFF "\n"); - // Calculate time + // Calculate time (not available in GCC 10 and earlier) +#if CALC_TIME std::string time_string; std::chrono::hh_mm_ss elapsed(end_time - start_time); int h = elapsed.hours().count(); @@ -625,6 +626,7 @@ void scan_easy(const char *directory, const char *overrides_file) else { time_string = std::to_string(s) + "s"; } +#endif // Format file total string std::stringstream ss; @@ -632,7 +634,9 @@ void scan_easy(const char *directory, const char *overrides_file) ss << std::fixed << total_files; output(COLOR_YELLOW "Files Scanned:" COLOR_OFF " %s\n", ss.str().c_str()); +#if CALC_TIME output(COLOR_YELLOW "Time Elapsed:" COLOR_OFF " %s\n", time_string.c_str()); +#endif output("\n"); // Inform user of errors diff --git a/src/easymode.hpp b/src/easymode.hpp index a635ee5..e4915ea 100755 --- a/src/easymode.hpp +++ b/src/easymode.hpp @@ -5,6 +5,17 @@ #include #include +#ifdef __GNUC__ +#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +#if GCC_VERSION > 110000 +#define CALC_TIME 1 +#else +#define CALC_TIME 0 +#endif +#else +#define CALC_TIME 1 +#endif + typedef enum { INVALID = -1, MP2,