sandialabs / seacas

The Sandia Engineering Analysis Code Access System (SEACAS) is a suite of preprocessing, postprocessing, translation, and utility applications supporting finite element analysis software using the Exodus database file format.
Other
131 stars 79 forks source link

Support shared exodus library on windows #439

Closed gsjaardema closed 6 months ago

gsjaardema commented 6 months ago

Patch from external to support building shared exodus library on windows for use with exodus.py.

HI Greg,

I got an initial build with exodus3.py working on Windows. Attached is the patch to make that work.

Many of the errors I was getting before were related to building Seacas against a shared exodus library. Once I changed TRIBITS_ADD_LIBRARY to ADD_LIBRARY, some confusion about which libraries to link with was cleared up. I see that for building a static library, ADD_LIBRARY was already used.

In exodusII.h, I added a check for defining __declspec(dllexport) as needed by exodus3.py.

I think long term, if you needed the dllimport, and if you needed to support both shared and static builds of exodus at the same time, I think one could add a PUBLIC COMPILE_DEFINITIONS property on exodus_shared to indicate the exodusII.h will be used with a shared library. That would allow exodusII.h to be used for both static and shared builds. Putting static vs. shared information into a generated header file might prevent using the headers for both static and shared libraries. The current addition of __declspec(dllexport) is compatible with the potential long term change proposed here.

Thanks, Clint