c++ support in cmd
This commit is contained in:
parent
d1c09830cf
commit
498cca410c
1
TODO
1
TODO
@ -25,3 +25,4 @@
|
|||||||
* error checking etc. web, especially processor.js
|
* error checking etc. web, especially processor.js
|
||||||
* LV2: round latency output value
|
* LV2: round latency output value
|
||||||
* daisy-seed: DAC
|
* daisy-seed: DAC
|
||||||
|
* plugin_init and plugin_set_sample_rate to return char (can fail)
|
||||||
|
@ -14,6 +14,7 @@ DATA_DIR := $(or $(DATA_DIR),.)
|
|||||||
PLUGIN_DIR := $(or $(PLUGIN_DIR),src)
|
PLUGIN_DIR := $(or $(PLUGIN_DIR),src)
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
|
CXX = g++
|
||||||
|
|
||||||
CFLAGS = -O3 -Wall -Wpedantic -Wextra
|
CFLAGS = -O3 -Wall -Wpedantic -Wextra
|
||||||
CFLAGS_ALL = -I${DATA_DIR}/src -I${PLUGIN_DIR} -I${TINYWAV_DIR} -I${MIDI_PARSER_DIR}/include -fPIC ${CFLAGS} ${CFLAGS_EXTRA}
|
CFLAGS_ALL = -I${DATA_DIR}/src -I${PLUGIN_DIR} -I${TINYWAV_DIR} -I${MIDI_PARSER_DIR}/include -fPIC ${CFLAGS} ${CFLAGS_EXTRA}
|
||||||
@ -21,26 +22,32 @@ CFLAGS_ALL = -I${DATA_DIR}/src -I${PLUGIN_DIR} -I${TINYWAV_DIR} -I${MIDI_PARSER_
|
|||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
LDFLAGS_ALL = ${LDFLAGS} ${LDFLAGS_EXTRA}
|
LDFLAGS_ALL = ${LDFLAGS} ${LDFLAGS_EXTRA}
|
||||||
|
|
||||||
|
CXXFLAGS = ${CFLAGS}
|
||||||
|
CXXFLAGS_ALL = -I${DATA_DIR}/src -I${PLUGIN_DIR} -I${TINYWAV_DIR} -I${MIDI_PARSER_DIR}/include -fPIC ${CXXFLAGS} ${CXXFLAGS_EXTRA}
|
||||||
|
|
||||||
ifeq ($(UNAME_S), Darwin)
|
ifeq ($(UNAME_S), Darwin)
|
||||||
CFLAGS_ALL := ${CFLAGS_ALL} -arch arm64 -arch x86_64
|
CFLAGS_ALL := ${CFLAGS_ALL} -arch arm64 -arch x86_64
|
||||||
LDFLAGS_ALL := ${LDFLAGS_ALL} -arch arm64 -arch x86_64
|
LDFLAGS_ALL := ${LDFLAGS_ALL} -arch arm64 -arch x86_64
|
||||||
|
CXXFLAGS_ALL := ${CXXFLAGS_ALL} -arch arm64 -arch x86_64
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PROGRAM = ${BUNDLE_NAME}${EXE_SUFFIX}
|
PROGRAM = ${BUNDLE_NAME}${EXE_SUFFIX}
|
||||||
|
|
||||||
C_SRCS = ${COMMON_DIR}/src/main.c ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c
|
C_SRCS = ${COMMON_DIR}/src/main.c ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c ${C_SRCS_EXTRA}
|
||||||
C_OBJS = $(addprefix build/obj/, $(notdir $(C_SRCS:.c=.o)))
|
C_OBJS = $(addprefix build/obj/, $(notdir $(C_SRCS:.c=.o)))
|
||||||
|
|
||||||
|
CXX_SRCS = ${CXX_SRCS_EXTRA}
|
||||||
|
CXX_OBJS = $(addprefix build/obj/, $(notdir $(CXX_SRCS:.cpp=.o)))
|
||||||
|
|
||||||
all: build/${PROGRAM}
|
all: build/${PROGRAM}
|
||||||
|
|
||||||
|
ifeq ($(CXX_OBJS),)
|
||||||
build/${PROGRAM}: ${C_OBJS} | build
|
build/${PROGRAM}: ${C_OBJS} | build
|
||||||
${CC} $^ -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL}
|
${CC} $^ -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL}
|
||||||
|
else
|
||||||
.SECONDEXPANSION:
|
build/${PROGRAM}: ${C_OBJS} ${CXX_OBJS} | build
|
||||||
|
${CXX} $^ -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL}
|
||||||
PERCENT := %
|
endif
|
||||||
$(C_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).c,$$(C_SRCS)) | build/obj
|
|
||||||
${CC} $^ -o $@ -c ${CFLAGS_ALL}
|
|
||||||
|
|
||||||
build build/obj:
|
build build/obj:
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
@ -49,15 +56,22 @@ clean:
|
|||||||
rm -fr build
|
rm -fr build
|
||||||
|
|
||||||
ifeq ($(OS), Windows_NT)
|
ifeq ($(OS), Windows_NT)
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
mkdir -p -m 0755 ${BINDIR}
|
mkdir -p -m 0755 ${BINDIR}
|
||||||
install -m 0755 build/${PROGRAM} ${BINDIR}
|
install -m 0755 build/${PROGRAM} ${BINDIR}
|
||||||
|
|
||||||
.PHONY: all clean install
|
.PHONY: all clean install
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
.SECONDEXPANSION:
|
||||||
|
|
||||||
|
PERCENT := %
|
||||||
|
|
||||||
|
$(C_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).c,$$(C_SRCS)) | build/obj
|
||||||
|
${CC} $^ -o $@ -c ${CFLAGS_ALL}
|
||||||
|
|
||||||
|
$(CXX_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).cpp,$$(CXX_SRCS)) | build/obj
|
||||||
|
${CXX} $^ -o $@ -c ${CXXFLAGS_ALL}
|
||||||
|
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
BUNDLE_NAME := {{=it.product.bundleName}}
|
BUNDLE_NAME := {{=it.product.bundleName}}
|
||||||
|
|
||||||
CFLAGS_EXTRA := {{=it.make && it.make.cflags ? it.make.cflags : ""}} {{=it.cmd_make.cflags ? it.cmd_make.cflags : ""}}
|
CFLAGS_EXTRA := {{=it.make && it.make.cflags ? it.make.cflags : ""}} {{=it.cmd_make.cflags ? it.cmd_make.cflags : ""}}
|
||||||
|
CXXFLAGS_EXTRA := {{=it.make && it.make.cxxflags ? it.make.cxxflags : ""}} {{=it.cmd_make.cxxflags ? it.cmd_make.cxxflags : ""}}
|
||||||
LDFLAGS_EXTRA := {{=it.make && it.make.ldflags ? it.make.ldflags : ""}} {{=it.cmd_make.ldflags ? it.cmd_make.ldflags : ""}}
|
LDFLAGS_EXTRA := {{=it.make && it.make.ldflags ? it.make.ldflags : ""}} {{=it.cmd_make.ldflags ? it.cmd_make.ldflags : ""}}
|
||||||
|
|
||||||
|
C_SRCS_EXTRA := {{=it.make && it.make.cSrcs ? it.make.cSrcs : ""}} {{=it.cmd_make.cSrcs ? it.cmd_make.cSrcs : ""}}
|
||||||
|
CXX_SRCS_EXTRA := {{=it.make && it.make.cxxSrcs ? it.make.cxxSrcs : ""}} {{=it.cmd_make.cxxSrcs ? it.cmd_make.cxxSrcs : ""}}
|
||||||
|
|
||||||
COMMON_DIR := {{=it.cmd_make && it.cmd_make.commonDir ? it.cmd_make.commonDir : (it.make && it.make.commonDir ? it.make.commonDir : "")}}
|
COMMON_DIR := {{=it.cmd_make && it.cmd_make.commonDir ? it.cmd_make.commonDir : (it.make && it.make.commonDir ? it.make.commonDir : "")}}
|
||||||
DATA_DIR := {{=it.cmd_make && it.cmd_make.dataDir ? it.cmd_make.dataDir : (it.make && it.make.dataDir ? it.make.dataDir : "")}}
|
DATA_DIR := {{=it.cmd_make && it.cmd_make.dataDir ? it.cmd_make.dataDir : (it.make && it.make.dataDir ? it.make.dataDir : "")}}
|
||||||
PLUGIN_DIR := {{=it.cmd_make && it.cmd_make.pluginDir ? it.cmd_make.pluginDir : (it.make && it.make.pluginDir ? it.make.pluginDir : "")}}
|
PLUGIN_DIR := {{=it.cmd_make && it.cmd_make.pluginDir ? it.cmd_make.pluginDir : (it.make && it.make.pluginDir ? it.make.pluginDir : "")}}
|
||||||
|
|
||||||
TINYWAV_DIR := {{=it.cmd_make.tinywavDir}}
|
TINYWAV_DIR := {{=it.cmd_make.tinywavDir}}
|
||||||
MIDI_PARSER_DIR := {{=it.cmd_make.midiParserDir}}
|
MIDI_PARSER_DIR := {{=it.cmd_make.midiParserDir}}
|
||||||
|
Loading…
Reference in New Issue
Block a user