diff options
-rw-r--r-- | Android.bp | 25 | ||||
-rw-r--r-- | src/tss2-tcti/tctildr-nodl.c | 2 | ||||
-rw-r--r-- | src/tss2-tcti/tctildr.c | 6 | ||||
-rw-r--r-- | src/util/io.h | 4 |
4 files changed, 31 insertions, 6 deletions
@@ -40,6 +40,15 @@ cc_defaults { "include", ], host_supported: true, + target: { + windows: { + enabled: true, + cflags: [ + "-DNOGDI", + "-Wno-format", + ], + }, + }, } cc_library { @@ -115,11 +124,17 @@ cc_library { local_include_dirs: [ "include/tss2", "src", - "src/util", ], shared_libs: [ "libbase", ], + target: { + windows: { + host_ldlibs: [ + "-lws2_32", + ], + }, + }, } cc_library { @@ -127,7 +142,6 @@ cc_library { defaults: [ "tpm2-tss-defaults" ], srcs: [ "src/tss2-tcti/tcti-common.c", - "src/tss2-tcti/tcti-device.c", "src/tss2-tcti/tctildr.c", "src/tss2-tcti/tctildr-nodl.c", ], @@ -140,6 +154,13 @@ cc_library { "tpm2-tss2-mu", "tpm2-tss2-util", ], + target: { + not_windows: { + srcs: [ + "src/tss2-tcti/tcti-device.c", + ], + }, + }, } cc_library { diff --git a/src/tss2-tcti/tctildr-nodl.c b/src/tss2-tcti/tctildr-nodl.c index ca18e585..772178c5 100644 --- a/src/tss2-tcti/tctildr-nodl.c +++ b/src/tss2-tcti/tctildr-nodl.c @@ -57,7 +57,7 @@ struct { char *conf; char *description; } tctis [] = { -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__MINGW32__) { .names = { "libtss2-tcti-tbs.so.0", diff --git a/src/tss2-tcti/tctildr.c b/src/tss2-tcti/tctildr.c index a0567aec..614b4d74 100644 --- a/src/tss2-tcti/tctildr.c +++ b/src/tss2-tcti/tctildr.c @@ -13,11 +13,13 @@ #include <inttypes.h> #if defined(__linux__) #include <linux/limits.h> -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) || defined(__MINGW32__) #include <windows.h> #include <limits.h> + #ifndef PATH_MAX #define PATH_MAX MAX_PATH +#endif static char *strndup(const char* s, size_t n) { @@ -34,7 +36,7 @@ static char *strndup(const char* s, size_t n) memcpy(dst, s, n); return dst; } -#endif + #else #include <limits.h> #endif diff --git a/src/util/io.h b/src/util/io.h index f20ff3e8..7586e07a 100644 --- a/src/util/io.h +++ b/src/util/io.h @@ -7,10 +7,12 @@ #define UTIL_IO_H #ifdef _WIN32 -#include <BaseTsd.h> +#include <basetsd.h> #include <winsock2.h> #include <ws2tcpip.h> +#ifdef _MSC_VER typedef SSIZE_T ssize_t; +#endif #define _HOST_NAME_MAX MAX_COMPUTERNAME_LENGTH #else |