nanovg icon indicating copy to clipboard operation
nanovg copied to clipboard

building into a shared library

Open nextdayy opened this issue 2 years ago • 6 comments

hi, I recently tried to build nanovg as a shared library by changing the type to SharedLib in the file, and creating a nanovg_gl2.c file which included the files, but it would fail to build. (missing glFramebuffer stuff)

I am mainly unsure of what actually needs to be included if all I want is the nanovg API and the opengl 2 implementation (all the other stuff like GLFW I don't need)

I am attempting to compile it so I can use it with JNA to access the API, and any help would be appreciated (I have looked at the other similar issue by the way) Many thanks.

nextdayy avatar Aug 08 '23 21:08 nextdayy

Are you using it on Android?

vinjn avatar Aug 26 '23 23:08 vinjn

no, just trying to build for JNA. we are specifically targeting Linux, MacOS, MacOS ARM, and Windows. I was trying to build on Linux.

nextdayy avatar Aug 28 '23 14:08 nextdayy

Ok - glFramebuffer stuff is not part of nanovg, it's covered by libraries like glew, did you built the library aginst glew?

vinjn avatar Aug 28 '23 16:08 vinjn

yeah, I'm not sure how I'd build against glew into JNA - firstly when I tried with it with glew, it wouldn't work as shared library, but also, I don't know how to do it with glew in the JNA (I guess I'd need to include glew as well?)

nextdayy avatar Aug 28 '23 19:08 nextdayy

Yes, you need to include glew

vinjn avatar Aug 28 '23 20:08 vinjn

You may look at the scripts i wrote in build_tarballs.jl, which builds nanovg as a shared library to be used from the julia language.

Additionally, i converted the premake file to a CMake one. You can see it here: CMakeLists.txt. There are also some patches for some headers missing, but this may vary depending on the platform you're building for.

dylanxyz avatar Nov 01 '23 22:11 dylanxyz