summaryrefslogtreecommitdiff
path: root/.github/workflows/build-windows.yml
blob: 8be2d3380276defa82067fea54bf4309a26ec2a0 (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
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
name: Windows Build

on:
  pull_request:
    branches: [ main ]
  push:
    tags:
      - 'test/*'
      - 'build/*'
      - 'v*'
  workflow_dispatch:

permissions:
  contents: write

jobs:
  build-windows-x64:
    name: Windows x64
    runs-on: windows-2025-vs2026

    steps:
      - name: Set VCPKG_ROOT
        shell: bash
        run: echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> "$GITHUB_ENV"

      - name: Add MSBuild to PATH
        uses: microsoft/setup-msbuild@v3

      - name: Checkout source
        uses: actions/checkout@v5

      - name: Install vcpkg dependencies (x64)
        shell: bash
        run: |
          vcpkg install \
            python3:x64-windows \
            freealut:x64-windows \
            apr-util:x64-windows \
            boost:x64-windows \
            freetype:x64-windows \
            glm:x64-windows \
            hunspell:x64-windows \
            libjpeg-turbo:x64-windows \
            meshoptimizer:x64-windows \
            minizip:x64-windows \
            nanosvg:x64-windows \
            nghttp2:x64-windows \
            openjpeg:x64-windows \
            libvorbis:x64-windows \
            "libxml2[tools]:x64-windows" \
            xxhash:x64-windows

      - name: Configure (x64)
        shell: bash
        env:
          LL_BUILD: "/MD /O2 /Ob2 /std:c++20 /Zc:wchar_t- /Zi /GR /DLL_RELEASE=1 /DLL_RELEASE_FOR_DOWNLOAD=1 /DNDEBUG /D_SECURE_STL=0 /D_HAS_ITERATOR_DEBUGGING=0 /DWIN32 /D_WINDOWS /DLL_WINDOWS=1 /DUNICODE /D_UNICODE /DWINVER=0x0602 /D_WIN32_WINNT=0x0602"
        run: |
          export PYTHON="$VCPKG_ROOT/installed/x64-windows/tools/python3/python.exe"
          CMAKE_BIN=$(find "$VCPKG_ROOT/downloads/tools" -name "cmake.exe" -path "*/x86_64/*" | head -1)
          if [ -z "$CMAKE_BIN" ]; then
            CMAKE_BIN=cmake
          fi
          mkdir build-windows-x86_64
          cd build-windows-x86_64
          "$CMAKE_BIN" \
            -DCMAKE_BUILD_TYPE:STRING=Release \
            -DADDRESS_SIZE:STRING=64 \
            -DUSE_OPENAL:BOOL=ON \
            -DUSE_FMODSTUDIO:BOOL=OFF \
            -DENABLE_MEDIA_PLUGINS:BOOL=ON \
            -DLL_TESTS:BOOL=OFF \
            -DNDOF:BOOL=OFF \
            -DROOT_PROJECT_NAME:STRING=Megapahit \
            -DVIEWER_CHANNEL:STRING=Megapahit \
            -DVIEWER_BINARY_NAME:STRING=Megapahit \
            -DBUILD_SHARED_LIBS:BOOL=OFF \
            -DINSTALL:BOOL=ON \
            -DPACKAGE:BOOL=ON \
            "-DCMAKE_TOOLCHAIN_FILE:FILEPATH=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" \
            -DVS_DISABLE_FATAL_WARNINGS:BOOL=ON \
            ../indra

      - name: Build (x64)
        shell: bash
        run: |
          cd build-windows-x86_64
          MSBuild.exe Megapahit.slnx -p:Configuration=Release -m

      - name: Install NSIS (x64)
        shell: pwsh
        run: |
          choco install nsis --no-progress -y
          "C:\Program Files (x86)\NSIS" | Out-File -FilePath $env:GITHUB_PATH -Append

      - name: Package (x64)
        shell: bash
        run: |
          cd build-windows-x86_64
          cpack -G NSIS

      - name: Read version
        id: version
        shell: bash
        run: echo "version=$(cat indra/newview/viewer_version.txt)" >> "$GITHUB_OUTPUT"

      - name: Upload installer artifact (x64)
        uses: actions/upload-artifact@v6
        with:
          name: megapahit-windows-x64-${{ steps.version.outputs.version }}
          path: build-windows-x86_64/Megapahit-*-win64.exe
          if-no-files-found: error

      - name: Upload to release (x64)
        if: startsWith(github.ref, 'refs/tags/')
        uses: softprops/action-gh-release@v3
        with:
          name: ${{ github.ref_name }}
          files: build-windows-x86_64/Megapahit-*-win64.exe
          prerelease: ${{ startsWith(github.ref_name, 'test/') || startsWith(github.ref_name, 'build/') }}

  build-windows-arm64:
    name: Windows arm64
    if: false
    runs-on: windows-2022

    steps:
      - name: Set VCPKG_ROOT
        shell: bash
        run: echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> "$GITHUB_ENV"

      - name: Add MSBuild to PATH
        uses: microsoft/setup-msbuild@v3

      - name: Checkout source
        uses: actions/checkout@v5

      - name: Install vcpkg dependencies (arm64)
        shell: bash
        run: |
          vcpkg install \
            python3:arm64-windows \
            freealut:arm64-windows \
            apr-util:arm64-windows \
            boost:arm64-windows \
            curl:arm64-windows \
            freetype:arm64-windows \
            glm:arm64-windows \
            hunspell:arm64-windows \
            libjpeg-turbo:arm64-windows \
            meshoptimizer:arm64-windows \
            minizip:arm64-windows \
            nanosvg:arm64-windows \
            nghttp2:arm64-windows \
            openjpeg:arm64-windows \
            sse2neon:arm64-windows \
            libvorbis:arm64-windows \
            "libxml2[tools]:arm64-windows" \
            xxhash:arm64-windows
          vcpkg install boost-fiber:arm64-windows --allow-unsupported || true

      - name: Configure (arm64)
        shell: bash
        env:
          LL_BUILD: "/MD /O2 /Ob2 /std:c++20 /Zc:wchar_t- /Zi /GR /DLL_RELEASE=1 /DLL_RELEASE_FOR_DOWNLOAD=1 /DNDEBUG /D_SECURE_STL=0 /D_HAS_ITERATOR_DEBUGGING=0 /DWIN32 /D_WINDOWS /DLL_WINDOWS=1 /DUNICODE /D_UNICODE /DWINVER=0x0602 /D_WIN32_WINNT=0x0602 /Zc:preprocessor"
        run: |
          export PYTHON="$VCPKG_ROOT/installed/arm64-windows/tools/python3/python.exe"
          CMAKE_BIN=$(find "$VCPKG_ROOT/downloads/tools" -name "cmake.exe" -path "*/arm64/*" | head -1)
          if [ -z "$CMAKE_BIN" ]; then
            CMAKE_BIN=$(find "$VCPKG_ROOT/downloads/tools" -name "cmake.exe" | head -1)
          fi
          if [ -z "$CMAKE_BIN" ]; then
            CMAKE_BIN=cmake
          fi
          mkdir build-windows-aarch64
          cd build-windows-aarch64
          "$CMAKE_BIN" \
            -DCMAKE_BUILD_TYPE:STRING=Release \
            -DADDRESS_SIZE:STRING=64 \
            -DUSE_OPENAL:BOOL=ON \
            -DUSE_FMODSTUDIO:BOOL=OFF \
            -DENABLE_MEDIA_PLUGINS:BOOL=OFF \
            -DLL_TESTS:BOOL=OFF \
            -DNDOF:BOOL=OFF \
            -DROOT_PROJECT_NAME:STRING=Megapahit \
            -DVIEWER_CHANNEL:STRING=Megapahit \
            -DVIEWER_BINARY_NAME:STRING=Megapahit \
            -DBUILD_SHARED_LIBS:BOOL=OFF \
            -DINSTALL:BOOL=ON \
            -DPACKAGE:BOOL=ON \
            "-DCMAKE_TOOLCHAIN_FILE:FILEPATH=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" \
            -DVCPKG_TARGET_TRIPLET:STRING=arm64-windows \
            -DVS_DISABLE_FATAL_WARNINGS:BOOL=ON \
            ../indra

      - name: Build (arm64)
        shell: bash
        run: |
          cd build-windows-aarch64
          MSBuild.exe Megapahit.slnx -p:Configuration=Release -m

      - name: Package (arm64)
        shell: bash
        run: |
          cd build-windows-aarch64
          cpack -G NSIS

      - name: Read version
        id: version
        shell: bash
        run: echo "version=$(cat indra/newview/viewer_version.txt)" >> "$GITHUB_OUTPUT"

      - name: Upload installer artifact (arm64)
        uses: actions/upload-artifact@v6
        with:
          name: megapahit-windows-arm64-${{ steps.version.outputs.version }}
          path: build-windows-aarch64/Megapahit-*-win64.exe
          if-no-files-found: error

      - name: Upload to release (arm64)
        if: startsWith(github.ref, 'refs/tags/')
        uses: softprops/action-gh-release@v3
        with:
          name: ${{ github.ref_name }}
          files: build-windows-aarch64/Megapahit-*-win64.exe
          prerelease: ${{ startsWith(github.ref_name, 'test/') || startsWith(github.ref_name, 'build/') }}