add_library(
	NostalgiaGfx
		gfx.cpp
		tilesheet.cpp
)

target_include_directories(
	NostalgiaGfx PUBLIC
		../include
)

target_link_libraries(
	NostalgiaGfx PUBLIC
		Turbine
)

add_subdirectory(keel)
if(NOSTALGIA_BUILD_STUDIO)
	add_subdirectory(studio)
endif()

install(
	TARGETS
		NostalgiaGfx
	DESTINATION
		LIBRARY DESTINATION lib
		ARCHIVE DESTINATION lib
)

# OpenGL

if(NOT BUILDCORE_TARGET STREQUAL "gba")
	target_sources(
		NostalgiaGfx PRIVATE
			gfx-opengl.cpp
	)
	target_link_libraries(
		NostalgiaGfx PUBLIC
			GlUtils
	)
endif()

# GBA

add_library(
	NostalgiaGfx-GBA OBJECT
		gfx-gba.cpp
)
target_include_directories(
	NostalgiaGfx-GBA PUBLIC
		../include
)
target_link_libraries(
	NostalgiaGfx-GBA PUBLIC
		TeaGBA
		Keel
		Turbine
)

if(BUILDCORE_TARGET STREQUAL "gba")
	set_source_files_properties(gfx-gba.cpp PROPERTIES COMPILE_FLAGS -marm)
	target_link_libraries(NostalgiaGfx PUBLIC NostalgiaGfx-GBA)
endif()
