Browse Source

Fix Windows build, add GLFW error handling

tags/v0.3.0
Andrew Belt 7 years ago
parent
commit
c51faf9089
5 changed files with 21 additions and 14 deletions
  1. +8
    -11
      Makefile
  2. +2
    -1
      compile.mk
  3. +4
    -1
      dep/Makefile
  4. +5
    -0
      src/gui.cpp
  5. +2
    -1
      src/plugin.cpp

+ 8
- 11
Makefile View File

@@ -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


+ 2
- 1
compile.mk View File

@@ -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




+ 4
- 1
dep/Makefile View File

@@ -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


+ 5
- 0
src/gui.cpp View File

@@ -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);



+ 2
- 1
src/plugin.cpp View File

@@ -17,8 +17,9 @@
#include <shellapi.h>
#include <direct.h>
#define mkdir(_dir, _perms) _mkdir(_dir)
#else
#include <dlfcn.h>
#endif
#include <dlfcn.h>
#include <dirent.h>

#include "plugin.hpp"


Loading…
Cancel
Save