Browse Source

Switch from noc to osdialog, add arch-detecting Makefile, added dep Makefile

tags/v0.3.0
Andrew Belt 7 years ago
parent
commit
3eba4b755e
8 changed files with 127 additions and 23 deletions
  1. +4
    -6
      Makefile
  2. +15
    -0
      Makefile-arch.inc
  3. +3
    -0
      Makefile.inc
  4. +99
    -0
      dep/Makefile
  5. +0
    -2
      include/gui.hpp
  6. +1
    -1
      src/app.cpp
  7. +5
    -2
      src/app/Toolbar.cpp
  8. +0
    -12
      src/gui.cpp

+ 4
- 6
Makefile View File

@@ -8,8 +8,8 @@ SOURCES = $(wildcard src/*.cpp src/*/*.cpp) \


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 \
-lpthread -lGL -ldl \
-lportaudio -lportmidi \
@@ -19,16 +19,14 @@ TARGET = Rack
endif

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

ifeq ($(ARCH), win)
SOURCES += ext/noc/noc_file_dialog.c
CFLAGS += -DNOC_FILE_DIALOG_WIN32
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 += \


+ 15
- 0
Makefile-arch.inc View File

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

+ 3
- 0
Makefile.inc View File

@@ -1,3 +1,6 @@
VERSION ?= dev
FLAGS += -DVERSION=$(VERSION)

# Generate dependency files build/*.d
FLAGS += -MMD
# Optimization


+ 99
- 0
dep/Makefile View File

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

+ 0
- 2
include/gui.hpp View File

@@ -11,8 +11,6 @@ void guiRun();
bool guiIsKeyPressed(int key);
void guiCursorLock();
void guiCursorUnlock();
const char *guiSaveDialog(const char *filters, const char *filename);
const char *guiOpenDialog(const char *filters, const char *filename);

extern NVGcontext *gVg;
extern std::shared_ptr<Font> gGuiFont;


+ 1
- 1
src/app.cpp View File

@@ -4,7 +4,7 @@
namespace rack {

std::string gApplicationName = "VCV Rack";
std::string gApplicationVersion = "v0.2.1 alpha";
std::string gApplicationVersion = TOSTRING(VERSION);

RackWidget *gRackWidget = NULL;



+ 5
- 2
src/app/Toolbar.cpp View File

@@ -1,6 +1,7 @@
#include "app.hpp"
#include "gui.hpp"
#include "engine.hpp"
#include "../ext/osdialog/osdialog.h"


namespace rack {
@@ -16,18 +17,20 @@ struct NewItem : MenuItem {

struct SaveItem : MenuItem {
void onAction() {
const char *path = guiSaveDialog(filters, "Untitled.json");
char *path = osdialog_file(OSDIALOG_SAVE, "./patches", "Untitled.json", NULL);
if (path) {
gRackWidget->savePatch(path);
free(path);
}
}
};

struct OpenItem : MenuItem {
void onAction() {
const char *path = guiOpenDialog(filters, NULL);
char *path = osdialog_file(OSDIALOG_OPEN, "./patches", NULL, NULL);
if (path) {
gRackWidget->loadPatch(path);
free(path);
}
}
};


+ 0
- 12
src/gui.cpp View File

@@ -17,10 +17,6 @@
#define NANOSVG_IMPLEMENTATION
#include "../ext/nanosvg/src/nanosvg.h"

extern "C" {
#include "../ext/noc/noc_file_dialog.h"
}


namespace rack {

@@ -284,14 +280,6 @@ void guiCursorUnlock() {
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


Loading…
Cancel
Save