forked from TileDB-Inc/TileDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.ps1
242 lines (192 loc) · 6.21 KB
/
bootstrap.ps1
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# PowerShell script for performing TileDB bootstrapping process on
# Windows.
<#
.SYNOPSIS
This is a Powershell script to bootstrap a TileDB build on Windows.
.DESCRIPTION
This script will check dependencies, and run the CMake build generator
to generate a Visual Studio solution file that can be used to build or
develop TileDB.
.PARAMETER Prefix
Installs files in tree rooted at PREFIX (defaults to TileDB\dist).
.PARAMETER Dependency
Semicolon separated list to binary dependencies.
.PARAMETER CMakeGenerator
Optionally specify the CMake generator string, e.g. "Visual Studio 15
2017". Check 'cmake --help' for a list of supported generators.
.PARAMETER EnableDebug
Enable Debug build.
.PARAMETER EnableAssert
Enable Assertions in compiled code (always on for debug build;
default off in release).
.PARAMETER EnableReleaseSymbols
Enable symbols with Release build.
.PARAMETER EnableCoverage
Enable build with code coverage support.
.PARAMETER EnableVerbose
Enable verbose status messages.
.PARAMETER EnableAzure
Enables building with the Azure storage backend.
.PARAMETER EnableS3
Enables building with the S3 storage backend.
.PARAMETER EnableSerialization
Enables building with serialization support.
.PARAMETER EnableStaticTileDB
Enables building TileDB as a static library.
.PARAMETER EnableBuildDeps
Enables building TileDB dependencies from source (superbuild)
.PARAMETER EnableTools
Enables building TileDB CLI tools (experimental)
.PARAMETER EnableExperimentalFeatures
Enables building TileDB Experimental features
.Parameter DisableWerror
Disable use of warnings-as-errors (/WX) during build.
.Parameter DisableCppApi
Disable building the TileDB C++ API.
.PARAMETER BuildProcesses
Number of parallel compile jobs.
.LINK
https://github.com/TileDB-Inc/TileDB
.EXAMPLE
..\bootstrap.ps1 -Prefix "\path\to\install" -Dependency "\path\to\dep1;\path\to\dep2"
#>
# Note -Debug and -Verbose are included in the PowerShell
# CommonParameters list, so we don't duplicate them here.
# TODO: that means they don't appear in the -? usage message.
[CmdletBinding()]
Param(
[string]$Prefix,
[string]$Dependency,
[string]$CMakeGenerator,
[switch]$EnableAssert,
[switch]$EnableDebug,
[switch]$EnableReleaseSymbols,
[switch]$EnableCoverage,
[switch]$EnableVerbose,
[switch]$EnableAzure,
[switch]$EnableS3,
[switch]$EnableSerialization,
[switch]$EnableStaticTileDB,
[switch]$EnableTools,
[switch]$EnableExperimentalFeatures,
[switch]$EnableBuildDeps,
[switch]$DisableWerror,
[switch]$DisableCppApi,
[switch]$DisableTests,
[switch]$DisableStats,
[Alias('J')]
[int]
$BuildProcesses = $env:NUMBER_OF_PROCESSORS
)
# Return the directory containing this script file.
function Get-ScriptDirectory {
Split-Path -Parent $PSCommandPath
}
# Absolute path of TileDB directories.
$SourceDirectory = Get-ScriptDirectory
$BinaryDirectory = (Get-Item -Path ".\" -Verbose).FullName
# Choose the default install prefix.
$DefaultPrefix = Join-Path $SourceDirectory "dist"
# Choose the default dependency install prefix.
$DefaultDependency = $DefaultPrefix
# Set assertion mode
# No-op for a debug build.
$AssertionMode = "OFF"
if ($EnableAssert.IsPresent) {
$AssertionMode = "ON"
}
# Set TileDB build type
$BuildType = "Release"
if ($EnableDebug.IsPresent) {
$BuildType = "Debug"
}
if ($EnableReleaseSymbols.IsPresent) {
$BuildType = "RelWithDebInfo"
}
if ($EnableCoverage.IsPresent) {
$BuildType = "Coverage"
}
# Set TileDB verbosity
$Verbosity = "OFF"
if ($EnableVerbose.IsPresent) {
$Verbosity = "ON"
}
# Set TileDB Azure flag
$UseAzure = "OFF"
if ($EnableAzure.IsPresent) {
$UseAzure = "ON"
}
# Set TileDB S3 flag
$UseS3 = "OFF"
if ($EnableS3.IsPresent) {
$UseS3 = "ON"
}
$UseSerialization = "OFF"
if ($EnableSerialization.IsPresent) {
$UseSerialization = "ON"
}
$Werror = "ON"
if ($DisableWerror.IsPresent) {
$Werror = "OFF"
}
$CppApi = "ON"
if ($DisableCppApi.IsPresent) {
$CppApi = "OFF"
}
$Tests = "ON"
if ($DisableTests.IsPresent) {
$Tests = "OFF"
}
$Stats = "ON"
if ($DisableStats.IsPresent) {
$Stats = "OFF"
}
$TileDBStatic = "OFF";
if ($EnableStaticTileDB.IsPresent) {
$TileDBStatic = "ON"
}
$TileDBTools = "OFF";
if ($EnableTools.IsPresent) {
$TileDBTools = "ON"
}
$TileDBExperimentalFeatures = "OFF"
if ($EnableExperimentalFeatures.IsPresent) {
$TileDBExperimentalFeatures = "ON"
}
$TileDBBuildDeps = "OFF";
if ($EnableBuildDeps.IsPresent) {
$TileDBBuildDeps = "ON"
}
# Set TileDB prefix
$InstallPrefix = $DefaultPrefix
if (![string]::IsNullOrEmpty($Prefix)) {
$InstallPrefix = $Prefix
}
# Set TileDB dependency directory string
$DependencyDir = $DefaultDependency
if (![string]::IsNullOrEmpty($Dependency)) {
$DependencyDir = $Dependency
}
# Set CMake generator type.
$GeneratorFlag = ""
if ($PSBoundParameters.ContainsKey("CMakeGenerator")) {
$GeneratorFlag = "-G""$CMakeGenerator"""
}
# Enforce out-of-source build
if ($SourceDirectory -eq $BinaryDirectory) {
Throw "Cannot build the project in the source directory! Out-of-source build is enforced!"
}
# Check cmake binary
if ((Get-Command "cmake.exe" -ErrorAction SilentlyContinue) -eq $null) {
Throw "Unable to find cmake.exe in your PATH."
}
if ($CMakeGenerator -eq $null) {
Throw "Could not identify a generator for CMake. Do you have Visual Studio installed?"
}
# Run CMake.
# We use Invoke-Expression so we can echo the command to the user.
$CommandString = "cmake -A X64 -DCMAKE_BUILD_TYPE=$BuildType -DCMAKE_INSTALL_PREFIX=""$InstallPrefix"" -DCMAKE_PREFIX_PATH=""$DependencyDir"" -DMSVC_MP_FLAG=""/MP$BuildProcesses"" -DTILEDB_ASSERTIONS=$AssertionMode -DTILEDB_VERBOSE=$Verbosity -DTILEDB_AZURE=$UseAzure -DTILEDB_S3=$UseS3 -DTILEDB_SERIALIZATION=$UseSerialization -DTILEDB_WERROR=$Werror -DTILEDB_CPP_API=$CppApi -DTILEDB_TESTS=$Tests -DTILEDB_STATS=$Stats -DTILEDB_STATIC=$TileDBStatic -DTILEDB_FORCE_ALL_DEPS=$TileDBBuildDeps -DTILEDB_TOOLS=$TileDBTools -DTILEDB_EXPERIMENTAL_FEATURES=$TileDBExperimentalFeatures $GeneratorFlag ""$SourceDirectory"""
Write-Host $CommandString
Write-Host
Invoke-Expression "$CommandString"
Write-Host "Bootstrap success. Run 'cmake --build . --config $BuildType' to build and 'cmake --build . --target check --config $BuildType' to test."