-
Notifications
You must be signed in to change notification settings - Fork 4
/
build_installer.ps1
98 lines (84 loc) · 3.91 KB
/
build_installer.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
<#
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0
(GPLv2), as published by the Free Software Foundation, with the
following additional permissions:
This program is distributed with certain software that is licensed
under separate terms, as designated in a particular file or component
or in the license documentation. Without limiting your rights under
the GPLv2, the authors of this program hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have included with the program.
Without limiting the foregoing grant of rights under the GPLv2 and
additional permission as to separately licensed software, this
program is also subject to the Universal FOSS Exception, version 1.0,
a copy of which can be found along with its FAQ at
http://oss.oracle.com/licenses/universal-foss-exception.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see
http://www.gnu.org/licenses/gpl-2.0.html.
/#>
<#
This script is to assist with building the driver and creating the installer. There are two optional arguments:
- $CONFIGURATION: determines what configuration you would like to build the driver in (Debug, Release, RelWithDebInfo)
- $MYSQL_DIR: determines where your MySQL installation is located
The current default behaviour is to build the driver and installer without unit or integration tests on the Release configuration,
with "C:\Program Files\MySQL\MySQL Server 8.0" set as the location of the MySQL directory
Note that building the installer requires the following:
- Wix 3.0 or above (https://wixtoolset.org/)
- Microsoft Visual Studio environment
- CMake 2.4.6 (http://www.cmake.org)
#>
$ARCHITECTURE = $args[0]
$CONFIGURATION = $args[1]
$GENERATOR = $args[2]
$MYSQL_DIR = $args[3]
$WIX_DIR = $args[4]
$OPENSSL_INCLUDE_DIR = $args[5]
# Set default values
if ($null -eq $CONFIGURATION) {
$CONFIGURATION = "Release"
}
if ($null -eq $MYSQL_DIR) {
$MYSQL_DIR = "C:\Program Files\MySQL\MySQL Server 8.3"
}
# BUILD DRIVER
cmake -S . -B ./build -G $GENERATOR -DMYSQL_DIR="$MYSQL_DIR" -DMYSQLCLIENT_STATIC_LINKING=TRUE -DCMAKE_BUILD_TYPE="$CONFIGURATION" -DBUNDLE_DEPENDENCIES=TRUE -DOPENSSL_INCLUDE_DIR="$OPENSSL_INCLUDE_DIR"
cmake --build ./build --config "$CONFIGURATION"
# CREATE INSTALLER
# Copy dll, installer, and info files to wix folder
New-Item -Path .\Wix\x64 -ItemType Directory -Force
New-Item -Path .\Wix\x86 -ItemType Directory -Force
New-Item -Path .\Wix\doc -ItemType Directory -Force
Copy-Item .\build\lib\$CONFIGURATION\awsmysqlodbc*.dll .\Wix\x64
Copy-Item .\build\lib\$CONFIGURATION\awsmysqlodbc*.lib .\Wix\x64
Copy-Item .\build\lib\$CONFIGURATION\aws-*.dll .\Wix\x64
Copy-Item .\build\lib\$CONFIGURATION\awsmysqlodbc*.dll .\Wix\x86
Copy-Item .\build\lib\$CONFIGURATION\awsmysqlodbc*.lib .\Wix\x86
Copy-Item .\build\lib\$CONFIGURATION\aws-*.dll .\Wix\x86
Copy-Item .\build\bin\$CONFIGURATION\myodbc-installer.exe .\Wix\x64
Copy-Item .\build\bin\$CONFIGURATION\myodbc-installer.exe .\Wix\x86
Copy-Item .\INFO_BIN .\Wix\doc
Copy-Item .\INFO_SRC .\Wix\doc
Copy-Item .\CHANGELOG.md .\Wix\doc
Copy-Item .\README.md .\Wix\doc
Copy-Item .\LICENSE.txt .\Wix\doc
Set-Location .\Wix
if ($ARCHITECTURE -eq "x64") {
if ($null -eq $WIX_DIR) {
cmake -DMSI_64=1 -G "NMake Makefiles"
} else {
cmake -DMSI_64=1 -G "NMake Makefiles" -DWIX_DIR="$WIX_DIR"
}
} elseif ($null -eq $WIX_DIR) {
cmake -DMSI_64=0 -G "NMake Makefiles"
} else {
cmake -DMSI_64=0 -G "NMake Makefiles" -DWIX_DIR="$WIX_DIR"
}
nmake
Set-Location ..\