Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Szymaniak authored and Michal Szymaniak committed Oct 21, 2018
0 parents commit 8fb7eb6
Show file tree
Hide file tree
Showing 127 changed files with 34,331 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
*.o
*.d
*.a
*.so
*.dll
*.res
*.pyc
*.pyd
*.log
*.srt
*.words
*.dict
*.sqlite3
*.pot
*.vim
*.dot
tags
.envrc
*.depend
*.layout
*.exe
*.msi
.env
CppCheckResults.xml
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions gizmo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
config.mk
ycm_flags.py
test/tests

12 changes: 12 additions & 0 deletions gizmo/.ycm_extra_conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import ycm_core

def FlagsForFile(filename):
try:
from ycm_flags import flags
except:
flags = [ '-x', 'c++', '-Wall', '-Wextra', '-std=c++11', '-I.' ]

return {
'flags': flags,
'do_cache': True
}
138 changes: 138 additions & 0 deletions gizmo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
############################################
### load platform specific configuration ###
############################################

ifndef CFG
CFG = config.mk
ifeq (,$(wildcard $(CFG)))
$(info $(CFG) file not found, using auto configuration)
$(info )
CFG = config/auto.mk
endif
endif

include $(CFG)


#####################################
### default targets configuration ###
#####################################

CXXFLAGS_REL ?= -O3 \
-g \
-fomit-frame-pointer \
-fexpensive-optimizations \
-DNDEBUG \

CXXFLAGS_DBG ?= -O0 \
-g \

CXXFLAGS_PROF ?= -O3 \
-pg \
-fexpensive-optimizations \
-DNDEBUG \


####################################
### default global configuration ###
####################################
LIB_SUFFIX ?= .so
PREFIX ?= /usr/local
TARGET ?= ../subsync/gizmo$(LIB_SUFFIX)


CXXFLAGS += \
-Wall \
-Wextra \
-pedantic \
-fPIC \
-std=c++14 \
-fvisibility=hidden \
-I. \

LDFLAGS += \
-Wl,--as-needed \


######################
### artifact files ###
######################

SOURCES = \
extractor.cpp \
correlator.cpp \
media/demux.cpp \
media/stream.cpp \
media/audiodec.cpp \
media/audioresampler.cpp \
media/audiodmx.cpp \
media/subdec.cpp \
media/speechrec.cpp \
text/translator.cpp \
text/dictionary.cpp \
text/utf8.cpp \
text/wordsqueue.cpp \
math/point.cpp \
math/line.cpp \
math/linefinder.cpp \
general/exception.cpp \
general/logger.cpp \
python/wrapper.cpp \
python/general.cpp \
python/extractor.cpp \
python/media.cpp \
python/stream.cpp \
python/correlator.cpp \
python/translator.cpp \

OBJECTS = $(SOURCES:.cpp=.o)

DEPENDS = $(SOURCES:.cpp=.d)


#####################
### build recipes ###
#####################

all: rel

rel: CXXFLAGS += $(CXXFLAGS_REL)
rel: LDFLAGS += $(LDFLAGS_REL)
rel: $(TARGET)
$(info RELEASE target done)

dbg: CXXFLAGS += $(CXXFLAGS_DBG)
dbg: LDFLAGS += $(LDFLAGS_DBG)
dbg: $(TARGET)
$(info DEBUG target done)

prof: CXXFLAGS += $(CXXFLAGS_PROF)
prof: LDFLAGS += $(LDFLAGS_PROF)
prof: $(TARGET)
$(info PROFILE target done)

clean:
$(RM) $(OBJECTS)
$(RM) $(DEPENDS)
$(RM) $(TARGET)


-include $(DEPENDS)

$(OBJECTS): %.o: %.cpp
$(CXX) -c -o $@ $< $(CXXFLAGS)
$(CXX) -MM $(CXXFLAGS) $*.cpp -MF $*.d -MQ $@


$(TARGET): $(OBJECTS)
$(CXX) -shared -o $@ $^ $(LDFLAGS)


ycm_flags.py: .FORCE
@echo "flags = '$(CXXFLAGS) $(LDFLAGS)'.split()" > $@

-include test/test.mk

.PHONY: all build clean
.PHONY: rel dbg prof
.PHONY: .FORCE
12 changes: 12 additions & 0 deletions gizmo/config/auto.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ifeq ($(OS),Windows_NT)
include config/windows.mk
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
include config/linux.mk
else ifeq ($(UNAME_S),Darwin)
include config/macos.mk
else
$(error cannot detect architecture, you must select configuration manually)
endif
endif
20 changes: 20 additions & 0 deletions gizmo/config/linux.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
PYTHON_PREFIX ?= python

LIBS += \
pocketsphinx \
sphinxbase \
libavdevice \
libavformat \
libavfilter \
libavcodec \
libswresample \
libswscale \
libavutil \

CXXFLAGS += $(shell pkg-config --cflags $(LIBS))
LDFLAGS += $(shell pkg-config --libs $(LIBS))

CXXFLAGS += $(shell $(PYTHON_PREFIX) -m pybind11 --includes)

LIB_SUFFIX ?= $(shell $(PYTHON_PREFIX)-config --extension-suffix)

25 changes: 25 additions & 0 deletions gizmo/config/windows.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
LIB_SUFFIX ?= .pyd

CXXFLAGS += \
-I$(POCKETSPHINX)\include \
-I$(SPHINXBASE)\include \
-I$(SPHINXBASE)\include\win32 \
-I$(FFMPEG)\include \
-D__STDC_CONSTANT_MACROS

LDFLAGS += \
-lsphinxbase \
-lpocketsphinx \
-L$(POCKETSPHINX)\bin\Release\x64 \
-L$(SPHINXBASE)\bin\Release\x64 \
-lavdevice \
-lavformat \
-lavfilter \
-lavcodec \
-lswresample \
-lswscale \
-lavutil \
-L$(FFMPEG)\lib \
$(PYTHONLIB) \

CXXFLAGS += $(shell python -m pybind11 --includes)
Loading

0 comments on commit 8fb7eb6

Please sign in to comment.