mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 19:50:12 +01:00
please work
This commit is contained in:
8
.github/workflows/python-app.yml
vendored
8
.github/workflows/python-app.yml
vendored
@@ -115,10 +115,6 @@ jobs:
|
|||||||
Copy-Item "libaudio.dll" "../../build/lib/"
|
Copy-Item "libaudio.dll" "../../build/lib/"
|
||||||
echo "Copied libaudio.dll"
|
echo "Copied libaudio.dll"
|
||||||
}
|
}
|
||||||
if (Test-Path "audio.dll") {
|
|
||||||
Copy-Item "audio.dll" "../../build/lib/"
|
|
||||||
echo "Copied audio.dll"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Copy vcpkg DLLs that are needed at runtime
|
# Copy vcpkg DLLs that are needed at runtime
|
||||||
$vcpkgBin = "$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin"
|
$vcpkgBin = "$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin"
|
||||||
@@ -130,10 +126,6 @@ jobs:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Verify what was copied
|
|
||||||
echo "Files in build/lib:"
|
|
||||||
ls ../../build/lib/
|
|
||||||
|
|
||||||
# Add to PATH
|
# Add to PATH
|
||||||
echo "${{ github.workspace }}/build/lib" >> $env:GITHUB_PATH
|
echo "${{ github.workspace }}/build/lib" >> $env:GITHUB_PATH
|
||||||
shell: powershell
|
shell: powershell
|
||||||
|
|||||||
@@ -1,31 +1,94 @@
|
|||||||
# Makefile for audio library
|
# Makefile for audio library
|
||||||
|
# Default compiler and flags for Unix-like systems
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -Wall -Wextra -O3 -fPIC -std=c99
|
CFLAGS = -Wall -Wextra -O3 -fPIC -std=c99
|
||||||
LDFLAGS = -shared -Wl,--export-dynamic
|
LDFLAGS = -shared -Wl,--export-dynamic
|
||||||
LIBS = -lportaudio -lsndfile -lsamplerate -lpthread -lm
|
LIBS = -lportaudio -lsndfile -lsamplerate -lpthread -lm
|
||||||
|
|
||||||
# Detect OS for library naming
|
# Detect OS and set appropriate flags
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s 2>/dev/null || echo Windows)
|
||||||
ifeq ($(UNAME_S),Darwin)
|
|
||||||
|
# Windows detection (including GitHub Actions Windows runners)
|
||||||
|
ifneq (,$(findstring Windows,$(UNAME_S)))
|
||||||
|
# Windows with MSVC
|
||||||
|
CC = cl
|
||||||
|
LIBNAME = libaudio.dll
|
||||||
|
CFLAGS = /O2 /W3 /MD /TC
|
||||||
|
LDFLAGS = /DLL
|
||||||
|
LIBS = portaudio.lib libsndfile.lib libsamplerate.lib
|
||||||
|
OBJ_EXT = .obj
|
||||||
|
|
||||||
|
# Check for vcpkg environment
|
||||||
|
ifdef VCPKG_INSTALLATION_ROOT
|
||||||
|
INCLUDE_PATH = /I"$(VCPKG_INSTALLATION_ROOT)/installed/x64-windows/include"
|
||||||
|
LIB_PATH = /LIBPATH:"$(VCPKG_INSTALLATION_ROOT)/installed/x64-windows/lib"
|
||||||
|
CFLAGS += $(INCLUDE_PATH)
|
||||||
|
LDFLAGS += $(LIB_PATH)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Check for environment variables set by GitHub Actions
|
||||||
|
ifdef VCPKG_INCLUDE_PATH
|
||||||
|
CFLAGS += /I"$(VCPKG_INCLUDE_PATH)"
|
||||||
|
endif
|
||||||
|
ifdef VCPKG_LIB_PATH
|
||||||
|
LDFLAGS += /LIBPATH:"$(VCPKG_LIB_PATH)"
|
||||||
|
endif
|
||||||
|
|
||||||
|
else ifeq ($(UNAME_S),Darwin)
|
||||||
|
# macOS
|
||||||
LIBNAME = libaudio.dylib
|
LIBNAME = libaudio.dylib
|
||||||
CFLAGS += -I/usr/local/include -I/opt/homebrew/include
|
CFLAGS += -I/usr/local/include -I/opt/homebrew/include
|
||||||
LDFLAGS = -shared -undefined dynamic_lookup
|
LDFLAGS = -shared -undefined dynamic_lookup
|
||||||
LDFLAGS += -L/usr/local/lib -L/opt/homebrew/lib
|
LDFLAGS += -L/usr/local/lib -L/opt/homebrew/lib
|
||||||
|
OBJ_EXT = .o
|
||||||
|
|
||||||
else ifeq ($(UNAME_S),Linux)
|
else ifeq ($(UNAME_S),Linux)
|
||||||
|
# Linux
|
||||||
LIBNAME = libaudio.so
|
LIBNAME = libaudio.so
|
||||||
|
OBJ_EXT = .o
|
||||||
|
|
||||||
else
|
else
|
||||||
LIBNAME = libaudio.dll
|
# Generic Unix fallback
|
||||||
LIBS += -lole32 -lwinmm
|
LIBNAME = libaudio.so
|
||||||
LDFLAGS = -shared
|
OBJ_EXT = .o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SOURCES = $(wildcard *.c)
|
SOURCES = $(wildcard *.c)
|
||||||
OBJECTS = $(SOURCES:.c=.o)
|
|
||||||
|
|
||||||
.PHONY: all clean install
|
# Object files with correct extension
|
||||||
|
ifneq (,$(findstring Windows,$(UNAME_S)))
|
||||||
|
OBJECTS = $(SOURCES:.c=.obj)
|
||||||
|
else
|
||||||
|
OBJECTS = $(SOURCES:.c=.o)
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: all clean install debug check-deps
|
||||||
|
|
||||||
all: $(LIBNAME)
|
all: $(LIBNAME)
|
||||||
|
|
||||||
|
# Windows-specific build rule
|
||||||
|
ifneq (,$(findstring Windows,$(UNAME_S)))
|
||||||
|
$(LIBNAME): $(OBJECTS)
|
||||||
|
link $(LDFLAGS) /OUT:$@ $^ $(LIBS)
|
||||||
|
|
||||||
|
%.obj: %.c
|
||||||
|
$(CC) $(CFLAGS) /c $< /Fo:$@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-del /Q *.obj $(LIBNAME) 2>nul || rm -f $(OBJECTS) $(LIBNAME)
|
||||||
|
|
||||||
|
install:
|
||||||
|
@echo "Install not implemented for Windows. Copy $(LIBNAME) to your application directory."
|
||||||
|
|
||||||
|
check-deps:
|
||||||
|
@echo "Checking dependencies on Windows..."
|
||||||
|
@echo "Assuming vcpkg dependencies are installed..."
|
||||||
|
@if exist "$(VCPKG_INSTALLATION_ROOT)\installed\x64-windows\include\portaudio.h" (echo PortAudio found!) else (echo PortAudio not found! && exit 1)
|
||||||
|
@if exist "$(VCPKG_INSTALLATION_ROOT)\installed\x64-windows\include\sndfile.h" (echo libsndfile found!) else (echo libsndfile not found! && exit 1)
|
||||||
|
@echo "All dependencies found!"
|
||||||
|
|
||||||
|
else
|
||||||
|
# Unix/Linux/macOS build rules
|
||||||
$(LIBNAME): $(OBJECTS)
|
$(LIBNAME): $(OBJECTS)
|
||||||
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
|
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
@@ -39,13 +102,24 @@ install: $(LIBNAME)
|
|||||||
sudo cp $(LIBNAME) /usr/local/lib/
|
sudo cp $(LIBNAME) /usr/local/lib/
|
||||||
sudo ldconfig 2>/dev/null || true
|
sudo ldconfig 2>/dev/null || true
|
||||||
|
|
||||||
# Development target with debug symbols
|
|
||||||
debug: CFLAGS += -g -DDEBUG
|
|
||||||
debug: $(LIBNAME)
|
|
||||||
|
|
||||||
# Check dependencies
|
|
||||||
check-deps:
|
check-deps:
|
||||||
@echo "Checking dependencies..."
|
@echo "Checking dependencies..."
|
||||||
@pkg-config --exists portaudio-2.0 || (echo "PortAudio not found!" && false)
|
@pkg-config --exists portaudio-2.0 || (echo "PortAudio not found!" && false)
|
||||||
@pkg-config --exists sndfile || (echo "libsndfile not found!" && false)
|
@pkg-config --exists sndfile || (echo "libsndfile not found!" && false)
|
||||||
@echo "All dependencies found!"
|
@echo "All dependencies found!"
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Development target with debug symbols (cross-platform)
|
||||||
|
debug: CFLAGS += $(if $(findstring Windows,$(UNAME_S)),/Zi,-g -DDEBUG)
|
||||||
|
debug: $(LIBNAME)
|
||||||
|
|
||||||
|
# Help target
|
||||||
|
help:
|
||||||
|
@echo "Available targets:"
|
||||||
|
@echo " all - Build the audio library (default)"
|
||||||
|
@echo " clean - Remove build artifacts"
|
||||||
|
@echo " install - Install library (Unix/Linux/macOS only)"
|
||||||
|
@echo " debug - Build with debug symbols"
|
||||||
|
@echo " check-deps- Check for required dependencies"
|
||||||
|
@echo " help - Show this help message"
|
||||||
|
|||||||
Reference in New Issue
Block a user