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.res
/dep
/Rack.d
/Rack.dSYM
/plugins
/disabledplugins
/build


+ 13
- 6
Makefile View File

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

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

SOURCES += dep/osdialog/osdialog_gtk2.c
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 += -lpthread -lGL -ldl -lX11 -lasound -ljack
LDFLAGS += $(shell pkg-config --libs gtk+-2.0)

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

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

SOURCES += dep/osdialog/osdialog_mac.m
LDFLAGS += -lpthread -ldl
LDFLAGS += -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework CoreAudio -framework CoreMIDI
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
# 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

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

SOURCES += dep/osdialog/osdialog_win.c
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 += -Wl,-Bdynamic -Wl,--no-whole-archive
LDFLAGS += -lpthread -lopengl32 -lgdi32 -lws2_32 -lcomdlg32 -lole32 -ldsound -lwinmm -lksuser -lshlwapi -lmfplat -lmfuuid -lwmcodecdspuuid -ldbghelp

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

# Standalone launcher

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


+ 0
- 2
compile.mk View File

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


+ 3
- 2
include/context.hpp View File

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

/** Call this after setting the context for this thread, because initialization of application state accesses APP. */
void init();
~Context();
};
@@ -46,11 +47,11 @@ struct Context {
/** Returns the global Context pointer */
Context* contextGet();
/** 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);

/** Accesses the global Context pointer */
/** Accesses the global Context pointer. Just an alias for 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

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

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().
# I don't really understand the side effects (see GCC manual), but so far tests are positive.
FLAGS += -fno-gnu-unique
LDFLAGS += -Wl,-rpath=.
RACK_USER_DIR ?= $(HOME)/.Rack
endif



Loading…
Cancel
Save