Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
AW1534 authored Aug 2, 2024
2 parents 2282bdc + 1c86584 commit 2761316
Show file tree
Hide file tree
Showing 119 changed files with 743 additions and 818 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jobs:
runs-on: ${{ matrix.os }}
env:
CMAKE_OPTS: >-
-Werror=dev
-DUSE_WERROR=ON
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DUSE_COMPILE_CACHE=ON
Expand Down Expand Up @@ -176,6 +177,7 @@ jobs:
container: ghcr.io/lmms/linux.mingw:20.04
env:
CMAKE_OPTS: >-
-Werror=dev
-DUSE_WERROR=ON
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DUSE_COMPILE_CACHE=ON
Expand Down Expand Up @@ -293,6 +295,7 @@ jobs:
-B build `
-G Ninja `
--toolchain C:/vcpkg/scripts/buildsystems/vcpkg.cmake `
-Werror=dev `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DUSE_COMPILE_CACHE=ON `
-DUSE_WERROR=ON `
Expand Down
65 changes: 2 additions & 63 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -630,69 +630,6 @@ ENDIF(WANT_DEBUG_FPE)
# check for libsamplerate
FIND_PACKAGE(Samplerate 0.1.8 MODULE REQUIRED)

# Shim the SYSTEM property for older CMake versions
if(CMAKE_VERSION VERSION_LESS "3.25")
define_property(TARGET
PROPERTY SYSTEM
INHERITED
BRIEF_DOCS "Shim of built-in SYSTEM property for CMake versions less than 3.25"
FULL_DOCS "Non-functional, but allows the property to be inherited properly."
"See the CMake documentation at https://cmake.org/cmake/help/latest/prop_tgt/SYSTEM.html."
)
endif()

# Add warning and error flags
option(USE_WERROR "Treat compiler warnings as errors" OFF)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(COMPILE_ERROR_FLAGS
"-Wall" # Enable most warnings by default
"-Werror=unused-function" # Unused functions are an error
# TODO: Fix the code and remove the following:
"-Wno-sign-compare" # Permit comparisons between signed and unsigned integers
"-Wno-strict-overflow" # Permit optimisations assuming no signed overflow
)
set(THIRD_PARTY_COMPILE_ERROR_FLAGS
"-w" # Disable all warnings
)

# Due to a regression in gcc-4.8.X, we need to disable array-bounds check
# TODO: Is this still necessary?
if(CMAKE_COMPILER_IS_GNUCXX)
list(APPEND COMPILE_ERROR_FLAGS
"-Wno-array-bounds" # Permit out-of-bounds array subscripts
"-Wno-attributes" # Permit unrecognised attributes
)
endif()

if(USE_WERROR)
list(APPEND COMPILE_ERROR_FLAGS
"-Werror" # Treat warnings as errors
)
endif()
elseif(MSVC)
set(COMPILE_ERROR_FLAGS
"/W2" # Enable some warnings by default
"/external:W0" # Don't emit warnings for third-party code
"/external:anglebrackets" # Consider headers included with angle brackets to be third-party
"/external:templates-" # Still emit warnings from first-party instantiations of third-party templates
# Silence "class X needs to have DLL-interface to be used by clients of
# class Y" warnings. These aren't trivial to address, and don't pose a
# problem for us since we build all modules with the same compiler and
# options, and dynamically link the CRT.
"/wd4251"
)
set(THIRD_PARTY_COMPILE_ERROR_FLAGS
"/W0" # Disable all warnings
)

if(USE_WERROR)
list(APPEND COMPILE_ERROR_FLAGS
"/WX" # Treat warnings as errors
)
endif()
endif()
add_compile_options("$<IF:$<BOOL:$<TARGET_PROPERTY:SYSTEM>>,${THIRD_PARTY_COMPILE_ERROR_FLAGS},${COMPILE_ERROR_FLAGS}>")

IF(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
Expand Down Expand Up @@ -774,6 +711,8 @@ add_sanitizer(memory "Clang" WANT_DEBUG_MSAN STATUS_DEBUG_MSAN -fno-omit-frame-p
# not being found by PeakController
add_sanitizer(undefined "GNU|Clang" WANT_DEBUG_UBSAN STATUS_DEBUG_UBSAN -fno-sanitize=vptr)

# Add warning and error flags
include(ErrorFlags)

# use ccache
include(CompileCache)
Expand Down
72 changes: 72 additions & 0 deletions cmake/modules/ErrorFlags.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Shim the SYSTEM property for older CMake versions - we rely on this property
# to determine which set of error flags to use.
if(CMAKE_VERSION VERSION_LESS "3.25")
define_property(TARGET
PROPERTY SYSTEM
INHERITED
BRIEF_DOCS "Shim of built-in SYSTEM property for CMake versions less than 3.25"
FULL_DOCS "Non-functional, but allows the property to be inherited properly."
"See the CMake documentation at https://cmake.org/cmake/help/latest/prop_tgt/SYSTEM.html."
)
endif()

# Allow the user to control whether to treat warnings as errors
option(USE_WERROR "Treat compiler warnings as errors" OFF)

# Compute the appropriate flags for the current compiler and options
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(COMPILE_ERROR_FLAGS
"-Wall" # Enable most warnings by default
)
set(THIRD_PARTY_COMPILE_ERROR_FLAGS
"-w" # Disable all warnings
)

if(CMAKE_COMPILER_IS_GNUCXX)
list(APPEND COMPILE_ERROR_FLAGS
# The following warning generates false positives that are difficult
# to work around, in particular when inlining calls to standard
# algorithms performed on single-element arrays. See, for example,
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111273.
"-Wno-array-bounds" # Permit out-of-bounds array subscripts
)

if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11")
list(APPEND COMPILE_ERROR_FLAGS
# This has the same problems described above for "array-bounds".
"-Wno-stringop-overread" # Permit string functions overreading the source
)
endif()
endif()

if(USE_WERROR)
list(APPEND COMPILE_ERROR_FLAGS
"-Werror" # Treat warnings as errors
)
endif()
elseif(MSVC)
set(COMPILE_ERROR_FLAGS
"/W2" # Enable some warnings by default
"/external:W0" # Don't emit warnings for third-party code
"/external:anglebrackets" # Consider headers included with angle brackets to be third-party
"/external:templates-" # Still emit warnings from first-party instantiations of third-party templates
# Silence "class X needs to have DLL-interface to be used by clients of
# class Y" warnings. These aren't trivial to address, and don't pose a
# problem for us since we build all modules with the same compiler and
# options, and dynamically link the CRT.
"/wd4251"
)
set(THIRD_PARTY_COMPILE_ERROR_FLAGS
"/W0" # Disable all warnings
)

if(USE_WERROR)
list(APPEND COMPILE_ERROR_FLAGS
"/WX" # Treat warnings as errors
)
endif()
endif()

# Add the flags to the whole directory tree. We use the third-party flags for
# targets whose SYSTEM property is true, and the normal flags otherwise.
add_compile_options("$<IF:$<BOOL:$<TARGET_PROPERTY:SYSTEM>>,${THIRD_PARTY_COMPILE_ERROR_FLAGS},${COMPILE_ERROR_FLAGS}>")
16 changes: 9 additions & 7 deletions cmake/modules/FindPulseAudio.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ ENDIF (PULSEAUDIO_INCLUDE_DIR AND PULSEAUDIO_LIBRARIES)
IF (NOT WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
INCLUDE(FindPkgConfig)
pkg_check_modules(PA libpulse)
set(_PASIncDir ${PA_INCLUDE_DIRS})
set(_PASLinkDir ${PA_LIBRARY_DIRS})
set(_PASLinkFlags ${PA_LDFLAGS})
set(_PASCflags ${PA_CFLAGS})
SET(PULSEAUDIO_DEFINITIONS ${_PASCflags})
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PA libpulse)
set(_PASIncDir ${PA_INCLUDE_DIRS})
set(_PASLinkDir ${PA_LIBRARY_DIRS})
set(_PASLinkFlags ${PA_LDFLAGS})
set(_PASCflags ${PA_CFLAGS})
set(PULSEAUDIO_DEFINITIONS ${_PASCflags})
endif()
ENDIF (NOT WIN32)

FIND_PATH(PULSEAUDIO_INCLUDE_DIR pulse/pulseaudio.h
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/FindSndio.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ check_library_exists(sndio sio_open "${SNDIO_LIBRARY_DIR}" HAVE_SIO_OPEN)
find_path(SNDIO_INCLUDE_DIR sndio.h)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SNDIO DEFAULT_MSG SNDIO_LIBRARY SNDIO_INCLUDE_DIR HAVE_SIO_OPEN)
find_package_handle_standard_args(Sndio DEFAULT_MSG SNDIO_LIBRARY SNDIO_INCLUDE_DIR HAVE_SIO_OPEN)

if(SNDIO_FOUND)
set(SNDIO_INCLUDE_DIRS "${SNDIO_INCLUDE_DIR}")
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/FindSoundIo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ find_path(SOUNDIO_INCLUDE_DIR NAMES soundio/soundio.h)
find_library(SOUNDIO_LIBRARY NAMES soundio)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SOUNDIO DEFAULT_MSG SOUNDIO_LIBRARY SOUNDIO_INCLUDE_DIR)
find_package_handle_standard_args(SoundIo DEFAULT_MSG SOUNDIO_LIBRARY SOUNDIO_INCLUDE_DIR)

mark_as_advanced(SOUNDIO_INCLUDE_DIR SOUNDIO_LIBRARY)
4 changes: 2 additions & 2 deletions include/AudioEngineWorkerThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class AudioEngineWorkerThread : public QThread

private:
std::atomic<ThreadableJob*> m_items[JOB_QUEUE_SIZE];
std::atomic_int m_writeIndex;
std::atomic_int m_itemsDone;
std::atomic_size_t m_writeIndex;
std::atomic_size_t m_itemsDone;
OperationMode m_opMode;
} ;

Expand Down
10 changes: 3 additions & 7 deletions include/AudioPortAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,7 @@ class AudioPortAudio : public AudioDevice
return QT_TRANSLATE_NOOP( "AudioDeviceSetupWidget", "PortAudio" );
}


int process_callback( const float *_inputBuffer,
float * _outputBuffer,
unsigned long _framesPerBuffer );

int process_callback(const float* _inputBuffer, float* _outputBuffer, f_cnt_t _framesPerBuffer);

class setupWidget : public gui::AudioDeviceSetupWidget
{
Expand Down Expand Up @@ -151,8 +147,8 @@ class AudioPortAudio : public AudioDevice
bool m_wasPAInitError;

SampleFrame* m_outBuf;
int m_outBufPos;
int m_outBufSize;
std::size_t m_outBufPos;
fpp_t m_outBufSize;

bool m_stopped;

Expand Down
65 changes: 0 additions & 65 deletions include/AudioResampler.h

This file was deleted.

1 change: 1 addition & 0 deletions include/BasicFilters.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#endif

#include <cmath>
#include <array>

#include "lmms_basics.h"
#include "lmms_constants.h"
Expand Down
4 changes: 0 additions & 4 deletions include/BufferManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ class LMMS_EXPORT BufferManager
public:
static void init( fpp_t fpp );
static SampleFrame* acquire();
// audio-buffer-mgm
static void clear( SampleFrame* ab, const f_cnt_t frames,
const f_cnt_t offset = 0 );

static void release( SampleFrame* buf );

private:
Expand Down
1 change: 1 addition & 0 deletions include/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ class LMMS_EXPORT ConfigManager : public QObject

QString defaultVersion() const;

static bool enableBlockedPlugins();

static QStringList availableVstEmbedMethods();
QString vstEmbedMethod() const;
Expand Down
2 changes: 0 additions & 2 deletions include/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ class LMMS_EXPORT Engine : public QObject
return s_projectJournal;
}

static bool ignorePluginBlacklist();

#ifdef LMMS_HAVE_LV2
static class Lv2Manager * getLv2Manager()
{
Expand Down
7 changes: 4 additions & 3 deletions include/InstrumentFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
#ifndef LMMS_INSTRUMENT_FUNCTIONS_H
#define LMMS_INSTRUMENT_FUNCTIONS_H

#include "JournallingObject.h"
#include "lmms_basics.h"
#include <array>

#include "AutomatableModel.h"
#include "TempoSyncKnobModel.h"
#include "ComboBoxModel.h"
#include "JournallingObject.h"
#include "TempoSyncKnobModel.h"

namespace lmms
{
Expand Down
4 changes: 2 additions & 2 deletions include/LocklessAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class LocklessAllocator
std::atomic_int * m_freeState;
size_t m_freeStateSets;

std::atomic_int m_available;
std::atomic_int m_startIndex;
std::atomic_size_t m_available;
std::atomic_size_t m_startIndex;

} ;

Expand Down
Loading

0 comments on commit 2761316

Please sign in to comment.