memononen / nanovg

Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations.
zlib License
5.12k stars 766 forks source link

Build instructions for osx #491

Open hemantasapkota opened 6 years ago

hemantasapkota commented 6 years ago

For those struggling to build for osx ( High Sierra ), these instructions might be helpful:

Install dependencies

brew install premake
brew install glfw3
brew install gnu-sed

Replace all occurrences of glfw3 to glfw

gsed -i "s/{ \"glfw3\" }/{ \"glfw\" }/g" premake4.lua

Generate Build

premake4 gmake

Build

cd build
make
michealowen commented 1 year ago

For those struggling to build for osx ( High Sierra ), these instructions might be helpful:

Install dependencies

brew install premake
brew install glfw3
brew install gnu-sed

Replace all occurrences of glfw3 to glfw

gsed -i "s/{ \"glfw3\" }/{ \"glfw\" }/g" premake4.lua

Generate Build

premake4 gmake

Build

cd build
make

When I run make, i got `==== Building nanovg (debug_native) ==== ==== Building example_gl2 (debug_native) ==== demo.c ../example/demo.c:8:10: fatal error: 'GLFW/glfw3.h' file not found

include <GLFW/glfw3.h>

     ^~~~~~~~~~~~~~

1 error generated. make[1]: [obj/native/Debug/example_gl2/demo.o] Error 1 make: [example_gl2] Error 2`

mulle-nat commented 1 year ago

For starters I would try brew ls glfw3 and see where the headers are. Then add the parent folder of GLFW with -isystem <incdir> to the Makefile CFLAGS. That should work, until you get to the linker. Then do the a similiar search for the library and use -L <libdir> in LDFLAGS.

oubiwann commented 1 year ago

I had issues with this, too. Here's what worked for me:

brew install premake glfw 
premake5 gmake
cd build

CFLAGS="-I/opt/homebrew/Cellar/glfw/3.3.8/include" \
LDFLAGS="-L/opt/homebrew/Cellar/glfw/3.3.8/lib" \
make nanovg