I did some research on this, and I wanted to share what worked for me. I created a directory structure like this:
/ |->src/ | |-> Makefile.am | |-> main.cpp | |-> functions.cpp | |-> data/ | |-> Makefile.am | |-> somethings.png | |-> something.mp3 |-> configure.ac |-> README |-> NEWS, AUTHORS etc. etc.
I put all my images, fonts, sounds, etc. to the data folder. Makefile.am in the data folder is as follows:
pkgdata_DATA = esound.wav \ another.wav \ apicture.png
It simply lists all the files that should be in the data directory. The Makefile.am file in the src folder is as follows:
bin_PROGRAMS = mygame mygame_SOURCES = main.cpp functions.cpp AM_CPPFLAGS = -DDATADIR=\"$(pkgdatadir)\"
The important part here is AM_CPPFLAGS, which defines the DATADIR macro according to the parameters passed to the configure script. So, we can use this macro in our source files as follows:
background = load_image( DATADIR "/background.png");
So, your program will be compiled, knowing where the background file should be in the file system.
yasar source share