sciapp / gr

GR framework: a graphics library for visualisation applications
Other
328 stars 54 forks source link

Use .dylib extension on macOS #128

Closed SeekingMeaning closed 3 years ago

SeekingMeaning commented 3 years ago

Closes #82

FlorianRhiem commented 3 years ago

There are two suffixes to consider for building GR. The suffix for regular shared libraries, which are expected to be linked to other programs or loaded dynamically such as libGR or libGKS, and the suffix for plugins, which should not be interacted with directly, as they are instead loaded dynamically by plugin.c. As you can see in the code there, plugin.c allows three values for the plugin suffix:

In the make build, both suffixes are set fix to .dll for Windows and .so for any other system.

In the CMake build these can be set using the variables GR_SHARED_LIBRARY_SUFFIX and GR_PLUGIN_SUFFIX, which by default will be .dll for Windows and .so for everything else, as to stay compatible to the make build. Users should be able to set GR_SHARED_LIBRARY_SUFFIX to another value, e.g. .dylib without any issues at all, but due to how plugin.c is written, GR_PLUGIN_SUFFIX is fairly fix and setting GR_PLUGIN_SUFFIX to .dylib as done here should cause issues during plugin loading.

Did you test whether your change still allows for plugins to be loaded, e.g. by using GKS_WSTYPE=png?

Also, issue #82 seems concerned with the shared library suffix, not with the plugin suffix, as libGR is mentioned. As plugin loading is handled internally, the plugin suffix should not matter to users.

SeekingMeaning commented 3 years ago

Updated to only change GR_SHARED_LIBRARY_SUFFIX

FlorianRhiem commented 3 years ago

Thanks for the update, @SeekingMeaning! The wrappers, e.g. GR.jl and the gr python package, will need changes to be able to find the .dylib files instead of the current .so files. The Makefile-based build might need to be changed as well, to keep things consistent. As the holidays are coming up, we will look into those changes early next year to be able to then merge this.

FlorianRhiem commented 3 years ago

So, that took a little longer, but we have now made the switch to using .dylib as the shared library extension on macOS. The python wrapper can use both, and the julia wrapper will now switch to using .dylib. Thank you for taking care of the CMake side of things!

kojix2 commented 3 years ago

I found out that the Mac version of the shared libraries are now .dylib files. I'll add .dylib support to GR.rb. Thanks.