4
4
# License, v. 2.0. If a copy of the MPL was not distributed with this
5
5
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
7
+ $cacheDir = " dependencies\conan"
7
8
$buildDir = " build"
8
9
$installDir = " .\build\bin"
9
10
$buildType = " Debug"
@@ -41,21 +42,39 @@ $profilePath = (& conan profile path default).Trim()
41
42
-replace ' ^(compiler\.cppstd=).*$' , " compiler.cppstd=23" `
42
43
| Set-Content $profilePath - Force
43
44
44
- if (Test-Path Join-Path $buildDir " conan_cache.tzst" ) {
45
- conan cache restore $buildDir \conan_cache.tzst
45
+ # Check if there's a conan cache to load
46
+ if (Test-Path $cacheDir ) {
47
+ conan cache restore " $cacheDir \boost_cache.tzst"
48
+ conan cache restore " $cacheDir \botan_cache.tzst"
49
+ conan cache restore " $cacheDir \flatbuffers_cache.tzst"
50
+ conan cache restore " $cacheDir \pcre_cache.tzst"
51
+ conan cache restore " $cacheDir \zlib_cache.tzst"
46
52
}
53
+ else {
54
+ if (-not (Test-Path $buildDir )) {
55
+ New-Item - ItemType Directory - Path $buildDir | Out-Null
56
+ }
47
57
48
- # Dependencies to install via Conan.
49
- New-Item - ItemType Directory - Path $buildDir | Out-Null
50
- Write-Host " Running Conan install..."
51
- conan install - of $buildDir -- build missing - g CMakeToolchain - g CMakeDeps -- profile default `
52
- -- requires boost/ 1.87 .0 `
53
- -- requires botan/ 3.6 .1 `
54
- -- requires flatbuffers/ 24.12 .23 `
55
- -- requires pcre/ 8.45 `
56
- -- requires zlib/ 1.3 .1 `
58
+ # Dependencies to install via conan
59
+ Write-Host " Running Conan install..."
60
+ conan install - of $buildDir -- build missing - g CMakeToolchain - g CMakeDeps -- profile default `
61
+ -- requires boost/ 1.87 .0 `
62
+ -- requires botan/ 3.6 .1 `
63
+ -- requires flatbuffers/ 24.12 .23 `
64
+ -- requires pcre/ 8.45 `
65
+ -- requires zlib/ 1.3 .1
57
66
58
- conan cache save -f $buildDir \conan_cache.tzst * -- folder= $buildDir
67
+ if (-not (Test-Path $cacheDir )) {
68
+ New-Item - ItemType Directory - Path $cacheDir | Out-Null
69
+ }
70
+
71
+ # Cache the dependencies installed via conan
72
+ conan cache save -- out-file " $cacheDir \boost_cache.tzst" " boost/1.87.0:*"
73
+ conan cache save -- out-file " $cacheDir \botan_cache.tzst" " botan/3.6.1:*"
74
+ conan cache save -- out-file " $cacheDir \flatbuffers_cache.tzst" " flatbuffers/24.12.23:*"
75
+ conan cache save -- out-file " $cacheDir \pcre_cache.tzst" " pcre/8.45:*"
76
+ conan cache save -- out-file " $cacheDir \zlib_cache.tzst" " zlib/1.3.1:*"
77
+ }
59
78
60
79
# ###################################################
61
80
# --- Patch Conan configuration ---
@@ -110,9 +129,9 @@ if (-not (Test-Path "C:\mysql-connector-c++\")) {
110
129
# Determine architecture and set download parameters accordingly
111
130
if ($env: PROCESSOR_ARCHITECTURE -eq " ARM64" ) {
112
131
Write-Host " ARM64 architecture detected. Downloading MySQL Connector/C++ source code."
113
- $url = " https://github.com/mysql/mysql-connector-cpp/archive/refs/tags/9.2 .0.zip"
114
- $connectorSubDir = " mysql-connector-cpp-9.2 .0"
115
- }
132
+ $url = " https://github.com/mysql/mysql-connector-cpp/archive/refs/tags/9.3 .0.zip"
133
+ $connectorSubDir = " mysql-connector-cpp-9.3 .0"
134
+ }
116
135
else {
117
136
Write-Host " x86_64 architecture detected. Using prebuilt MySQL Connector/C++ binaries."
118
137
$url = " https://dev.mysql.com/get/Downloads/Connector-C++/mysql-connector-c++-9.3.0-winx64-debug.zip"
@@ -123,11 +142,11 @@ if (-not (Test-Path "C:\mysql-connector-c++\")) {
123
142
if (Get-Command curl - ErrorAction SilentlyContinue) {
124
143
Write-Host " Downloading using curl..."
125
144
curl - L $url - o $CACHE_ZIP
126
- }
145
+ }
127
146
elseif (Get-Command wget - ErrorAction SilentlyContinue) {
128
147
Write-Host " Downloading using wget..."
129
148
wget $url - O $CACHE_ZIP
130
- }
149
+ }
131
150
else {
132
151
Write-Host " Downloading using Invoke-WebRequest..."
133
152
Invoke-WebRequest - Uri $url - OutFile $CACHE_ZIP
@@ -155,10 +174,11 @@ if (-not (Test-Path "C:\mysql-connector-c++\")) {
155
174
Write-Host " Installing MySQL Connector/C++ (prebuilt x86_64) to $mysqlconcppTargetDir ..."
156
175
157
176
$sourceBase = Join-Path $extractDir " mysql-connector-c++-9.3.0-winx64"
158
- Copy-Item - Path (Join-Path $sourceBase " *" ) - Destination $mysqlconcppTargetDir - Recurse - Force
177
+ Copy-Item - Path (Join-Path $sourceBase " *" ) `
178
+ - Destination $mysqlconcppTargetDir - Recurse - Force
159
179
}
160
180
else {
161
- # For ARM64 (and others): Downloaded Source – Build Required
181
+ # For ARM64 (and others): Downloaded Source - Build Required
162
182
New-Item - ItemType Directory - Path " $sourceBase \build" - Force | Out-Null
163
183
164
184
Push-Location " $sourceBase \build"
@@ -167,6 +187,7 @@ if (-not (Test-Path "C:\mysql-connector-c++\")) {
167
187
cmake .. - G " Visual Studio 17 2022" - A $env: PROCESSOR_ARCHITECTURE `
168
188
- DCMAKE_MSVC_RUNTIME_LIBRARY= " MultiThreaded$<$<CONFIG:Debug>:Debug>" `
169
189
- DBUILD_STATIC= ON `
190
+ - DOPENSSL_USE_STATIC_LIBS= TRUE `
170
191
- DWITH_JDBC= ON `
171
192
- DWITH_MYSQL= " C:\Program Files\MySQL\MySQL Server 8.0" `
172
193
- DWITH_SSL= " C:\Program Files\OpenSSL-Win64" `
@@ -178,6 +199,11 @@ if (-not (Test-Path "C:\mysql-connector-c++\")) {
178
199
Write-Host " Installing MySQL Connector/C++ to $mysqlconcppTargetDir ..."
179
200
cmake -- install . -- config $buildType
180
201
202
+ New-Item - ItemType Directory - Path " $mysqlconcppTargetDir \lib" - Force | Out-Null
203
+
204
+ Copy-Item - Path (Join-Path " $mysqlconcppTargetDir \lib64\debug\vs14" " *" ) `
205
+ - Destination " $mysqlconcppTargetDir \lib" - Recurse - Force
206
+
181
207
Pop-Location
182
208
}
183
209
Write-Host " MySQL Connector/C++ installed at: $mysqlconcppTargetDir "
@@ -194,6 +220,8 @@ Write-Host "CMAKE_PREFIX_PATH set to: $env:CMAKE_PREFIX_PATH"
194
220
# ###################################################
195
221
Write-Host " === Configuring project with CMake ==="
196
222
223
+ cmake -- build $buildDir -- target clean
224
+
197
225
cmake - S . - B $buildDir - G " Visual Studio 17 2022" `
198
226
- DCMAKE_MSVC_RUNTIME_LIBRARY= " MultiThreaded$<$<CONFIG:Debug>:Debug>" `
199
227
- DCMAKE_TOOLCHAIN_FILE= " $buildDir \conan_toolchain.cmake" `
0 commit comments