From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Dec 01 2021 - 23:16:17 CST

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]http://goo.gl/1wk0
> 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/