Skip to content

Commit

Permalink
CMake: Build lmms shared library instead of object library
Browse files Browse the repository at this point in the history
Resolves some inexplicable linking errors on Windows. Saves us from
working around incomplete CMake support of object libraries.
  • Loading branch information
lukas-w committed May 22, 2020
1 parent ac0081d commit 846ca17
Show file tree
Hide file tree
Showing 19 changed files with 80 additions and 123 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ IF(WANT_JACK)
IF(JACK_FOUND)
IF(WANT_WEAKJACK)
SET(LMMS_HAVE_WEAKJACK TRUE)
SET(WEAKJACK_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/3rdparty/weakjack/weakjack)
SET(WEAKJACK_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/src/3rdparty/weakjack/weakjack")
SET(STATUS_JACK "OK (weak linking enabled)")
# use dlsym instead
SET(JACK_LIBRARIES ${CMAKE_DL_LIBS})
Expand Down
3 changes: 1 addition & 2 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ SET(CMAKE_AUTOMOC ON)
ADD_EXECUTABLE(benchmarks
EXCLUDE_FROM_ALL
benchmark.cpp
$<TARGET_OBJECTS:lmmsobjs>
)
TARGET_LINK_LIBRARIES(benchmarks ${QT_LIBRARIES} ${LMMS_REQUIRED_LIBS})
TARGET_LINK_LIBRARIES(benchmarks lmmslib)
2 changes: 1 addition & 1 deletion cmake/linux/package_linux.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ chmod +x "${APPDIR}usr/bin/lmms"
unset LD_LIBRARY_PATH

# Ensure linuxdeployqt can find shared objects
export LD_LIBRARY_PATH="${APPDIR}"usr/lib/lmms/:"${APPDIR}"usr/lib/lmms/optional:"$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="${APPDIR}"usr/lib/:"${APPDIR}"usr/lib/lmms/:"${APPDIR}"usr/lib/lmms/optional:"$LD_LIBRARY_PATH"

# Move executables so linuxdeployqt can find them
ZYNLIB="${APPDIR}usr/lib/lmms/RemoteZynAddSubFx"
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/BuildPlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ FUNCTION(BUILD_PLUGIN PLUGIN_NAME)

ADD_LIBRARY(${PLUGIN_NAME} ${PLUGIN_LINK} ${PLUGIN_SOURCES} ${plugin_MOC_out} ${RCC_OUT})

TARGET_LINK_LIBRARIES(${PLUGIN_NAME} Qt5::Widgets Qt5::Xml lmms)
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} Qt5::Widgets Qt5::Xml lmmslib)

INSTALL(TARGETS ${PLUGIN_NAME}
LIBRARY DESTINATION "${PLUGIN_DESTINATION}"
Expand Down
2 changes: 1 addition & 1 deletion include/AutomationTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "Track.h"


class AutomationTrack : public Track
class LMMS_EXPORT AutomationTrack : public Track
{
Q_OBJECT
public:
Expand Down
3 changes: 2 additions & 1 deletion include/BBTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@
#include <QtCore/QMap>
#include <QStaticText>

#include "lmms_export.h"
#include "Track.h"

class TrackLabelButton;
class TrackContainer;


class BBTCO : public TrackContentObject
class LMMS_EXPORT BBTCO : public TrackContentObject
{
public:
BBTCO( Track * _track );
Expand Down
3 changes: 2 additions & 1 deletion include/MainApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#ifndef MAINAPPLICATION_H
#define MAINAPPLICATION_H

#include "lmms_export.h"
#include "lmmsconfig.h"

#include <QApplication>
Expand All @@ -35,7 +36,7 @@
#endif

#if defined(LMMS_BUILD_WIN32)
class MainApplication : public QApplication, public QAbstractNativeEventFilter
class LMMS_EXPORT MainApplication : public QApplication, public QAbstractNativeEventFilter
#else
class MainApplication : public QApplication
#endif
Expand Down
6 changes: 4 additions & 2 deletions include/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H

#include "lmms_export.h"

#include <QtCore/QBasicTimer>
#include <QtCore/QTimer>
#include <QtCore/QList>
Expand All @@ -43,7 +45,7 @@ class PluginView;
class ToolButton;


class MainWindow : public QMainWindow
class LMMS_EXPORT MainWindow : public QMainWindow
{
Q_OBJECT
public:
Expand All @@ -61,7 +63,7 @@ class MainWindow : public QMainWindow
void addSpacingToToolBar( int _size );

// wrap the widget with a window decoration and add it to the workspace
LMMS_EXPORT SubWindow* addWindowedWidget(QWidget *w, Qt::WindowFlags windowFlags=0);
SubWindow* addWindowedWidget(QWidget *w, Qt::WindowFlags windowFlags=0);


///
Expand Down
2 changes: 1 addition & 1 deletion include/Memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static MemoryManager::MmCounter _mm_counter;
static thread_local MemoryManager::MmCounter _mm_thread_counter;

template<typename T>
class MmAllocator
class LMMS_EXPORT MmAllocator
{
public:
MmAllocator() = default;
Expand Down
5 changes: 3 additions & 2 deletions include/MemoryPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@

#include <cstddef>
#include <memory>
#include "lmms_export.h"

class _MemoryPool_Private;
class LMMS_EXPORT _MemoryPool_Private;

class _MemoryPool_Base
class LMMS_EXPORT _MemoryPool_Base
{
public:
_MemoryPool_Base(size_t size, size_t nmemb);
Expand Down
3 changes: 2 additions & 1 deletion include/MixHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define MIX_HELPERS_H

#include "lmms_basics.h"
#include "lmms_export.h"

class ValueBuffer;
namespace MixHelpers
Expand All @@ -35,7 +36,7 @@ bool isSilent( const sampleFrame* src, int frames );

bool useNaNHandler();

void setNaNHandler( bool use );
LMMS_EXPORT void setNaNHandler( bool use );

void clear(sampleFrame * src, int frames);
#ifndef LMMS_DISABLE_SURROUND
Expand Down
3 changes: 2 additions & 1 deletion include/MixerProfiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@

#include <QFile>

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

class MixerProfiler
class LMMS_EXPORT MixerProfiler
{
public:
MixerProfiler();
Expand Down
6 changes: 4 additions & 2 deletions include/ModelVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@
#ifndef MODELVISITOR_H
#define MODELVISITOR_H

#include "lmms_export.h"

class AutomatableModel;
class BoolModel;
class IntModel;
class FloatModel;
class ComboBoxModel;
class TempoSyncKnobModel;

class ModelVisitor
class LMMS_EXPORT ModelVisitor
{
template<class ParentType = AutomatableModel, class ModelType>
void up(ModelType& m) { visit(static_cast<ParentType&>(m)); }
Expand All @@ -46,7 +48,7 @@ class ModelVisitor
virtual ~ModelVisitor();
};

class ConstModelVisitor
class LMMS_EXPORT ConstModelVisitor
{
template<class ParentType = AutomatableModel, class ModelType>
void up(const ModelType& m) {
Expand Down
3 changes: 2 additions & 1 deletion include/ProjectVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@
#define PROJECT_VERSION_H

#include <QtCore/QString>
#include "lmms_export.h"

/*! \brief Version number parsing and comparison
*
* Parses and compares version information. i.e. "1.0.3" < "1.0.10"
*/
class ProjectVersion
class LMMS_EXPORT ProjectVersion
{
public:
enum CompareType { Major, Minor, Release, Stage, Build };
Expand Down
2 changes: 1 addition & 1 deletion include/RenderManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "OutputSettings.h"


class RenderManager : public QObject
class LMMS_EXPORT RenderManager : public QObject
{
Q_OBJECT
public:
Expand Down
2 changes: 1 addition & 1 deletion plugins/LadspaEffect/calf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ IF(NOT LMMS_BUILD_APPLE AND NOT LMMS_BUILD_OPENBSD)
SET_TARGET_PROPERTIES(veal PROPERTIES LINK_FLAGS "${LINK_FLAGS} -shared -Wl,-no-undefined")
ENDIF()

TARGET_LINK_LIBRARIES(veal lmms)
TARGET_LINK_LIBRARIES(veal lmmslib)
5 changes: 4 additions & 1 deletion src/3rdparty/rpmalloc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ target_include_directories(rpmalloc PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/rpmalloc/rpmalloc
)

set_property(TARGET rpmalloc PROPERTY C_STANDARD 11)
set_target_properties(rpmalloc PROPERTIES
C_STANDARD 11
POSITION_INDEPENDENT_CODE ON
)

IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(rpmalloc
Expand Down
Loading

0 comments on commit 846ca17

Please sign in to comment.