forked from petrgeorgievsky/gtaRenderHook
-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (136 loc) · 6.18 KB
/
cmake.yml
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
name: CMake
on: [push, workflow_dispatch]
env:
BUILD_TYPE: Release
VULKAN_SDK: C:\\VulkanSDK\\1.2.189.0
permissions:
id-token: "write"
contents: "write"
packages: "write"
pull-requests: "read"
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Get commit hash
run: echo "CommitHash=$(git rev-parse --short=7 HEAD)" >> $env:GITHUB_ENV
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/build_x64
${{runner.workspace}}/build_x86
${{runner.workspace}}/artifacts/gta3
${{runner.workspace}}/artifacts/gtavc
${{runner.workspace}}/artifacts/gtasa
- name: Cache Vulkan SDK
id: cache-vulkan-sdk
uses: actions/cache@v1
with:
path: "C:\\VulkanSDK\\1.2.189.0"
key: vulkan-sdk-1.2.189.0
- name: Setup Vulkan
if: steps.cache-vulkan-sdk.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/1.2.189.0/windows/VulkanSDK-1.2.189.0-Installer.exe" -OutFile VulkanSDK.exe
$installer = Start-Process -FilePath VulkanSDK.exe -Wait -PassThru -ArgumentList @("/S");
$installer.WaitForExit();
- name: Add msbuild to PATH
uses: microsoft/[email protected]
# Restore from cache the previously built ports. If cache-miss, download, build vcpkg.
- name: Restore from cache and install vcpkg
# Download and build vcpkg, without installing any port. If content is cached already, it is a no-op.
uses: lukka/[email protected]
with:
setupOnly: true
vcpkgGitCommitId: 1e9facc7992107ad639b4dcc87bd9a7ade1594e8
# Now that vcpkg is installed, it is being used to run desired arguments.
- run: |
$VCPKG_ROOT/vcpkg install @response_file.txt
shell: bash
- name: Configure CMake x64
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{runner.workspace}}/build_x64
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake
-DCMAKE_CXX_FLAGS="/DWIN32 /D_WINDOWS /std:c++latest /W4 /GR /EHsc /MT"
-DARCH_64BIT=ON
-DBUILD_32BIT_LIBS=ON
-DGTA_3_FOLDER="${{runner.workspace}}\\artifacts\\gta3\\"
-DGTA_VC_FOLDER="${{runner.workspace}}\\artifacts\\gtavc\\"
-DGTA_SA_FOLDER="${{runner.workspace}}\\artifacts\\gtasa\\"
-DVCPKG_TARGET_TRIPLET=x64-windows-static -A x64
- name: Build x64
working-directory: ${{runner.workspace}}/build_x64
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE --target gta_3_render_driver gta_vc_render_driver gta_sa_render_driver
- name: Configure CMake x86
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{runner.workspace}}/build_x86
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake
-DCMAKE_C_FLAGS="-m32"
-DCMAKE_CXX_FLAGS="-m32 /DWIN32 /D_WINDOWS /std:c++latest /W4 /GR /EHsc /MT"
-DBUILD_32BIT_LIBS=ON
-DGTA_3_FOLDER="${{runner.workspace}}\\artifacts\\gta3\\"
-DGTA_VC_FOLDER="${{runner.workspace}}\\artifacts\\gtavc\\"
-DGTA_SA_FOLDER="${{runner.workspace}}\\artifacts\\gtasa\\"
-DVCPKG_TARGET_TRIPLET=x86-windows-static -A Win32
- name: Build x86
working-directory: ${{runner.workspace}}/build_x86
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE --target gta_3_render_hook gta_vc_render_hook gta_sa_render_hook
- name: Upload artifacts - GTA 3
uses: actions/upload-artifact@v2
with:
name: gta3_rh
path: ${{runner.workspace}}/artifacts/gta3
- name: Upload artifacts - GTA VC
uses: actions/upload-artifact@v2
with:
name: gtavc_rh
path: ${{runner.workspace}}/artifacts/gtavc
- name: Upload artifacts - GTA SA
uses: actions/upload-artifact@v2
with:
name: gtasa_rh
path: ${{runner.workspace}}/artifacts/gtasa
- name: Create Artifacts folder
run: mkdir "Release"
- name: Compress GTA3 artifacts
uses: vimtor/[email protected]
with:
files: 'artifacts/gta3/'
dest: 'Release/gta3_rh.zip'
- name: Compress GTAVC artifacts
uses: vimtor/[email protected]
with:
files: 'artifacts/gtavc/'
dest: 'Release/gtavc_rh.zip'
- name: Compress GTASA artifacts
uses: vimtor/[email protected]
with:
files: 'artifacts/gtasa/'
dest: 'Release/gtasa_rh.zip'
- name: GitHub release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{secrets.GITHUB_TOKEN}}"
automatic_release_tag: "latest"
prerelease: false
title: "RenderHook-${{env.CommitHash}}"
files: "Release/*"