summaryrefslogtreecommitdiffstats
path: root/GUI/Libraries/fetch.ps1
blob: 1495cc919b01b1672a18224b024f28b463f2132f (plain)
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
param(
  [switch]$overwrite = $False,
  [string]$release = "Release"
)

echo "Overwrite: $overwrite"
echo "Release: $release"

Set-PSDebug -trace 0

$WX_3_2_1_URL = "https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.1/wxWidgets-3.2.1.zip"
$WX_URL = $WX_3_2_1_URL
$WX_FILE = $(Split-Path -Path $WX_URL -Leaf)

$WHISPER_1_7_0_URL = "https://github.com/Const-me/Whisper/releases/download/1.7.0/Library.zip"
$WHISPER_URL = $WHISPER_1_7_0_URL
$WHISPER_FILE = $(Split-Path -Path $WHISPER_URL -Leaf)

$OATPP_1_3_0_URL = "https://github.com/oatpp/oatpp/archive/refs/tags/1.3.0.zip"
$OATPP_URL = $OATPP_1_3_0_URL
$OATPP_FILE = $(Split-Path -Path $OATPP_URL -Leaf)
$OATPP_VER = $OATPP_FILE -replace '\.[a-z\.]*$'
$OATPP_DIR = "oatpp-$OATPP_VER"

$NPROC = $(Get-CimInstance Win32_Processor).NumberOfCores
echo "nproc: $NPROC"

pushd $PSScriptRoot

# WX
if ((Test-Path wx) -And ($overwrite)) {
  rm -Recurse wx
}

if (-Not (Test-Path wx)) {
  mkdir wx
  pushd wx > $null
  Invoke-WebRequest $WX_URL -OutFile $WX_FILE
  Expand-Archive $WX_FILE -DestinationPath .
  popd > $null
}

# RAPIDYAML
if ((Test-Path rapidyaml) -And ($overwrite)) {
  rm -Recurse rapidyaml
}

if (-Not (Test-Path rapidyaml)) {
  git clone https://github.com/biojppm/rapidyaml
  pushd rapidyaml > $null
  git checkout v0.5.0
  git submodule update --init --recursive

  python3 tools/amalgamate.py ryml.h
  cp ryml.h ../../GUI/GUI/ryml.h
}

if ((Test-Path whisper) -And ($overwrite)) {
  rm -Recurse whisper
}

if (-Not (Test-Path whisper)) {
  mkdir whisper
  pushd whisper > $null
  Invoke-WebRequest $WHISPER_URL -OutFile $WHISPER_FILE
  Expand-Archive $WHISPER_FILE -DestinationPath .
  if (Test-Path ../../GUI/GUI/whisper/) {
    rm -Recurse ../../GUI/GUI/whisper/
  }
  mkdir ../../GUI/GUI/whisper/
  cp Include/*.h ../../GUI/GUI/whisper/
  cp Linker/*.lib ../../GUI/GUI/whisper/Whisper.lib
  cp Binary/*.dll ../../GUI/GUI/whisper/Whisper.dll
  popd > $null
}

if ((Test-Path oatpp) -And ($overwrite)) {
  rm -Recurse oatpp
}

if (-Not (Test-Path oatpp)) {
  mkdir oatpp
  pushd oatpp > $null
  Invoke-WebRequest $OATPP_URL -OutFile $OATPP_FILE
  Expand-Archive $OATPP_FILE -DestinationPath .
  if (Test-Path ../../GUI/GUI/oatpp/) {
    rm -Recurse ../../GUI/GUI/oatpp/
  }
  mkdir ../../GUI/GUI/oatpp/
  pushd $OATPP_DIR > $null
  mkdir build
  pushd build > $null
  cmake.exe .. `
      -DCMAKE_BUILD_TYPE=$release `
      -DBUILD_SHARED_LIBS=OFF `
      -DOATPP_MSVC_LINK_STATIC_RUNTIME=ON `
      -DOATPP_BUILD_TESTS=OFF
  cmake.exe --build . -j $NPROC --config $release
  cp src/$release/oatpp.lib ../../../../GUI/GUI/oatpp/
  cp -Recurse ../src/oatpp/* ../../../../GUI/GUI/oatpp/
  popd > $null
  popd > $null
}

popd > $null  # rapidyaml

popd > $null  # $PSScriptRoot