Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
75 changes: 44 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0)

PROJECT(lmms)

Expand All @@ -11,6 +11,7 @@ IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0026 OLD)
CMAKE_POLICY(SET CMP0050 OLD)
ENDIF()
CMAKE_POLICY(SET CMP0020 NEW)
ENDIF(COMMAND CMAKE_POLICY)

INCLUDE(CheckSubmodules)
Expand Down Expand Up @@ -112,6 +113,7 @@ IF(LMMS_BUILD_MSYS AND CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(STATUS_STK "not built as requested")
ENDIF()

SET(CMAKE_CXX_STANDARD_REQUIRED ON)

CHECK_INCLUDE_FILES(stdint.h LMMS_HAVE_STDINT_H)
CHECK_INCLUDE_FILES(stdlib.h LMMS_HAVE_STDLIB_H)
Expand Down Expand Up @@ -307,13 +309,13 @@ ENDIF(WANT_PORTAUDIO)
IF(WANT_SOUNDIO)
FIND_PACKAGE(SoundIo)
IF(SOUNDIO_FOUND)
SET(LMMS_HAVE_SOUNDIO TRUE)
SET(STATUS_SOUNDIO "OK")
INCLUDE_DIRECTORIES("${SOUNDIO_INCLUDE_DIR}")
SET(LMMS_HAVE_SOUNDIO TRUE)
SET(STATUS_SOUNDIO "OK")
INCLUDE_DIRECTORIES("${SOUNDIO_INCLUDE_DIR}")
ELSE(SOUNDIO_FOUND)
SET(SOUNDIO_INCLUDE_DIR "")
SET(STATUS_SOUNDIO "not found, please install libsoundio if you require libsoundio support")
SET(SOUNDIO_LIBRARY "")
SET(SOUNDIO_INCLUDE_DIR "")
SET(STATUS_SOUNDIO "not found, please install libsoundio if you require libsoundio support")
SET(SOUNDIO_LIBRARY "")
ENDIF(SOUNDIO_FOUND)
ENDIF(WANT_SOUNDIO)

Expand Down Expand Up @@ -489,32 +491,41 @@ ELSE()
SET (STATUS_DEBUG_FPE "Disabled")
ENDIF(WANT_DEBUG_FPE)


# check for libsamplerate
PKG_CHECK_MODULES(SAMPLERATE REQUIRED samplerate>=0.1.8)

# set compiler flags
SET(WERROR_FLAGS "-Wall -Werror=unused-function -Wno-sign-compare -Wno-strict-overflow")
OPTION(USE_WERROR "Add -werror to the build flags. Stops the build on warnings" OFF)
IF(${USE_WERROR})
SET(WERROR_FLAGS "${WERROR_FLAGS} -Werror")
ENDIF()
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|AppleClang")
SET(WERROR_FLAGS "-Wall -Werror=unused-function -Wno-sign-compare -Wno-strict-overflow")
OPTION(USE_WERROR "Add -werror to the build flags. Stops the build on warnings" OFF)
IF(${USE_WERROR})
SET(WERROR_FLAGS "${WERROR_FLAGS} -Werror")
ENDIF()

# Due to a regression in gcc-4.8.X, we need to disable array-bounds check
IF (CMAKE_COMPILER_IS_GNUCXX AND ((CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "4.8.0") OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.8.0") OR LMMS_BUILD_WIN32))
SET(WERROR_FLAGS "${WERROR_FLAGS} -Wno-array-bounds")
# Due to a regression in gcc-4.8.X, we need to disable array-bounds check
IF (CMAKE_COMPILER_IS_GNUCXX AND ((CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "4.8.0") OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.8.0") OR LMMS_BUILD_WIN32))
SET(WERROR_FLAGS "${WERROR_FLAGS} -Wno-array-bounds")
ENDIF()
ELSEIF(MSVC)
# Remove any existing /W flags
STRING(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
SET(WERROR_FLAGS "/W2")
IF(${USE_WERROR})
SET(WERROR_FLAGS "${WERROR_FLAGS} /WX")
ENDIF()
ENDIF()


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)
# Set the possible values of build type for cmake-gui
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
"MinSizeRel" "RelWithDebInfo")
ENDIF()

SET(CMAKE_C_FLAGS "${WERROR_FLAGS} ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-fno-exceptions ${WERROR_FLAGS} ${CMAKE_CXX_FLAGS}")
SET(CMAKE_CXX_FLAGS "${WERROR_FLAGS} ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLMMS_DEBUG")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DLMMS_DEBUG")

Expand All @@ -528,23 +539,25 @@ LIST(SORT LMMS_INCLUDES)
# we somehow have to make LMMS-binary depend on MOC-files
ADD_FILE_DEPENDENCIES("${CMAKE_BINARY_DIR}/lmmsconfig.h")

IF(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
ELSE(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DPIC")
ENDIF(WIN32)
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|AppleClang")
IF(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
ELSE(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DPIC")
ENDIF(WIN32)
ENDIF()

# use ccache
OPTION(USE_CCACHE "Use ccache for compilation" OFF)
IF(USE_CCACHE)
FIND_PROGRAM(CCACHE ccache)
IF (CCACHE)
MESSAGE(STATUS "Using ccache found in PATH")
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE})
ELSE()
MESSAGE(WARNING "USE_CCACHE enabled, but no ccache found")
ENDIF()
FIND_PROGRAM(CCACHE ccache)
IF (CCACHE)
MESSAGE(STATUS "Using ccache found in PATH")
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE})
ELSE()
MESSAGE(WARNING "USE_CCACHE enabled, but no ccache found")
ENDIF()
ENDIF()

# make sub-directories
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/BuildPlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME)
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-bundle_loader ${CMAKE_BINARY_DIR}/lmms")
ADD_DEPENDENCIES(${PLUGIN_NAME} lmms)
ENDIF(LMMS_BUILD_APPLE)
IF(LMMS_BUILD_WIN32)
IF(LMMS_BUILD_WIN32 AND STRIP)
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES PREFIX "")
ADD_CUSTOM_COMMAND(TARGET ${PLUGIN_NAME} POST_BUILD COMMAND ${STRIP} $<TARGET_FILE:${PLUGIN_NAME}>)
ENDIF(LMMS_BUILD_WIN32)
ENDIF()

SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${RCC_OUT} ${plugin_MOC_out}")
ENDMACRO(BUILD_PLUGIN)
Expand Down
4 changes: 4 additions & 0 deletions cmake/modules/DetectMachine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ MESSAGE("PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
SET(LMMS_HOST_X86 FALSE)
SET(LMMS_HOST_X86_64 FALSE)

IF(MSVC)
STRING(REGEX MATCH "86_64|amd64|AMD64" WIN64 "${CMAKE_SYSTEM_PROCESSOR}")
ENDIF()

IF(WIN32)
IF(WIN64)
SET(IS_X86_64 TRUE)
Expand Down
2 changes: 1 addition & 1 deletion include/BasicFilters.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include "interpolation.h"
#include "MemoryManager.h"

template<ch_cnt_t CHANNELS> class BasicFilters;
template<ch_cnt_t CHANNELS=DEFAULT_CHANNELS> class BasicFilters;

template<ch_cnt_t CHANNELS>
class LinkwitzRiley
Expand Down
3 changes: 2 additions & 1 deletion include/Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#ifndef CONTROLLER_H
#define CONTROLLER_H

#include "export.h"
#include "Engine.h"
#include "Model.h"
#include "JournallingObject.h"
Expand All @@ -40,7 +41,7 @@ class ControllerConnection;
typedef QVector<Controller *> ControllerVector;


class Controller : public Model, public JournallingObject
class EXPORT Controller : public Model, public JournallingObject
{
Q_OBJECT
public:
Expand Down
40 changes: 8 additions & 32 deletions include/MicroTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,45 +25,21 @@
#ifndef MICRO_TIMER
#define MICRO_TIMER

#include "lmmsconfig.h"

#ifdef LMMS_HAVE_SYS_TIME_H
#include <sys/time.h>
#endif

#include <cstdlib>
#include "lmms_basics.h"

#include <chrono>

class MicroTimer
{
public:
inline MicroTimer()
{
reset();
}
using time_point = std::chrono::steady_clock::time_point;

inline ~MicroTimer()
{
}

inline void reset()
{
gettimeofday( &begin, NULL );
}

inline int elapsed() const
{
struct timeval now;
gettimeofday( &now, NULL );
return ( now.tv_sec - begin.tv_sec ) * 1000 * 1000 +
( now.tv_usec - begin.tv_usec );
}
public:
MicroTimer();
~MicroTimer();

void reset();
int elapsed() const;

private:
struct timeval begin;

time_point begin;
} ;


Expand Down
1 change: 1 addition & 0 deletions include/MixerProfiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <QFile>

#include "lmms_basics.h"
#include "MicroTimer.h"

class MixerProfiler
Expand Down
2 changes: 1 addition & 1 deletion include/NotePlayHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#define NOTE_PLAY_HANDLE_H

#include "AtomicInt.h"
#include "BasicFilters.h"
#include "Note.h"
#include "PlayHandle.h"
#include "Track.h"
Expand All @@ -36,7 +37,6 @@ class QReadWriteLock;
class InstrumentTrack;
class NotePlayHandle;

template<ch_cnt_t=DEFAULT_CHANNELS> class BasicFilters;
typedef QList<NotePlayHandle *> NotePlayHandleList;
typedef QList<const NotePlayHandle *> ConstNotePlayHandleList;

Expand Down
4 changes: 3 additions & 1 deletion include/PlayHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include <QtCore/QList>
#include <QtCore/QMutex>

#include "export.h"

#include "MemoryManager.h"

#include "ThreadableJob.h"
Expand All @@ -38,7 +40,7 @@ class QThread;
class Track;
class AudioPort;

class PlayHandle : public ThreadableJob
class EXPORT PlayHandle : public ThreadableJob
{
public:
enum Types
Expand Down
7 changes: 4 additions & 3 deletions include/RemotePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "MidiEvent.h"
#include "VstSyncData.h"

#include <atomic>
#include <vector>
#include <cstdio>
#include <cstdlib>
Expand Down Expand Up @@ -234,7 +235,7 @@ class shmFifo
// recursive lock
inline void lock()
{
if( !isInvalid() && __sync_add_and_fetch( &m_lockDepth, 1 ) == 1 )
if( !isInvalid() && m_lockDepth.fetch_add( 1 ) == 0 )
{
m_dataSem.acquire();
}
Expand All @@ -243,7 +244,7 @@ class shmFifo
// recursive unlock
inline void unlock()
{
if( __sync_sub_and_fetch( &m_lockDepth, 1) <= 0 )
if( m_lockDepth.fetch_sub( 1 ) <= 1 )
{
m_dataSem.release();
}
Expand Down Expand Up @@ -404,7 +405,7 @@ class shmFifo
shmData * m_data;
QSystemSemaphore m_dataSem;
QSystemSemaphore m_messageSem;
volatile int m_lockDepth;
std::atomic_int m_lockDepth;

} ;
#endif
Expand Down
1 change: 1 addition & 0 deletions include/TrackContainerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ public slots:
TrackContainerView* m_trackContainerView;

} ;
friend class TrackContainerView::scrollArea;

TrackContainer* m_tc;
typedef QList<TrackView *> trackViewList;
Expand Down
1 change: 0 additions & 1 deletion include/export.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*
*/


#ifndef EXPORT_H
#define EXPORT_H

Expand Down
11 changes: 7 additions & 4 deletions include/lmms_basics.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "lmmsconfig.h"

#ifdef LMMS_HAVE_STDINT_H
#include <stdint.h>
#include <cstdint>
#endif


Expand All @@ -56,9 +56,12 @@ typedef uint16_t fx_ch_t; // FX-channel (0 to MAX_EFFECT_CHANNEL)
typedef uint32_t jo_id_t; // (unique) ID of a journalling object

// use for improved branch prediction
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)
#define likely(x) Q_LIKELY(x)
#define unlikely(x) Q_UNLIKELY(x)

// windows headers define "min" and "max" macros, breaking the methods bwloe
#undef min
#undef max

template<typename T>
struct typeInfo
Expand Down Expand Up @@ -93,7 +96,7 @@ struct typeInfo
template<>
inline float typeInfo<float>::minEps()
{
return 1.0e-10;
return 1.0e-10f;
}

template<>
Expand Down
8 changes: 6 additions & 2 deletions include/versioninfo.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#include "lmms_basics.h"

#ifdef __GNUC__
#define GCC_VERSION "GCC " __VERSION__
#define COMPILER_VERSION "GCC " __VERSION__
#elif defined(_MSC_VER)
#define COMPILER_VERSION "MSVC " STRINGIFY(_MSC_FULL_VER)
#else
#define GCC_VERSION "unknown compiler"
#define COMPILER_VERSION "unknown compiler"
#endif

#ifdef LMMS_HOST_X86
Expand Down
2 changes: 1 addition & 1 deletion plugins/Amplifier/Amplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ extern "C"
{

// necessary for getting instance out of shared lib
Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* parent, void* data )
{
return new AmplifierEffect( parent, static_cast<const Plugin::Descriptor::SubPluginFeatures::Key *>( data ) );
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/BassBooster/BassBooster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ extern "C"
{

// necessary for getting instance out of shared lib
Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* parent, void* data )
{
return new BassBoosterEffect( parent, static_cast<const Plugin::Descriptor::SubPluginFeatures::Key *>( data ) );
}
Expand Down
Loading