forked from PokemonAutomation/Arduino-Source
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
71 lines (66 loc) · 1.62 KB
/
build.ps1
File metadata and controls
71 lines (66 loc) · 1.62 KB
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
param
(
[ValidateSet("MSVC", "CLANG")]
[string]$Compiler = "MSVC",
[ValidateSet("NONE", "VCPKG", "CONAN")]
[string]$PackageManager = "NONE"
)
enum Compiler
{
MSVC
CLANG
}
$CompilerAsEnum = [Compiler]::$Compiler
switch ($CompilerAsEnum)
{
MSVC
{
$cmakeCompilerAdditionalParam = ""
}
CLANG
{
$cmakeCompilerAdditionalParam = "-T ClangCL"
}
}
enum PackageManager
{
NONE
VCPKG
CONAN
}
$PackageManagerAsEnum = [PackageManager]::$PackageManager
switch ($PackageManagerAsEnum)
{
NONE
{
$cmakePackageManagerAdditionalParam = ""
}
VCPKG
{
$cmakePackageManagerAdditionalParam = "-DCMAKE_TOOLCHAIN_FILE=$PSScriptRoot\vcpkg\scripts\buildsystems\vcpkg.cmake"
}
CONAN
{
$cmakePackageManagerAdditionalParam = "-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake"
}
}
robocopy ..\Packages Packages /s /Purge
Push-Location $PSScriptRoot
Set-Location SerialPrograms
$binDirectory = "bin\" + [PackageManager]::$PackageManager + "\" + [Compiler]::$Compiler
Write-Output "Building in $binDirectory"
if (-not(Test-Path $binDirectory -PathType Container))
{
New-Item -path $binDirectory -ItemType Directory
}
Set-Location $binDirectory
switch ($PackageManagerAsEnum)
{
CONAN
{
conan install ..\..\.. --output-folder=. --build=missing -s "&:build_type=RelWithDebInfo" -s build_type=Release -s compiler.cppstd=23
}
}
cmake ..\..\.. $cmakeCompilerAdditionalParam $cmakePackageManagerAdditionalParam
cmake --build . --config RelWithDebInfo
Pop-Location