tentative x-platform makefiles + vst3 fixes
This commit is contained in:
parent
03813fe631
commit
0ac57b290f
@ -1,26 +1,42 @@
|
||||
include vars.mk
|
||||
|
||||
PHONY_TARGETS = all clean
|
||||
ifeq ($(OS), Windows_NT)
|
||||
EXE_SUFFIX = .exe
|
||||
else
|
||||
UNAME_S = $(shell uname -s)
|
||||
EXE_SUFFIX =
|
||||
|
||||
PHONY_TARGETS += install
|
||||
PREFIX = /usr/local
|
||||
BINDIR = ${PREFIX}/bin
|
||||
endif
|
||||
|
||||
CC = gcc
|
||||
|
||||
CFLAGS = -I${TINYWAV_DIR} -I${MIDI_PARSER_DIR}/include -fPIC -Wall -Wpedantic -Wextra -Wno-unused-parameter
|
||||
CFLAGS = -I${TINYWAV_DIR} -I${MIDI_PARSER_DIR}/include -O3 -fPIC -Wall -Wpedantic -Wextra -Wno-unused-parameter
|
||||
|
||||
PROGRAM = ${BUNDLE_NAME}${EXE_SUFFIX}
|
||||
|
||||
all: build/${PROGRAM}
|
||||
|
||||
build/${PROGRAM}: src/main.c ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c | build
|
||||
${CC} $^ -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS_EXTRA}
|
||||
ifeq ($(UNAME_S), Darwin)
|
||||
|
||||
build/${PROGRAM}: build/tmp/x86_64 build/tmp/arm64
|
||||
lipo -create -output $@ $^
|
||||
|
||||
build/tmp/x86_64: src/main.c src/data.h src/plugin.h ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c | build
|
||||
${CC} src/main.c ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS_EXTRA} -arch x86_64
|
||||
|
||||
build/tmp/arm64: src/main.c src/data.h src/plugin.h ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c | build
|
||||
${CC} src/main.c ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS_EXTRA} -arch arm64
|
||||
|
||||
build/tmp:
|
||||
mkdir -p $@
|
||||
|
||||
else
|
||||
|
||||
build/${PROGRAM}: src/main.c src/data.h src/plugin.h ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c | build
|
||||
${CC} src/main.c ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS_EXTRA}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
mkdir -p $@
|
||||
@ -28,10 +44,16 @@ build:
|
||||
clean:
|
||||
rm -fr build
|
||||
|
||||
ifneq ($(OS), Windows_NT)
|
||||
ifeq ($(OS), Windows_NT)
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
else
|
||||
|
||||
install: all
|
||||
mkdir -p -m 0755 ${BINDIR}
|
||||
install -m 0755 build/${PROGRAM} ${BINDIR}
|
||||
endif
|
||||
|
||||
.PHONY: ${PHONY_TARGETS}
|
||||
.PHONY: all clean install
|
||||
|
||||
endif
|
||||
|
@ -6,23 +6,24 @@ ifeq ($(OS), Windows_NT)
|
||||
APPDATA = $(shell echo '${APPDATA}' | sed 's:\\:/:g')
|
||||
LV2DIR = ${COMMONPROGRAMFILES}/LV2
|
||||
LV2DIR_USER = ${APPDATA}/LV2
|
||||
CC = gcc
|
||||
else
|
||||
UNAME_S = $(shell uname -s)
|
||||
ifeq ($(UNAME_S), Darwin)
|
||||
DLL_SUFFIX = .dylib
|
||||
LV2DIR = /Library/Audio/Plug-Ins/LV2
|
||||
LV2DIR_USER = ${HOME}/Library/Audio/Plug-Ins/LV2
|
||||
CC = clang
|
||||
else
|
||||
DLL_SUFFIX = .so
|
||||
PREFIX = /usr/local
|
||||
LV2DIR = ${PREFIX}/lib/lv2
|
||||
LV2DIR_USER = ${HOME}/.lv2
|
||||
CC = gcc
|
||||
endif
|
||||
endif
|
||||
|
||||
CC = gcc
|
||||
|
||||
CFLAGS = -fPIC -Wall -Wpedantic -Wextra -Wno-unused-parameter
|
||||
CFLAGS = -O3 -fPIC -Wall -Wpedantic -Wextra -Wno-unused-parameter
|
||||
LDFLAGS = -shared
|
||||
|
||||
BUNDLE_DIR = ${BUNDLE_NAME}.lv2
|
||||
@ -34,8 +35,26 @@ all: build/${BUNDLE_DIR}/manifest.ttl build/${BUNDLE_DIR}/${DLL_FILE}
|
||||
build/${BUNDLE_DIR}/manifest.ttl: data/manifest.ttl.in | build/${BUNDLE_DIR}
|
||||
cat $^ | sed s/@DLL_SUFFIX@/${DLL_SUFFIX}/g > $@
|
||||
|
||||
build/${BUNDLE_DIR}/${DLL_FILE}: src/lv2.c | build/${BUNDLE_DIR}
|
||||
${CC} $^ -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS} ${LDFLAGS_EXTRA}
|
||||
ifeq ($(UNAME_S), Darwin)
|
||||
|
||||
build/${BUNDLE_DIR}/${DLL_FILE}: build/tmp/x86_64 build/tmp/arm64 | build/${BUNDLE_DIR}
|
||||
lipo -create -output $@ $^
|
||||
|
||||
build/tmp/x86_64: src/lv2.c src/data.h src/plugin.h | build/tmp
|
||||
${CC} src/lv2.c -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS} ${LDFLAGS_EXTRA} -arch x86_64
|
||||
|
||||
build/tmp/arm64: src/lv2.c src/data.h src/plugin.h | build/tmp
|
||||
${CC} src/lv2.c -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS} ${LDFLAGS_EXTRA} -arch arm64
|
||||
|
||||
build/tmp:
|
||||
mkdir -p $@
|
||||
|
||||
else
|
||||
|
||||
build/${BUNDLE_DIR}/${DLL_FILE}: src/lv2.c src/data.h | build/${BUNDLE_DIR}
|
||||
${CC} src/lv2.c -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS} ${LDFLAGS_EXTRA}
|
||||
|
||||
endif
|
||||
|
||||
build/${BUNDLE_DIR}:
|
||||
mkdir -p $@
|
||||
@ -44,13 +63,13 @@ clean:
|
||||
rm -fr build
|
||||
|
||||
install: all
|
||||
mkdir -p -m 0755 ${LV2DIR}/${BUNDLE_DIR}
|
||||
install -m 0644 build/${BUNDLE_DIR}/manifest.ttl ${LV2DIR}/${BUNDLE_DIR}
|
||||
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} ${LV2DIR}/${BUNDLE_DIR}
|
||||
mkdir -p -m 0755 "${LV2DIR}/${BUNDLE_DIR}"
|
||||
install -m 0644 build/${BUNDLE_DIR}/manifest.ttl "${LV2DIR}/${BUNDLE_DIR}"
|
||||
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} "${LV2DIR}/${BUNDLE_DIR}"
|
||||
|
||||
install-user: all
|
||||
mkdir -p -m 0755 ${LV2DIR_USER}/${BUNDLE_DIR}
|
||||
install -m 0644 build/${BUNDLE_DIR}/manifest.ttl ${LV2DIR_USER}/${BUNDLE_DIR}
|
||||
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} ${LV2DIR_USER}/${BUNDLE_DIR}
|
||||
mkdir -p -m 0755 "${LV2DIR_USER}/${BUNDLE_DIR}"
|
||||
install -m 0644 build/${BUNDLE_DIR}/manifest.ttl "${LV2DIR_USER}/${BUNDLE_DIR}"
|
||||
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} "${LV2DIR_USER}/${BUNDLE_DIR}"
|
||||
|
||||
.PHONY: all clean install install-user
|
||||
|
@ -1,27 +1,94 @@
|
||||
include vars.mk
|
||||
|
||||
CC = gcc
|
||||
ifeq ($(OS), Windows_NT)
|
||||
DLL_SUFFIX = .vst3
|
||||
PLATFORM = x86_64-win
|
||||
COMMONPROGRAMFILES = $(shell echo '${COMMONPROGRAMFILES}' | sed 's:\\:/:g')
|
||||
LOCALAPPDATA = $(shell echo '${LOCALAPPDATA}' | sed 's:\\:/:g')
|
||||
VST3DIR = ${COMMONPROGRAMFILES}/VST3
|
||||
VST3DIR_USER = ${LOCALAPPDATA}/VST3
|
||||
CC = gcc
|
||||
else
|
||||
UNAME_S = $(shell uname -s)
|
||||
ifeq ($(UNAME_S), Darwin)
|
||||
DLL_SUFFIX =
|
||||
PLATFORM = MacOS
|
||||
VST3DIR = /Library/Audio/Plug-Ins/VST3
|
||||
VST3DIR_USER = ${HOME}/Library/Audio/Plug-Ins/VST3
|
||||
CC = clang
|
||||
else
|
||||
DLL_SUFFIX = .so
|
||||
PLATFORM = $(shell uname -m)-linux
|
||||
VST3DIR = /usr/local/lib/vst3
|
||||
VST3DIR_USER = ${HOME}/.vst3
|
||||
CC = gcc
|
||||
endif
|
||||
endif
|
||||
|
||||
CFLAGS = -fPIC -Wall -Wpedantic -Wextra -Wno-unused-parameter
|
||||
CFLAGS = -O3 -fPIC -Wall -Wpedantic -Wextra -Wno-unused-parameter
|
||||
LDFLAGS = -shared -lm
|
||||
|
||||
BUNDLE_DIR = ${BUNDLE_NAME}.vst3
|
||||
|
||||
SO_DIR = $(shell uname -m)-linux
|
||||
SO_FILE = ${SO_DIR}/${BUNDLE_NAME}.so
|
||||
DLL_DIR = Contents/${PLATFORM}
|
||||
DLL_FILE = ${DLL_DIR}/${BUNDLE_NAME}${DLL_SUFFIX}
|
||||
|
||||
all: build/${BUNDLE_DIR}/Contents/Info.plist build/${BUNDLE_DIR}/Contents/${SO_FILE}
|
||||
ifeq ($(UNAME_S), Darwin)
|
||||
|
||||
all: build/${BUNDLE_DIR}/${DLL_FILE} build/${BUNDLE_DIR}/Contents/Info.plist
|
||||
|
||||
build/${BUNDLE_DIR}/Contents/Info.plist: data/Info.plist | build/${BUNDLE_DIR}/Contents
|
||||
cp $^ $@
|
||||
|
||||
build/${BUNDLE_DIR}/Contents/${SO_FILE}: src/vst3.c | build/${BUNDLE_DIR}/Contents/${SO_DIR}
|
||||
${CC} $^ -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS} ${LDFLAGS_EXTRA}
|
||||
build/${BUNDLE_DIR}/${DLL_FILE}: build/tmp/x86_64 build/tmp/arm64 | buindle/${BUNDLE_DIR}/Contents
|
||||
lipo -create -output $@ $^
|
||||
|
||||
build/${BUNDLE_DIR}/Contents build/${BUNDLE_DIR}/Contents/${SO_DIR}:
|
||||
build/tmp/x86_64: src/vst3.c src/data.h src/plugin.h | build/tmp
|
||||
${CC} src/vst3.c -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS} ${LDFLAGS_EXTRA} -arch x86_64
|
||||
|
||||
build/tmp/arm64: src/vst3.c src/data.h src/plugin.h | build/tmp
|
||||
${CC} src/vst3.c -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS} ${LDFLAGS_EXTRA} -arch arm64
|
||||
|
||||
build/tmp:
|
||||
mkdir -p $@
|
||||
|
||||
else
|
||||
|
||||
all: build/${BUNDLE_DIR}/${DLL_FILE}
|
||||
|
||||
build/${BUNDLE_DIR}/${DLL_FILE}: src/vst3.c src/data.h | build/${BUNDLE_DIR}/${DLL_DIR}
|
||||
${CC} src/vst3.c -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS} ${LDFLAGS_EXTRA}
|
||||
|
||||
endif
|
||||
|
||||
build/${BUNDLE_DIR}/Contents build/${BUNDLE_DIR}/${DLL_DIR}:
|
||||
mkdir -p $@
|
||||
|
||||
clean:
|
||||
rm -fr build
|
||||
|
||||
.PHONY: all clean
|
||||
ifeq ($(UNAME_S), Darwin)
|
||||
|
||||
install: all
|
||||
mkdir -p -m 0755 "${VST3DIR}/${BUNDLE_DIR}/${DLL_DIR}"
|
||||
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} "${VST3DIR}/${BUNDLE_DIR}/${DLL_DIR}"
|
||||
install -m 0644 build/${BUNDLE_DIR}/Contents/Info.plist "${VST3DIR}/${BUNDLE_DIR}/Contents/Info.plist"
|
||||
|
||||
install-user: all
|
||||
mkdir -p -m 0755 "${VST3DIR_USER}/${BUNDLE_DIR}/${DLL_DIR}"
|
||||
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} "${VST3DIR_USER}/${BUNDLE_DIR}/${DLL_DIR}"
|
||||
install -m 0644 build/${BUNDLE_DIR}/Contents/Info.plist "${VST3DIR_USER}/${BUNDLE_DIR}/Contents/Info.plist"
|
||||
|
||||
else
|
||||
|
||||
install: all
|
||||
mkdir -p -m 0755 "${VST3DIR}/${BUNDLE_DIR}/${DLL_DIR}"
|
||||
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} "${VST3DIR}/${BUNDLE_DIR}/${DLL_DIR}"
|
||||
|
||||
install-user: all
|
||||
mkdir -p -m 0755 "${VST3DIR_USER}/${BUNDLE_DIR}/${DLL_DIR}"
|
||||
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} "${VST3DIR_USER}/${BUNDLE_DIR}/${DLL_DIR}"
|
||||
|
||||
endif
|
||||
|
||||
.PHONY: all clean install install-user
|
||||
|
@ -1 +0,0 @@
|
||||
BNDL????
|
@ -1,2 +0,0 @@
|
||||
[.ShellClassInfo]
|
||||
IconResource=Plugin.ico,0
|
@ -162,10 +162,12 @@ static struct Steinberg_Vst_ParameterInfo parameterInfo[DATA_PRODUCT_PARAMETERS_
|
||||
{{~}}
|
||||
};
|
||||
|
||||
# define DATA_PARAM_BYPASS 1
|
||||
# define DATA_PARAM_TOGGLED (1<<1)
|
||||
# define DATA_PARAM_INTEGER (1<<2)
|
||||
# define DATA_PARAM_MAP_LOG (1<<3)
|
||||
# if DATA_PRODUCT_PARAMETERS_N > 0
|
||||
|
||||
# define DATA_PARAM_BYPASS 1
|
||||
# define DATA_PARAM_TOGGLED (1<<1)
|
||||
# define DATA_PARAM_INTEGER (1<<2)
|
||||
# define DATA_PARAM_MAP_LOG (1<<3)
|
||||
|
||||
static struct {
|
||||
size_t index;
|
||||
@ -187,6 +189,9 @@ static struct {
|
||||
},
|
||||
{{~}}
|
||||
};
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
{{?it.product.parameters.find(x => x.isLatency)}}
|
||||
|
@ -530,6 +530,8 @@ static void processParams(pluginInstance *p, struct Steinberg_Vst_ProcessData *d
|
||||
data[1] = 1;
|
||||
data[2] = (uint8_t)(127.0 * v);
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
plugin_midi_msg_in(&p->p, midiInIndex[index], data);
|
||||
continue;
|
||||
@ -773,9 +775,16 @@ static Steinberg_tresult controllerInitialize(void* thisInterface, struct Steinb
|
||||
if (c->context != NULL)
|
||||
return Steinberg_kResultFalse;
|
||||
c->context = context;
|
||||
#if DATA_PRODUCT_PARAMETERS_N + DATA_PRODUCT_BUSES_MIDI_INPUT_N > 0
|
||||
for (int i = 0; i < DATA_PRODUCT_PARAMETERS_N + 3 * DATA_PRODUCT_BUSES_MIDI_INPUT_N; i++)
|
||||
#if DATA_PRODUCT_PARAMETERS_N > 0
|
||||
for (int i = 0; i < DATA_PRODUCT_PARAMETERS_N; i++)
|
||||
c->parameters[i] = parameterData[i].def;
|
||||
#endif
|
||||
#if DATA_PRODUCT_BUSES_MIDI_INPUT_N > 0
|
||||
for (int i = DATA_PRODUCT_PARAMETERS_N; i < DATA_PRODUCT_PARAMETERS_N + 3 * DATA_PRODUCT_BUSES_MIDI_INPUT_N; i += 3) {
|
||||
c->parameters[i] = 0.0;
|
||||
c->parameters[i + 1] = 0.5;
|
||||
c->parameters[i + 2] = 0.0;
|
||||
}
|
||||
#endif
|
||||
return Steinberg_kResultOk;
|
||||
}
|
||||
@ -1260,14 +1269,34 @@ static Steinberg_IPluginFactory3Vtbl factoryVtbl = {
|
||||
};
|
||||
static Steinberg_IPluginFactory3 factory = { &factoryVtbl };
|
||||
|
||||
#ifdef _WIN32
|
||||
#define EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
EXPORT
|
||||
Steinberg_IPluginFactory * GetPluginFactory() {
|
||||
return (Steinberg_IPluginFactory *)&factory;
|
||||
}
|
||||
|
||||
char ModuleEntry (void *handle) {
|
||||
#ifndef _WIN32
|
||||
# if defined(__APPLE__)
|
||||
# define ENTRY bundleEntry
|
||||
# define EXIT bundleExit
|
||||
# else
|
||||
# define ENTRY ModuleEntry
|
||||
# define EXIT ModuleExit
|
||||
# endif
|
||||
|
||||
EXPORT
|
||||
char ENTRY(void *handle) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
char ModuleExit () {
|
||||
EXPORT
|
||||
char EXIT() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user