-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
75 lines (64 loc) · 2.83 KB
/
Copy pathmakefile
File metadata and controls
75 lines (64 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Makefile for audio capture projects
# Standard Linux audio capture with PortAudio
LINUX_EXEC = cppaudiocapture
LINUX_CLIB = -I./lib/portaudio/include ./lib/portaudio/lib/.libs/libportaudio.a -lrt -lasound -ljack -pthread
# Windows audio capture (for Deepgram streaming)
WIN_EXEC = deepgram_streamer.exe
WIN_CFLAGS = -std=c++17
WIN_CLIB = -lole32 -lavrt -lws2_32 -lboost_system -lssl -lcrypto -lcrypt32
# Default Linux version
$(LINUX_EXEC): main.cpp
g++ -o $@ $^ $(LINUX_CLIB)
# Install Linux dependencies (PortAudio)
install-deps:
mkdir -p lib
curl -L http://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz | tar -zx -C lib
cd lib/portaudio && ./configure && $(MAKE) -j
.PHONY: install-deps
# Uninstall Linux dependencies
uninstall-deps:
cd lib/portaudio && $(MAKE) uninstall
rm -rf lib/portaudio
.PHONY: uninstall-deps
# Windows audio capture cross-compilation
windows: DeepgramAudioStreamer.cpp
x86_64-w64-mingw32-g++ $(WIN_CFLAGS) -o $(WIN_EXEC) $^ $(WIN_CLIB)
.PHONY: windows
# Install Windows cross-compilation tools
install-win-tools:
sudo apt update
sudo apt install -y mingw-w64 mingw-w64-tools
.PHONY: install-win-tools
# Install Boost for Windows cross-compilation
install-win-boost:
mkdir -p lib/boost
curl -L https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.gz | tar -zx -C lib
cd lib/boost_1_81_0 && ./bootstrap.sh && \
./b2 --with-system --with-thread --with-filesystem --with-regex --with-date_time \
--build-type=complete toolset=gcc-mingw target-os=windows \
address-model=64 link=static threading=multi runtime-link=static
.PHONY: install-win-boost
# Simplified Windows compilation without cross-compilation (use in Windows CMD/PowerShell)
windows-native:
@echo "Run this command in Windows CMD or PowerShell (not WSL):"
@echo "g++ -std=c++17 -o deepgram_streamer.exe DeepgramAudioStreamer.cpp -lole32 -lavrt -lws2_32 -lboost_system -lssl -lcrypto -lcrypt32"
.PHONY: windows-native
# Clean all binaries
clean:
rm -f $(LINUX_EXEC) $(WIN_EXEC)
.PHONY: clean
# Help information
help:
@echo "Available targets:"
@echo " make - Build the Linux PortAudio version"
@echo " make install-deps - Install Linux dependencies (PortAudio)"
@echo " make windows - Cross-compile the Windows Deepgram streamer (requires MinGW)"
@echo " make install-win-tools - Install Windows cross-compilation tools"
@echo " make install-win-boost - Install Boost libraries for Windows cross-compilation"
@echo " make windows-native - Show command for native Windows compilation"
@echo " make clean - Remove all built binaries"
@echo ""
@echo "For Windows audio capture with Deepgram streaming, either:"
@echo "1. Use 'make windows' in WSL if you have MinGW cross-compilation set up"
@echo "2. Use the Windows command from 'make windows-native' in Windows cmd/PowerShell"
.PHONY: help