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..3936b9f3 100755 --- a/dep/Makefile +++ b/dep/Makefile @@ -51,6 +51,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,7 +88,6 @@ $(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 diff --git a/src/gui.cpp b/src/gui.cpp index 8ae7dc47..35911fd9 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -160,6 +160,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); @@ -184,6 +188,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"