diff --git a/Makefile b/Makefile index 646ca9ac..2ff7814f 100644 --- a/Makefile +++ b/Makefile @@ -29,17 +29,10 @@ endif ifeq ($(ARCH), win) SOURCES += ext/osdialog/osdialog_win.c - CXXFLAGS += -DGLEW_STATIC \ - -I$(HOME)/pkg/portaudio-r1891-build/include -I/mingw64/lib/libzip/include -I$(HOME)/local/include - LDFLAGS += \ - -Wl,-Bstatic,--whole-archive \ - -ljansson -lsamplerate \ - -Wl,-Bdynamic,--no-whole-archive \ - -lpthread -lglfw3 -lgdi32 -lglew32 -lopengl32 -lcomdlg32 -lole32 -lzip \ - -L $(HOME)/local/lib -lcurl \ - -lportmidi \ - -L$(HOME)/pkg/portaudio-r1891-build/lib/x64/ReleaseMinDependency -lportaudio_x64 \ - -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows + LDFLAGS += -static-libgcc -static-libstdc++ -lpthread \ + -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \ + -lgdi32 -lopengl32 -lcomdlg32 -lole32 \ + -Ldep/lib -lglew32 -lglfw3dll -ljansson -lsamplerate -lcurl -lzip -lportaudio -lportmidi TARGET = Rack.exe # OBJECTS = Rack.res endif @@ -54,6 +47,10 @@ endif ifeq ($(ARCH), mac) DYLD_FALLBACK_LIBRARY_PATH=dep/lib ./$< endif +ifeq ($(ARCH), win) + # TODO get rid of the mingw64 path + env PATH=dep/bin:/mingw64/bin ./$< +endif clean: rm -rf $(TARGET) build diff --git a/compile.mk b/compile.mk index 7ef00ad8..929d1cbe 100644 --- a/compile.mk +++ b/compile.mk @@ -20,7 +20,8 @@ ifeq ($(ARCH), mac) endif ifeq ($(ARCH), win) - FLAGS += -DARCH_WIN -D_USE_MATH_DEFINES + FLAGS += -DARCH_WIN + FLAGS += -D_USE_MATH_DEFINES endif diff --git a/dep/Makefile b/dep/Makefile index 513ae3db..82193e7d 100755 --- a/dep/Makefile +++ b/dep/Makefile @@ -16,9 +16,9 @@ WGET = wget -nc UNTAR = tar xf UNZIP = unzip ifeq ($(ARCH),win) - CMAKE = cmake -G 'MSYS Makefiles' +CMAKE = cmake -G 'MSYS Makefiles' else - CMAKE = cmake +CMAKE = cmake endif # Packages @@ -30,6 +30,7 @@ libcurl = curl-7.54.1 libzip = libzip-1.2.0 portmidi = portmidi portaudio = portaudio +asio = asiosdk2.3 .NOTPARALLEL: @@ -51,6 +52,10 @@ $(glfw): -DGLFW_USE_CHDIR=ON -DGLFW_USE_MENUBAR=ON -DGLFW_USE_RETINA=ON $(MAKE) -C $@ $(MAKE) -C $@ install +ifeq ($(ARCH),win) + # Not sure why the GLFW build system puts a .dll in the lib directory + mv "$(LOCAL)/lib/glfw3.dll" "$(LOCAL)/bin/" +endif $(jansson): $(WGET) http://www.digip.org/jansson/releases/$@.tar.gz @@ -84,15 +89,23 @@ $(libzip): $(portmidi): git clone https://github.com/AndrewBelt/portmidi.git $@ - # TODO Fix on Windows cd $@ && $(CMAKE) . -DCMAKE_INSTALL_PREFIX="$(LOCAL)" $(MAKE) -C $@ $(MAKE) -C $@ install -$(portaudio): +$(asio): + echo "For ASIO support, download and move the ASIO SDK to $@" + exit 1 + +ifeq ($(ARCH),win) +PORTAUDIO_DEPS = $(asio) +PORTAUDIO_ASIO = --with-host_os=mingw --with-winapi=wmme,asio --with-asiodir="../$(asio)" +endif + +$(portaudio): $(PORTAUDIO_DEPS) $(WGET) http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz $(UNTAR) pa_stable_v190600_20161030.tgz - cd $@ && ./configure --prefix="$(LOCAL)" + cd $@ && ./configure --prefix="$(LOCAL)" $(PORTAUDIO_ASIO) $(MAKE) -C $@ $(MAKE) -C $@ install diff --git a/src/gui.cpp b/src/gui.cpp index a7178214..701a780a 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -163,6 +163,10 @@ void keyCallback(GLFWwindow* window, int key, int scancode, int action, int mods } } +void errorCallback(int error, const char *description) { + fprintf(stderr, "GLFW error %d: %s\n", error, description); +} + void renderGui() { int width, height; glfwGetFramebufferSize(window, &width, &height); @@ -191,6 +195,7 @@ void guiInit() { int err; // Set up GLFW + glfwSetErrorCallback(errorCallback); err = glfwInit(); assert(err); diff --git a/src/plugin.cpp b/src/plugin.cpp index 25054dc1..d21de1ae 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -17,8 +17,9 @@ #include #include #define mkdir(_dir, _perms) _mkdir(_dir) +#else + #include #endif -#include #include #include "plugin.hpp"