Skip to content

Commit f344c9d

Browse files
author
ozamir_nuvoton
committed
fixed windows build to support both win32 and x64 platforms
Signed-off-by: ozamir_nuvoton <[email protected]>
1 parent 39046f3 commit f344c9d

File tree

3 files changed

+34
-9
lines changed

3 files changed

+34
-9
lines changed

release/BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ release(
106106
":proxybuffer_containers_tar": "ProxyBuffer container",
107107
":release_bundle": "Deployment scripts",
108108
":softhsm_dev": "SoftHSM2 development binaries",
109-
"//src/ate:windows": "ATE Win32 binaries",
109+
"//src/ate:windows_win32": "ATE Win32 binaries",
110+
"//src/ate:windows_x64": "ATE x64 binaries",
110111
},
111112
)

src/ate/BUILD.bazel

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ cc_binary(
115115
)
116116

117117
pkg_win(
118-
name = "windows",
118+
name = "windows_win32",
119119
srcs = [
120120
"ate_api.h",
121121
"ate_perso_blob.h",
@@ -124,6 +124,16 @@ pkg_win(
124124
platform = "@crt//platforms/x86_32:win32",
125125
)
126126

127+
pkg_win(
128+
name = "windows_x64",
129+
srcs = [
130+
"ate_api.h",
131+
"ate_perso_blob.h",
132+
":ate",
133+
],
134+
platform = "@crt//platforms/x86_64:win64",
135+
)
136+
127137
go_library(
128138
name = "ate_go_lib",
129139
srcs = ["perso_blob.go"],

src/ate/ate_api.h

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,28 @@
1313
#define COMPILE_TIME_ASSERT(condition, msg) \
1414
typedef char COMPILE_TIME_ASSERT_##msg[(condition) ? 1 : -1]
1515

16-
// types for TP
17-
typedef unsigned __int8 uint8_t;
18-
typedef unsigned __int16 uint16_t;
19-
typedef unsigned __int32 uint32_t;
20-
typedef unsigned __int64 uint64_t;
21-
typedef unsigned int size_t;
22-
#else // not _WIN32
16+
// Check for standard definition of fixed-width integer types
17+
#ifndef UINT8_MAX
18+
/* Fallback for old compilers which do not provide a standart <stdint.h> header
19+
* (pre-C99) */
20+
typedef unsigned char uint8_t;
21+
typedef unsigned short uint16_t;
22+
typedef unsigned int uint32_t;
23+
typedef unsigned long long uint64_t;
24+
#else
2325
#include <stdint.h>
26+
#endif // UINT8_MAX
27+
28+
// Check for standard definition of 'size_t' type
29+
#ifndef _SIZE_T_DEFINED
30+
/* Fallback for old compilers that do not provide a standard <stddef.h> header
31+
* (pre-C99) */
32+
#if defined(_WIN64)
33+
typedef uint64_t size_t; // 8 bytes size in 64-platform
34+
#else
35+
typedef uint32_t size_t; // 4 bytes size in 32-platform
36+
#endif
37+
#endif // _SIZE_T_DEFINED
2438
#endif // _WIN32
2539

2640
#ifdef __cplusplus

0 commit comments

Comments
 (0)