Browse Source

Fix build on Mac.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
94b5ad8b32
5 changed files with 19 additions and 11 deletions
  1. +2
    -0
      .gitignore
  2. +13
    -6
      Makefile
  3. +0
    -2
      compile.mk
  4. +3
    -2
      include/context.hpp
  5. +1
    -1
      plugin.mk

+ 2
- 0
.gitignore View File

@@ -3,6 +3,8 @@
/Rack.exe /Rack.exe
/Rack.res /Rack.res
/dep /dep
/Rack.d
/Rack.dSYM
/plugins /plugins
/disabledplugins /disabledplugins
/build /build


+ 13
- 6
Makefile View File

@@ -24,7 +24,6 @@ LDFLAGS += -shared


ifdef ARCH_LIN ifdef ARCH_LIN
TARGET := libRack.so TARGET := libRack.so
STANDALONE_TARGET := Rack


SOURCES += dep/osdialog/osdialog_gtk2.c SOURCES += dep/osdialog/osdialog_gtk2.c
build/dep/osdialog/osdialog_gtk2.c.o: FLAGS += $(shell pkg-config --cflags gtk+-2.0) build/dep/osdialog/osdialog_gtk2.c.o: FLAGS += $(shell pkg-config --cflags gtk+-2.0)
@@ -38,24 +37,28 @@ build/dep/osdialog/osdialog_gtk2.c.o: FLAGS += $(shell pkg-config --cflags gtk+-
LDFLAGS += -Wl,--no-whole-archive LDFLAGS += -Wl,--no-whole-archive
LDFLAGS += -lpthread -lGL -ldl -lX11 -lasound -ljack LDFLAGS += -lpthread -lGL -ldl -lX11 -lasound -ljack
LDFLAGS += $(shell pkg-config --libs gtk+-2.0) LDFLAGS += $(shell pkg-config --libs gtk+-2.0)

STANDALONE_TARGET := Rack
STANDALONE_LDFLAGS += -Wl,-rpath=.
endif endif


ifdef ARCH_MAC ifdef ARCH_MAC
TARGET := libRack.dylib TARGET := libRack.dylib
STANDALONE_TARGET := Rack


SOURCES += dep/osdialog/osdialog_mac.m SOURCES += dep/osdialog/osdialog_mac.m
LDFLAGS += -lpthread -ldl LDFLAGS += -lpthread -ldl
LDFLAGS += -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework CoreAudio -framework CoreMIDI LDFLAGS += -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework CoreAudio -framework CoreMIDI
LDFLAGS += -Wl,-all_load LDFLAGS += -Wl,-all_load
LDFLAGS += dep/lib/libGLEW.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/libzip.a dep/lib/libz.a dep/lib/libspeexdsp.a dep/lib/libsamplerate.a dep/lib/librtmidi.a dep/lib/librtaudio.a LDFLAGS += dep/lib/libGLEW.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/libzip.a dep/lib/libz.a dep/lib/libspeexdsp.a dep/lib/libsamplerate.a dep/lib/librtmidi.a dep/lib/librtaudio.a
# For LuaJIT
LDFLAGS += -Wl,-pagezero_size,10000 -Wl,-image_base,100000000

STANDALONE_TARGET := Rack
STANDALONE_LDFLAGS += -stdlib=libc++
# For LuaJIT to work inside plugins
STANDALONE_LDFLAGS += -Wl,-pagezero_size,10000 -Wl,-image_base,100000000
endif endif


ifdef ARCH_WIN ifdef ARCH_WIN
TARGET := libRack.dll TARGET := libRack.dll
STANDALONE_TARGET := Rack.exe


SOURCES += dep/osdialog/osdialog_win.c SOURCES += dep/osdialog/osdialog_win.c
LDFLAGS += -Wl,--export-all-symbols LDFLAGS += -Wl,--export-all-symbols
@@ -64,6 +67,8 @@ ifdef ARCH_WIN
LDFLAGS += dep/lib/libglew32.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libspeexdsp.a dep/lib/libsamplerate.a dep/lib/libzip.a dep/lib/libz.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/librtaudio.a dep/lib/librtmidi.a LDFLAGS += dep/lib/libglew32.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libspeexdsp.a dep/lib/libsamplerate.a dep/lib/libzip.a dep/lib/libz.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/librtaudio.a dep/lib/librtmidi.a
LDFLAGS += -Wl,-Bdynamic -Wl,--no-whole-archive LDFLAGS += -Wl,-Bdynamic -Wl,--no-whole-archive
LDFLAGS += -lpthread -lopengl32 -lgdi32 -lws2_32 -lcomdlg32 -lole32 -ldsound -lwinmm -lksuser -lshlwapi -lmfplat -lmfuuid -lwmcodecdspuuid -ldbghelp LDFLAGS += -lpthread -lopengl32 -lgdi32 -lws2_32 -lcomdlg32 -lole32 -ldsound -lwinmm -lksuser -lshlwapi -lmfplat -lmfuuid -lwmcodecdspuuid -ldbghelp

STANDALONE_TARGET := Rack.exe
STANDALONE_LDFLAGS += -mwindows STANDALONE_LDFLAGS += -mwindows
STANDALONE_OBJECTS += build/Rack.res STANDALONE_OBJECTS += build/Rack.res
endif endif
@@ -72,7 +77,9 @@ include compile.mk


# Standalone launcher # Standalone launcher


STANDALONE_LDFLAGS += -Wl,-rpath=.
ifdef ARCH_MAC
STANDALONE_LDFLAGS += $(MAC_SDK_FLAGS)
endif
STANDALONE_OBJECTS += $(patsubst %, build/%.o, $(STANDALONE_SOURCES)) STANDALONE_OBJECTS += $(patsubst %, build/%.o, $(STANDALONE_SOURCES))
STANDALONE_DEPENDENCIES := $(patsubst %, build/%.d, $(STANDALONE_SOURCES)) STANDALONE_DEPENDENCIES := $(patsubst %, build/%.d, $(STANDALONE_SOURCES))
-include $(STANDALONE_DEPENDENCIES) -include $(STANDALONE_DEPENDENCIES)


+ 0
- 2
compile.mk View File

@@ -26,10 +26,8 @@ endif
ifdef ARCH_MAC ifdef ARCH_MAC
FLAGS += -DARCH_MAC FLAGS += -DARCH_MAC
CXXFLAGS += -stdlib=libc++ CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++
MAC_SDK_FLAGS = -mmacosx-version-min=10.7 MAC_SDK_FLAGS = -mmacosx-version-min=10.7
FLAGS += $(MAC_SDK_FLAGS) FLAGS += $(MAC_SDK_FLAGS)
LDFLAGS += $(MAC_SDK_FLAGS)
endif endif
ifdef ARCH_WIN ifdef ARCH_WIN
FLAGS += -DARCH_WIN FLAGS += -DARCH_WIN


+ 3
- 2
include/context.hpp View File

@@ -38,6 +38,7 @@ struct Context {
history::State* history = NULL; history::State* history = NULL;
PatchManager* patch = NULL; PatchManager* patch = NULL;


/** Call this after setting the context for this thread, because initialization of application state accesses APP. */
void init(); void init();
~Context(); ~Context();
}; };
@@ -46,11 +47,11 @@ struct Context {
/** Returns the global Context pointer */ /** Returns the global Context pointer */
Context* contextGet(); Context* contextGet();
/** Sets the context for this thread. /** Sets the context for this thread.
You must call this every thread if you want to use the APP macro in that thread.
You must set the context when preparing each thread if the code uses the APP macro in that thread.
*/ */
void contextSet(Context* context); void contextSet(Context* context);


/** Accesses the global Context pointer */
/** Accesses the global Context pointer. Just an alias for contextGet(). */
#define APP rack::contextGet() #define APP rack::contextGet()






+ 1
- 1
plugin.mk View File

@@ -18,7 +18,6 @@ FLAGS += -fPIC
FLAGS += -I$(RACK_DIR)/include -I$(RACK_DIR)/dep/include FLAGS += -I$(RACK_DIR)/include -I$(RACK_DIR)/dep/include


LDFLAGS += -shared LDFLAGS += -shared
LDFLAGS += -Wl,-rpath=.
LDFLAGS += -L$(RACK_DIR) -lRack LDFLAGS += -L$(RACK_DIR) -lRack


include $(RACK_DIR)/arch.mk include $(RACK_DIR)/arch.mk
@@ -28,6 +27,7 @@ ifdef ARCH_LIN
# This prevents static variables in the DSO (dynamic shared object) from being preserved after dlclose(). # This prevents static variables in the DSO (dynamic shared object) from being preserved after dlclose().
# I don't really understand the side effects (see GCC manual), but so far tests are positive. # I don't really understand the side effects (see GCC manual), but so far tests are positive.
FLAGS += -fno-gnu-unique FLAGS += -fno-gnu-unique
LDFLAGS += -Wl,-rpath=.
RACK_USER_DIR ?= $(HOME)/.Rack RACK_USER_DIR ?= $(HOME)/.Rack
endif endif




Loading…
Cancel
Save