From: Peter Schmidtke (peter.schmidtke_at_discngine.com)
Date: Thu Dec 02 2021 - 07:58:11 CST

Hi Yuri,

I also had a few issues with this in the past & had to adapt the mmcif parser a bit as well in the past. Here you have a fork of the plugin with a CI pipe for automated compilation (used mainly as molecular format reader of fpocket - so linked in there): https://urldefense.com/v3/__https://github.com/Discngine/molfile_plugin__;!!DZ3fjg!vrWapR-gT2jKoQ-J511mzRPY1d3nWoRjf3F9lX0dT5QDzCJYiDyKg-X5dP6IrHzgNw$
As for netcdf, if you just want to compile the pdbformat support, you can adapt the make to just do that instead

<https://urldefense.com/v3/__https://github.com/Discngine/molfile_plugin__;!!DZ3fjg!vrWapR-gT2jKoQ-J511mzRPY1d3nWoRjf3F9lX0dT5QDzCJYiDyKg-X5dP6IrHzgNw$ >
Peter

[https://urldefense.com/v3/__https://opengraph.githubassets.com/5db9cdb23f3349f3dc4a71a2d1b86a78a9fe70a66a9423d5fa355dcbc11cfb00/Discngine/molfile_plugin__;!!DZ3fjg!vrWapR-gT2jKoQ-J511mzRPY1d3nWoRjf3F9lX0dT5QDzCJYiDyKg-X5dP5keOeHbw$ ]<https://urldefense.com/v3/__https://github.com/Discngine/molfile_plugin__;!!DZ3fjg!vrWapR-gT2jKoQ-J511mzRPY1d3nWoRjf3F9lX0dT5QDzCJYiDyKg-X5dP6IrHzgNw$ >
GitHub - Discngine/molfile_plugin: fork of VMD molfile plugin<https://urldefense.com/v3/__https://github.com/Discngine/molfile_plugin__;!!DZ3fjg!vrWapR-gT2jKoQ-J511mzRPY1d3nWoRjf3F9lX0dT5QDzCJYiDyKg-X5dP6IrHzgNw$ >
fork of VMD molfile plugin. Contribute to Discngine/molfile_plugin development by creating an account on GitHub.
github.com

________________________________
From: owner-vmd-l_at_ks.uiuc.edu <owner-vmd-l_at_ks.uiuc.edu> on behalf of John Stone <johns_at_ks.uiuc.edu>
Sent: Thursday, December 2, 2021 06:16
To: Axel Kohlmeyer <akohlmey_at_gmail.com>
Cc: Kochnev, Iurii K <IKK6_at_pitt.edu>; vmd-l_at_ks.uiuc.edu <vmd-l_at_ks.uiuc.edu>
Subject: Re: vmd-l: molfile plugin compilation for webassembly

Hi,
  Beyond what Axel has already said, I should point out that the stock makefile provides the caller with fairly significant control over which plugins are compiled or not based on whether particular environment variables are set. In particular, this is the simplest way to disable compilation of plugins that have additional dependencies, such as
NetCDF. The "build.csh" script in the top level plugin directory
has many example configurations, some of which disable a bunch of
the plugins for builds on particular platforms, etc. You can see
somewhat more concrete explanation about this here:
  https://www.ks.uiuc.edu/Research/vmd/plugins/doxygen/compiling.html

The key issue that you'll need to keep in mind when compiling
static plugins is that when they are compiled statically, the makefile
builds a special include file that contains build-time-generated
code to cause VMD to register all of the statically linked plugins
at startup, called "libmolfile_plugin.h", which contains lots of
static registration, init, and fini function prototypes, and macros
that actually invoke the entire list of registration/init/fini functions
during VMD startup and shutdown via MOLFILE_REGISTER_ALL, MOLFILE_INIT_ALL,
and MOLFILE_FINI_ALL macros. The build-time-generated function prototypes
in libmolfile_plugin.h look like this, just as an example:

extern int molfile_msmsplugin_init(void);
extern int molfile_msmsplugin_register(void *, vmdplugin_register_cb);
extern int molfile_msmsplugin_fini(void);
extern int molfile_namdbinplugin_init(void);
extern int molfile_namdbinplugin_register(void *, vmdplugin_register_cb);
extern int molfile_namdbinplugin_fini(void);
extern int molfile_offplugin_init(void);
extern int molfile_offplugin_register(void *, vmdplugin_register_cb);
extern int molfile_offplugin_fini(void);
extern int molfile_parm7plugin_init(void);
extern int molfile_parm7plugin_register(void *, vmdplugin_register_cb);
extern int molfile_parm7plugin_fini(void);
extern int molfile_parmplugin_init(void);
extern int molfile_parmplugin_register(void *, vmdplugin_register_cb);
extern int molfile_parmplugin_fini(void);
extern int molfile_pbeqplugin_init(void);
extern int molfile_pbeqplugin_register(void *, vmdplugin_register_cb);
extern int molfile_pbeqplugin_fini(void);
extern int molfile_pdbplugin_init(void);
extern int molfile_pdbplugin_register(void *, vmdplugin_register_cb);
extern int molfile_pdbplugin_fini(void);
extern int molfile_pdbxplugin_init(void);
extern int molfile_pdbxplugin_register(void *, vmdplugin_register_cb);
extern int molfile_pdbxplugin_fini(void);
extern int molfile_phiplugin_init(void);
extern int molfile_phiplugin_register(void *, vmdplugin_register_cb);
extern int molfile_phiplugin_fini(void);

Best,
  John Stone
  vmd_at_ks.uiuc.edu

On Wed, Dec 01, 2021 at 11:22:57PM -0500, Axel Kohlmeyer wrote:
> It is rather straightforward to compile individual plugins. Most are
> self-contained and just a single source file (plus the two plugin headers)
> or a single source plus one or a few included files. You can also
> configure which plugins are compiled when you follow the plugin
> compilation instructions. If you only want the PDB plugin, you can compile
> the static version of the library and then just copy the object file.
> On Wed, Dec 1, 2021 at 2:29 PM Kochnev, Iurii K <[1]IKK6_at_pitt.edu> wrote:
>
> Hello.
> I am trying to port some project to webassembly to turn it into a web
> application. I am using emscripten tools [1] for the task. The only
> dependency of the project I am having troubles with is the VMD molfile
> plugin. I need to build it as a static library. Any advice on this?
> Specifically, is there a way of building some minimal version of it?
> Ideally, to only support PDB files. For example, I know it requires
> netCDF library to handle certain file formats. Is there a way of
> disabling, so that I won't have to compile it also to webassembly?
> Best regards,
> yuri
> References:
> 1.
> [2]https://urldefense.com/v3/__https://emscripten.org/__;!!DZ3fjg!sD0Jd015pj5_YOcJlEBeihVhkNelWHcz9ONJ_C21LdbrFHpeZEsrNvCLL1ukvcffeA$
>
> --
> Dr. Axel Kohlmeyer  [3]akohlmey_at_gmail.com  [4]https://urldefense.com/v3/__http://goo.gl/1wk0__;!!DZ3fjg!vrWapR-gT2jKoQ-J511mzRPY1d3nWoRjf3F9lX0dT5QDzCJYiDyKg-X5dP5VJRVr1A$
> College of Science & Technology, Temple University, Philadelphia PA, USA
> International Centre for Theoretical Physics, Trieste. Italy.
>
> References
>
> Visible links
> 1. mailto:IKK6_at_pitt.edu
> 2. https://urldefense.com/v3/__https://emscripten.org/__;!!DZ3fjg!sD0Jd015pj5_YOcJlEBeihVhkNelWHcz9ONJ_C21LdbrFHpeZEsrNvCLL1ukvcffeA$
> 3. mailto:akohlmey_at_gmail.com
> 4. https://urldefense.com/v3/__http://goo.gl/1wk0__;!!DZ3fjg!qAuYX4z9inlSzz-gGA0cNKcEMnHxohJR-fdhxC-eEhMbr3rSxKr3JCy0PQG8Me8MKQ$

--
NIH Center for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/