Browse Source

Repair build on Windows.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
495db04320
3 changed files with 20 additions and 21 deletions
  1. +16
    -17
      Makefile
  2. +3
    -3
      plugin.mk
  3. +1
    -1
      src/plugin.cpp

+ 16
- 17
Makefile View File

@@ -59,12 +59,13 @@ ifdef ARCH_WIN


SOURCES += dep/osdialog/osdialog_win.c SOURCES += dep/osdialog/osdialog_win.c
LDFLAGS += -Wl,--export-all-symbols LDFLAGS += -Wl,--export-all-symbols
LDFLAGS += -Wl,--out-implib,$(TARGET).a -mwindows
LDFLAGS += -Wl,--whole-archive
LDFLAGS += -Wl,--out-implib,$(TARGET).a
LDFLAGS += -Wl,-Bstatic -Wl,--whole-archive
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,--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
OBJECTS += Rack.res
STANDALONE_LDFLAGS += -mwindows
STANDALONE_OBJECTS += build/Rack.res
endif endif


include compile.mk include compile.mk
@@ -72,7 +73,7 @@ include compile.mk
# Standalone launcher # Standalone launcher


STANDALONE_LDFLAGS += -Wl,-rpath=. STANDALONE_LDFLAGS += -Wl,-rpath=.
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)


@@ -120,7 +121,7 @@ clean:




# For Windows resources # For Windows resources
%.res: %.rc
build/%.res: %.rc
ifdef ARCH_WIN ifdef ARCH_WIN
windres $^ -O coff -o $@ windres $^ -O coff -o $@
endif endif
@@ -131,16 +132,14 @@ DIST_NAME := Rack-$(VERSION)-$(ARCH)
DIST_SDK := Rack-SDK-$(VERSION).zip DIST_SDK := Rack-SDK-$(VERSION).zip


# This target is not intended for public use # This target is not intended for public use
dist: $(TARGET)
dist: $(TARGET) $(STANDALONE_TARGET)
rm -rf dist rm -rf dist
mkdir -p dist mkdir -p dist


ifdef ARCH_LIN ifdef ARCH_LIN
mkdir -p dist/Rack mkdir -p dist/Rack
cp $(TARGET) dist/Rack/
cp $(STANDALONE_TARGET) dist/Rack/
$(STRIP) -s dist/Rack/$(TARGET)
$(STRIP) -s dist/Rack/$(STANDALONE_TARGET)
cp $(TARGET) $(STANDALONE_TARGET) dist/Rack/
$(STRIP) -s dist/Rack/$(TARGET) dist/Rack/$(STANDALONE_TARGET)
cp -R $(DIST_RES) dist/Rack/ cp -R $(DIST_RES) dist/Rack/
# Manually check that no nonstandard shared libraries are linked # Manually check that no nonstandard shared libraries are linked
ldd dist/Rack/$(TARGET) ldd dist/Rack/$(TARGET)
@@ -173,19 +172,19 @@ ifdef ARCH_MAC
endif endif
ifdef ARCH_WIN ifdef ARCH_WIN
mkdir -p dist/Rack mkdir -p dist/Rack
cp $(TARGET) dist/Rack/
$(STRIP) -s dist/Rack/$(TARGET)
cp $(TARGET) $(STANDALONE_TARGET) dist/Rack/
$(STRIP) -s dist/Rack/$(TARGET) dist/Rack/$(STANDALONE_TARGET)
cp -R $(DIST_RES) dist/Rack/ cp -R $(DIST_RES) dist/Rack/
cp /mingw64/bin/libwinpthread-1.dll dist/Rack/ cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
cp /mingw64/bin/libstdc++-6.dll dist/Rack/ cp /mingw64/bin/libstdc++-6.dll dist/Rack/
cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/ cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
cp Fundamental.zip dist/Rack/
# cp Fundamental.zip dist/Rack/
# Make ZIP # Make ZIP
cd dist && zip -q -9 -r $(DIST_NAME).zip Rack cd dist && zip -q -9 -r $(DIST_NAME).zip Rack
# Make NSIS installer # Make NSIS installer
# pacman -S mingw-w64-x86_64-nsis # pacman -S mingw-w64-x86_64-nsis
makensis -DVERSION=$(VERSION) installer.nsi
mv installer.exe dist/$(DIST_NAME).exe
# makensis -DVERSION=$(VERSION) installer.nsi
# mv installer.exe dist/$(DIST_NAME).exe
endif endif


# Rack SDK # Rack SDK
@@ -194,7 +193,7 @@ endif
mkdir -p dist/Rack-SDK/dep/ mkdir -p dist/Rack-SDK/dep/
cp -R dep/include dist/Rack-SDK/dep/ cp -R dep/include dist/Rack-SDK/dep/
ifdef ARCH_WIN ifdef ARCH_WIN
cp libRack.a dist/Rack-SDK/
cp libRack.dll.a dist/Rack-SDK/
endif endif
cd dist && zip -q -9 -r $(DIST_SDK) Rack-SDK cd dist && zip -q -9 -r $(DIST_SDK) Rack-SDK




+ 3
- 3
plugin.mk View File

@@ -16,9 +16,6 @@ DISTRIBUTABLES += plugin.json


FLAGS += -fPIC FLAGS += -fPIC
FLAGS += -I$(RACK_DIR)/include -I$(RACK_DIR)/dep/include FLAGS += -I$(RACK_DIR)/include -I$(RACK_DIR)/dep/include
# 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 += -shared LDFLAGS += -shared
LDFLAGS += -Wl,-rpath=. LDFLAGS += -Wl,-rpath=.
@@ -28,6 +25,9 @@ include $(RACK_DIR)/arch.mk


ifdef ARCH_LIN ifdef ARCH_LIN
TARGET := plugin.so TARGET := plugin.so
# 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
RACK_USER_DIR ?= $(HOME)/.Rack RACK_USER_DIR ?= $(HOME)/.Rack
endif endif




+ 1
- 1
src/plugin.cpp View File

@@ -97,7 +97,7 @@ static InitCallback loadPluginCallback(Plugin* plugin) {
// Get plugin's init() function // Get plugin's init() function
InitCallback initCallback; InitCallback initCallback;
#if defined ARCH_WIN #if defined ARCH_WIN
initCallback = (InitCallback) GetProcAddress(plugin->handle, "init");
initCallback = (InitCallback) GetProcAddress((HMODULE) plugin->handle, "init");
#else #else
initCallback = (InitCallback) dlsym(plugin->handle, "init"); initCallback = (InitCallback) dlsym(plugin->handle, "init");
#endif #endif


Loading…
Cancel
Save