forked from cisco/libest
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
147 lines (131 loc) · 5.32 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
apply plugin: 'c'
apply plugin: 'visual-studio'
model {
repositories {
libs(PrebuiltLibraries) {
libcrypto {
headers.srcDir System.getenv().SSL_DIR + "\\include"
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile =
file(System.getenv().SSL_DIR + "\\bin\\libcrypto-1_1.dll")
sharedLibraryLinkFile = file(System.getenv().SSL_DIR + "\\lib\\libcrypto.lib")
}
}
libssl {
headers.srcDir System.getenv().SSL_DIR + "\\include"
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile =
file(System.getenv().SSL_DIR + "\\bin\\libssl-1_1.dll")
sharedLibraryLinkFile = file(System.getenv().SSL_DIR + "\\lib\\libssl.lib")
}
}
if(file(System.getenv().URIPARSER_DIR +"\\lib\\uriparser.lib").exists()) {
uriparser {
headers.srcDir System.getenv().URIPARSER_DIR + "\\include"
binaries.withType(StaticLibraryBinary) {
staticLibraryFile =
file(System.getenv().URIPARSER_DIR + "\\lib\\uriparser.lib")
}
}
}
if(file(System.getenv().CURL_DIR +"\\bin\\libcurl.dll").exists()) {
libcurl {
headers.srcDir System.getenv().CURL_DIR + "\\include"
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile =
file(System.getenv().CURL_DIR + "\\bin\\libcurl.dll")
sharedLibraryLinkFile =
file(System.getenv().CURL_DIR + "\\lib\\libcurl.lib")
}
}
}
}
}
}
model {
visualStudio {
projects.all {
projectFile.location = "${name}.vcxproj"
filtersFile.location = "${name}.vcxproj.filters"
}
}
}
model {
components {
est(NativeLibrarySpec) {
flavors {
release
debug
}
sources {
c {
source {
srcDir "safe_c_stub/src"
srcDir "src/est"
include "*.c"
}
exportedHeaders {
srcDir "src/est"
srcDir "safe_c_stub/include"
include "*.h"
}
}
}
binaries.all {
if (flavor == flavors.debug){
cCompiler.define "DT_EXPORTS" , "1"
cCompiler.define "DEVTEST", "1"
linker.args "/DEBUG"
}
if(file(System.getenv().URIPARSER_DIR +"\\lib\\uriparser.lib").exists())
{
lib library: "uriparser", linkage: "static"
}
if(file(System.getenv().CURL_DIR +"\\bin\\libcurl.dll").exists())
{
lib library: "libcurl", linkage: "shared"
}
lib library: "libcrypto", linkage: "shared"
lib library: "libssl", linkage: "shared"
}
}
}
}
model {
binaries {
all {
// Define toolchain-specific compiler and linker options
if (toolChain in Gcc) {
// Example GCC args
cCompiler.args "-g", "-O0", "-Wall"
}
else if(toolChain in VisualCpp) {
if(file(System.getenv().URIPARSER_DIR +"\\lib\\uriparser.lib").exists())
{
cCompiler.define "HAVE_URIPARSER", "1"
}
if(file(System.getenv().CURL_DIR +"\\bin\\libcurl.dll").exists())
{
cCompiler.define "HAVE_LIBCURL", "1"
}
cCompiler.define "WIN32"
cCompiler.define "HAVE_STDINT"
cCompiler.define "LIBEST_EXPORTS", "1"
cCompiler.define "DISABLE_BACKTRACE"
cCompiler.define "__STDC_WANT_SECURE_LIB__" , "0"
cCompiler.define "PACKAGE_STRING", "\"libest 2.0.0\""
cCompiler.define "DISABLE_PTHREADS", "1"
cCompiler.args "/GS", "/GL", "/analyze-", "/W3", "/Gy", "/Zc:wchar_t", "/Zi", "/Gm-", "/fp:precise", "/errorReport:prompt", "/WX-", "/Zc:forScope", "/Gd", "/Oy-","/Oi","/MD", "/EHsc", "/nologo", "/FS"
linker.args "/DYNAMICBASE","/SAFESEH", "/LTCG", "/NXCOMPAT"
}
}
}
}
task gatherInstall (type: Copy) {
from "$buildDir\\libs\\est\\shared\\release\\est.dll", "$buildDir\\libs\\est\\shared\\release\\est.lib"
into "$buildDir\\install"
from ("$buildDir\\libs\\est\\shared\\release\\") {
include "include\\**"
}
into "$buildDir\\install"
}