lexus2k / lcdgfx

Driver for LCD displays running on Arduino/Avr/ESP32/Linux (including Rasperry) platforms
MIT License
377 stars 52 forks source link

Add macOS support in emulation mode #19

Closed enekochan closed 4 years ago

enekochan commented 4 years ago

First SDL2 has to be installed in the system. It can be done from the sources:

curl -O https://www.libsdl.org/release/SDL2-2.0.12.tar.gz
tar xzvf SDL2-2.0.12.tar.gz
cd SDL2-2.0.12
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr/local
make
sudo make install

Or via MacPorts (also via Homebrew but I don't use it):

sudo port install libsdl2

Now build the SDL tools. If SDL2 was compiled from source:

cd tools/sdl
cp Makefile.mac Makefile
make

If you installed it with MacPorts use CFLAGS to tell make where the library is installed:

cd tools/sdl
cp Makefile.mac Makefile
make CFLAGS=-I/opt/local/include/

Note: You can ommit copying the Makefile.mac to Makefile by telling make which file to use like this: make -f Makefile.mac.

Now compile the library source code with SDL emulation support:

cd ../../src
cp Makefile.mac Makefile
make SDL_EMULATION=y

And finaly build and run some demos!

cd ../tools
./build_and_run.sh -p mac -e -f demos/ssd1306_demo
./build_and_run.sh -p mac -e -f games/arkanoid8
CLAassistant commented 4 years ago

CLA assistant check
All committers have signed the CLA.

lexus2k commented 4 years ago

Thank you for the great job. I'm really inspired by your changes, they are very accurate.