Allow building on non-Linux Unix systems.

- Use pkg-config to find required libraries and include paths.
- Only include extra Linux libraries on Linux.
- Add libusb fallback code to hidapi.c
This commit is contained in:
nia 2020-09-26 12:00:37 +02:00 committed by NikkyAi
parent 1b7675ddd7
commit 19b70322ef
4 changed files with 1535 additions and 9 deletions

View file

@ -6,7 +6,7 @@
#include <string.h>
#include "parameters.h"
#include <stdlib.h>
#include <libusb-1.0/libusb.h>
#include <libusb.h>
#include "color.h"
#include <math.h>
#include <unistd.h>

View file

@ -6,7 +6,7 @@
#include <string.h>
#include "parameters.h"
#include <stdlib.h>
#include <libusb-1.0/libusb.h>
#include <libusb.h>
#include "color.h"
#include <math.h>
#include <unistd.h>

View file

@ -7,18 +7,28 @@ WINGCC:= i686-w64-mingw32-gcc
WINGCCFLAGS:= -g -DICACHE_FLASH_ATTR= -I../embeddedcommon -Icnfa -Irawdraw -I. -O1 #-O2 -Wl,--relax -Wl,--gc-sections -ffunction-sections -fdata-sections
WINLDFLAGS:=-lwinmm -lgdi32 -lws2_32 -lsetupapi
RAWDRAWLIBS:=-lX11 -lm -lpthread -lXinerama -lXext
LDLIBS:=-lpthread -lasound -lm -lpulse-simple -lpulse -ludev -lrt
#CFLAGS:=-g -O1 -flto -Wall -ffast-math -I../embeddedcommon -I. -Icnfa -Irawdraw -DICACHE_FLASH_ATTR=
CFLAGS:=-g -O1 -Wall -ffast-math -I../embeddedcommon -I. -Icnfa -Irawdraw -DICACHE_FLASH_ATTR=
ifneq ($(OS),Windows_NT)
ifneq ($(shell uname),Darwin)
RAWDRAWCFLAGS:=$(shell pkg-config --cflags x11 xinerama xext libusb-1.0)
RAWDRAWLIBS:=-lm -lrt -pthread $(shell pkg-config --libs x11 xinerama xext libusb-1.0)
CFLAGS+=$(RAWDRAWCFLAGS)
endif
endif
CFLAGS:=-g -O1 -flto -Wall -ffast-math -I../embeddedcommon -I. -Icnfa -Irawdraw -DICACHE_FLASH_ATTR=
EXTRALIBS:=-lusb-1.0
ifeq ($(shell uname),Linux)
EXTRALIBS+=-ludev
EXTRALIBS+=$(shell pkg-config --libs alsa)
EXTRALIBS+=$(shell pkg-config --libs libpulse)
EXTRALIBS+=$(shell pkg-config --libs libpulse-simple)
endif
OBJS:=main.o dft.o decompose.o filter.o color.o notefinder.o util.o outdrivers.o $(OUTS) parameters.o chash.o hook.o ../embeddedcommon/DFT32.o configs.o
colorchord : $(OBJS)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS) $(EXTRALIBS) $(RAWDRAWLIBS)
$(CC) -o $@ $^ $(EXTRALIBS) $(RAWDRAWLIBS)
colorchord.exe : main.c dft.c decompose.c filter.c color.c notefinder.c util.c outdrivers.c parameters.c chash.c OutputVoronoi.c OutputProminent.c DisplayArray.c OutputLinear.c DisplayPie.c DisplayNetwork.c hook.c RecorderPlugin.c ../embeddedcommon/DFT32.c OutputCells.c configs.c hidapi.c DisplayHIDAPI.c
$(WINGCC) $(WINGCCFLAGS) -o $@ $^ $(WINLDFLAGS)

File diff suppressed because it is too large Load diff