PROJECT_NAME=nostalgia
BUILDCORE_PATH=deps/buildcore
VCPKG_PKGS=sdl2 jsoncpp
include ${BUILDCORE_PATH}/base.mk

ifeq ($(OS),darwin)
	NOSTALGIA_STUDIO=./dist/${CURRENT_BUILD}/nostalgia-studio.app/Contents/MacOS/nostalgia-studio
	MGBA=/Applications/mGBA.app/Contents/MacOS/mGBA
else
	NOSTALGIA_STUDIO=./dist/${CURRENT_BUILD}/bin/nostalgia-studio
	MGBA=mgba-qt
endif

.PHONY: pkg-gba
pkg-gba:
	${ENV_RUN} ${CMAKE_BUILD} build install
	${ENV_RUN} ./scripts/pkg-gba sample_project

.PHONY: run
run: install
	./dist/${CURRENT_BUILD}/bin/nostalgia sample_project
.PHONY: run-studio
run-studio: install
	${NOSTALGIA_STUDIO}
.PHONY: gba-run
gba-run: pkg-gba
	${MGBA} nostalgia.gba
.PHONY: debug
debug: install
	${DEBUGGER} ./dist/${CURRENT_BUILD}/bin/nostalgia sample_project
.PHONY: debug-studio
debug-studio: install
	${DEBUGGER} ${NOSTALGIA_STUDIO}

.PHONY: configure-gba
configure-gba:
	${ENV_RUN} ${SETUP_BUILD} --toolchain=deps/gbabuildcore/cmake/modules/GBA.cmake --target=gba --current_build=0 --build_type=release

.PHONY: configure-gba-debug
configure-gba-debug:
	${ENV_RUN} ${SETUP_BUILD} --toolchain=deps/gbabuildcore/cmake/modules/GBA.cmake --target=gba --current_build=0 --build_type=debug