| @@ -8,8 +8,8 @@ SOURCES = $(wildcard src/*.cpp src/*/*.cpp) \ | |||||
| ifeq ($(ARCH), lin) | ifeq ($(ARCH), lin) | ||||
| SOURCES += ext/noc/noc_file_dialog.c | |||||
| CFLAGS += -DNOC_FILE_DIALOG_GTK $(shell pkg-config --cflags gtk+-2.0) | |||||
| SOURCES += ext/osdialog/osdialog_gtk2.c | |||||
| CFLAGS += $(shell pkg-config --cflags gtk+-2.0) | |||||
| LDFLAGS += -rdynamic \ | LDFLAGS += -rdynamic \ | ||||
| -lpthread -lGL -ldl \ | -lpthread -lGL -ldl \ | ||||
| -lportaudio -lportmidi \ | -lportaudio -lportmidi \ | ||||
| @@ -19,16 +19,14 @@ TARGET = Rack | |||||
| endif | endif | ||||
| ifeq ($(ARCH), mac) | ifeq ($(ARCH), mac) | ||||
| SOURCES += ext/noc/noc_file_dialog.m | |||||
| CFLAGS += -DNOC_FILE_DIALOG_OSX | |||||
| SOURCES += ext/osdialog/osdialog_mac.m | |||||
| CXXFLAGS += -DAPPLE -stdlib=libc++ -I$(HOME)/local/include -I/usr/local/lib/libzip/include | CXXFLAGS += -DAPPLE -stdlib=libc++ -I$(HOME)/local/include -I/usr/local/lib/libzip/include | ||||
| LDFLAGS += -stdlib=libc++ -L$(HOME)/local/lib -lpthread -lglew -lglfw3 -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -ldl -ljansson -lportaudio -lportmidi -lsamplerate -lcurl -lzip | LDFLAGS += -stdlib=libc++ -L$(HOME)/local/lib -lpthread -lglew -lglfw3 -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -ldl -ljansson -lportaudio -lportmidi -lsamplerate -lcurl -lzip | ||||
| TARGET = Rack | TARGET = Rack | ||||
| endif | endif | ||||
| ifeq ($(ARCH), win) | ifeq ($(ARCH), win) | ||||
| SOURCES += ext/noc/noc_file_dialog.c | |||||
| CFLAGS += -DNOC_FILE_DIALOG_WIN32 | |||||
| SOURCES += ext/osdialog/osdialog_win.c | |||||
| CXXFLAGS += -DGLEW_STATIC \ | CXXFLAGS += -DGLEW_STATIC \ | ||||
| -I$(HOME)/pkg/portaudio-r1891-build/include -I/mingw64/lib/libzip/include -I$(HOME)/local/include | -I$(HOME)/pkg/portaudio-r1891-build/include -I/mingw64/lib/libzip/include -I$(HOME)/local/include | ||||
| LDFLAGS += \ | LDFLAGS += \ | ||||
| @@ -0,0 +1,15 @@ | |||||
| # Detect architecture if ARCH is not defined | |||||
| MACHINE = $(shell gcc -dumpmachine) | |||||
| ifneq (,$(findstring linux,$(MACHINE))) | |||||
| # Linux | |||||
| ARCH = lin | |||||
| else ifneq (,$(findstring apple,$(MACHINE))) | |||||
| # Mac | |||||
| ARCH = mac | |||||
| else ifneq (,$(findstring mingw,$(MACHINE))) | |||||
| # Windows | |||||
| ARCH = win | |||||
| else | |||||
| $(error Could not determine machine type. Try hacking around in Makefile-arch.inc) | |||||
| endif | |||||
| @@ -1,3 +1,6 @@ | |||||
| VERSION ?= dev | |||||
| FLAGS += -DVERSION=$(VERSION) | |||||
| # Generate dependency files build/*.d | # Generate dependency files build/*.d | ||||
| FLAGS += -MMD | FLAGS += -MMD | ||||
| # Optimization | # Optimization | ||||
| @@ -0,0 +1,99 @@ | |||||
| LOCAL = $(PWD) | |||||
| # Arch-specifics | |||||
| include ../Makefile-arch.inc | |||||
| ifeq ($(ARCH),mac) | |||||
| export CFLAGS = -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk \ | |||||
| -mmacosx-version-min=10.7 | |||||
| export CXXFLAGS = $(CFLAGS) | |||||
| export LDFLAGS = $(CFLAGS) | |||||
| endif | |||||
| # Commands | |||||
| WGET = wget -nc | |||||
| UNTAR = tar xf | |||||
| UNZIP = unzip | |||||
| # Packages | |||||
| glew = glew-2.1.0 | |||||
| glfw = glfw-3.2.1 | |||||
| jansson = jansson-2.10 | |||||
| libsamplerate = libsamplerate-0.1.9 | |||||
| libcurl = curl-7.54.1 | |||||
| libzip = libzip-1.2.0 | |||||
| portmidi = portmidi | |||||
| portaudio = portaudio | |||||
| .NOTPARALLEL: | |||||
| all: $(glew) $(glfw) $(jansson) $(libsamplerate) $(libcurl) $(libzip) $(portmidi) $(portaudio) | |||||
| $(glew): | |||||
| $(WGET) https://downloads.sourceforge.net/project/glew/glew/$(patsubst glew-%,%,$@)/$@.tgz | |||||
| $(UNTAR) $@.tgz | |||||
| $(MAKE) -C $@ | |||||
| ln -s lib lib64 | |||||
| $(MAKE) -C $@ GLEW_DEST="$(LOCAL)" install | |||||
| rm lib64 | |||||
| $(glfw): | |||||
| $(WGET) https://github.com/glfw/glfw/releases/download/$(patsubst glfw-%,%,$@)/$@.zip | |||||
| $(UNZIP) $@.zip | |||||
| cd $@ && cmake . \ | |||||
| -DCMAKE_INSTALL_PREFIX="$(LOCAL)" -DBUILD_SHARED_LIBS=ON \ | |||||
| -DGLFW_USE_CHDIR=ON -DGLFW_USE_MENUBAR=ON -DGLFW_USE_RETINA=ON | |||||
| $(MAKE) -C $@ | |||||
| $(MAKE) -C $@ install | |||||
| $(jansson): | |||||
| $(WGET) http://www.digip.org/jansson/releases/$@.tar.gz | |||||
| $(UNTAR) $@.tar.gz | |||||
| cd $@ && ./configure --prefix="$(LOCAL)" | |||||
| $(MAKE) -C $@ | |||||
| $(MAKE) -C $@ install | |||||
| $(libsamplerate): | |||||
| $(WGET) http://www.mega-nerd.com/SRC/$@.tar.gz | |||||
| $(UNTAR) $@.tar.gz | |||||
| cd $@ && ./configure --prefix="$(LOCAL)" | |||||
| $(MAKE) -C $@ | |||||
| $(MAKE) -C $@ install | |||||
| $(libcurl): | |||||
| $(WGET) https://curl.haxx.se/download/$@.tar.gz | |||||
| $(UNTAR) $@.tar.gz | |||||
| cd $@ && ./configure --prefix="$(LOCAL)" \ | |||||
| --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual \ | |||||
| --without-zlib --without-ssl --without-ca-bundle --without-ca-path --without-ca-fallback --without-libpsl --without-libmetalink --without-libssh2 --without-librtmp --without-winidn --without-libidn2 --without-nghttp2 | |||||
| $(MAKE) -C $@ | |||||
| $(MAKE) -C $@ install | |||||
| $(libzip): | |||||
| $(WGET) https://nih.at/libzip/$@.tar.gz | |||||
| $(UNTAR) $@.tar.gz | |||||
| cd $@ && ./configure --prefix="$(LOCAL)" | |||||
| $(MAKE) -C $@ | |||||
| $(MAKE) -C $@ install | |||||
| $(portmidi): | |||||
| git clone https://github.com/aoeu/portmidi.git $@ | |||||
| # TODO Does not yet work | |||||
| cd $@ && cmake . -DCMAKE_INSTALL_PREFIX="$(LOCAL)" \ | |||||
| -DCMAKE_BUILD_TYPE=Release \ | |||||
| -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=$(PWD)/$@/Release \ | |||||
| -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$(PWD)/$@/Release \ | |||||
| -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=$(PWD)/$@/Release | |||||
| $(MAKE) -C $@ | |||||
| $(MAKE) -C $@ install | |||||
| $(portaudio): | |||||
| $(WGET) http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz | |||||
| $(UNTAR) pa_stable_v190600_20161030.tgz | |||||
| cd $@ && ./configure --prefix="$(LOCAL)" | |||||
| $(MAKE) -C $@ | |||||
| $(MAKE) -C $@ install | |||||
| clean: | |||||
| git clean -fdxi | |||||
| @@ -11,8 +11,6 @@ void guiRun(); | |||||
| bool guiIsKeyPressed(int key); | bool guiIsKeyPressed(int key); | ||||
| void guiCursorLock(); | void guiCursorLock(); | ||||
| void guiCursorUnlock(); | void guiCursorUnlock(); | ||||
| const char *guiSaveDialog(const char *filters, const char *filename); | |||||
| const char *guiOpenDialog(const char *filters, const char *filename); | |||||
| extern NVGcontext *gVg; | extern NVGcontext *gVg; | ||||
| extern std::shared_ptr<Font> gGuiFont; | extern std::shared_ptr<Font> gGuiFont; | ||||
| @@ -4,7 +4,7 @@ | |||||
| namespace rack { | namespace rack { | ||||
| std::string gApplicationName = "VCV Rack"; | std::string gApplicationName = "VCV Rack"; | ||||
| std::string gApplicationVersion = "v0.2.1 alpha"; | |||||
| std::string gApplicationVersion = TOSTRING(VERSION); | |||||
| RackWidget *gRackWidget = NULL; | RackWidget *gRackWidget = NULL; | ||||
| @@ -1,6 +1,7 @@ | |||||
| #include "app.hpp" | #include "app.hpp" | ||||
| #include "gui.hpp" | #include "gui.hpp" | ||||
| #include "engine.hpp" | #include "engine.hpp" | ||||
| #include "../ext/osdialog/osdialog.h" | |||||
| namespace rack { | namespace rack { | ||||
| @@ -16,18 +17,20 @@ struct NewItem : MenuItem { | |||||
| struct SaveItem : MenuItem { | struct SaveItem : MenuItem { | ||||
| void onAction() { | void onAction() { | ||||
| const char *path = guiSaveDialog(filters, "Untitled.json"); | |||||
| char *path = osdialog_file(OSDIALOG_SAVE, "./patches", "Untitled.json", NULL); | |||||
| if (path) { | if (path) { | ||||
| gRackWidget->savePatch(path); | gRackWidget->savePatch(path); | ||||
| free(path); | |||||
| } | } | ||||
| } | } | ||||
| }; | }; | ||||
| struct OpenItem : MenuItem { | struct OpenItem : MenuItem { | ||||
| void onAction() { | void onAction() { | ||||
| const char *path = guiOpenDialog(filters, NULL); | |||||
| char *path = osdialog_file(OSDIALOG_OPEN, "./patches", NULL, NULL); | |||||
| if (path) { | if (path) { | ||||
| gRackWidget->loadPatch(path); | gRackWidget->loadPatch(path); | ||||
| free(path); | |||||
| } | } | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -17,10 +17,6 @@ | |||||
| #define NANOSVG_IMPLEMENTATION | #define NANOSVG_IMPLEMENTATION | ||||
| #include "../ext/nanosvg/src/nanosvg.h" | #include "../ext/nanosvg/src/nanosvg.h" | ||||
| extern "C" { | |||||
| #include "../ext/noc/noc_file_dialog.h" | |||||
| } | |||||
| namespace rack { | namespace rack { | ||||
| @@ -284,14 +280,6 @@ void guiCursorUnlock() { | |||||
| glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); | glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); | ||||
| } | } | ||||
| const char *guiSaveDialog(const char *filters, const char *filename) { | |||||
| return noc_file_dialog_open(NOC_FILE_DIALOG_SAVE, filters, NULL, filename); | |||||
| } | |||||
| const char *guiOpenDialog(const char *filters, const char *filename) { | |||||
| return noc_file_dialog_open(NOC_FILE_DIALOG_OPEN, filters, NULL, filename); | |||||
| } | |||||
| //////////////////// | //////////////////// | ||||
| // resources | // resources | ||||