How to JIT compile C++ Extension with libpng

I want to compile a custom c++ extension that uses functionality from libpng. This is what my current file looks like:

from torch.utils.cpp_extension import load
from glob import glob
import os

os.environ["CC"] = "gcc-11"
os.environ["CXX"] = "g++-11"

sources = glob("src/*.cpp")
font_renderer = load(name="font_renderer", sources=sources, extra_cflags=["-std=c++17"], verbose=True)

If I try to run this, I get an error with the first libpng function that I try and use, undefined symbol: png_get_image_width

Since I want to #include <png.h> in one of my source files, how do I go about adding this simple dependency?

Thank you.