| 84 | |
| 85 | |
| 86 | def generate_visibility_macros(library: str) -> str: |
| 87 | return f"""#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(_MSC_VER) && \ |
| 88 | !defined({library}_STATIC_COMPILATION) |
| 89 | # define {library}_EXPORT __declspec(dllexport) |
| 90 | # define {library}_IMPORT __declspec(dllimport) |
| 91 | #else |
| 92 | # define {library}_EXPORT |
| 93 | # define {library}_IMPORT |
| 94 | #endif |
| 95 | |
| 96 | #ifdef {library}_COMPILATION |
| 97 | # define {library}_API {library}_EXPORT |
| 98 | #else |
| 99 | # define {library}_API {library}_IMPORT |
| 100 | #endif |
| 101 | |
| 102 | #define {library}_EXTERN {library}_API extern""" |
| 103 | |
| 104 | |
| 105 | def generate_encoded_versions(library: str) -> str: |