cmake构建时自动生成mk_export头文件,解决msvc链接设备问题 (#1660)

* 解决msvc下链接问题
* CMAKE添加自动生成mk api export头文件
* 兼容非cmake构建时情况

Co-authored-by: baiyfcu <baiyfcu@gmail.com>
This commit is contained in:
夏楚
2022-05-26 20:30:43 +08:00
committed by GitHub
parent 989e7b2e75
commit e2908e9775
7 changed files with 40 additions and 27 deletions

View File

@@ -14,21 +14,26 @@
#include <stdint.h>
#include <stddef.h>
#if defined(GENERATE_EXPORT)
#include "mk_export.h"
#endif
#if defined(_WIN32) && defined(_MSC_VER)
# ifndef MediaKitApi_STATIC
# if defined(MediaKitApi_EXPORTS)
# define API_EXPORT __declspec(dllexport)
# else
# define API_EXPORT __declspec(dllimport)
# endif
# define API_CALL __cdecl
# else
# define API_EXPORT
# define API_CALL
# endif
# define API_CALL __cdecl
#else
# define API_CALL
#endif
#if defined(_WIN32) && defined(_MSC_VER)
# if !defined(GENERATE_EXPORT)
# if defined(MediaKitApi_EXPORTS)
# define API_EXPORT __declspec(dllexport)
# else
# define API_EXPORT __declspec(dllimport)
# endif
# endif
#elif !defined(GENERATE_EXPORT)
# define API_EXPORT
# define API_CALL
#endif
#ifdef __cplusplus