CXX ?= g++
PKG_CONFIG ?= pkg-config
MOC ?= /usr/lib/qt6/moc

PORTAL_CFLAGS := $(shell $(PKG_CONFIG) --cflags Qt6Core Qt6DBus Qt6Gui gstreamer-1.0 gstreamer-app-1.0 gstreamer-video-1.0)
PORTAL_LIBS := $(shell $(PKG_CONFIG) --libs Qt6Core Qt6DBus Qt6Gui gstreamer-1.0 gstreamer-app-1.0 gstreamer-video-1.0)

.PHONY: all clean

all: portal_capture_frame

portal_capture_frame: portal_capture_frame.cpp portal_capture_frame.moc
	$(CXX) -std=c++17 -O2 -Wall -Wextra -fPIC $(PORTAL_CFLAGS) $< -o $@ $(PORTAL_LIBS)

portal_capture_frame.moc: portal_capture_frame.cpp
	$(MOC) $< -o $@

clean:
	rm -f portal_capture_frame portal_capture_frame.moc
