Skip to content
This repository was archived by the owner on Apr 9, 2024. It is now read-only.

Commit e008657

Browse files
authored
Merge pull request #44 from ModdingPink/dev/unity2021
Dev/unity2021
2 parents 9ea131e + 3719046 commit e008657

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+906
-686
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Setup canary ndk"
2+
description: "Sets up canary ndk"
3+
outputs:
4+
ndk-path:
5+
value: ${{ steps.path.outputs.path }}
6+
description: "Output path of the ndk"
7+
cache-hit:
8+
value: ${{ steps.cache.outputs.cache-hit }}
9+
description: "Whether a cache hit occurred for the ndk"
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: NDK cache
14+
id: cache
15+
uses: actions/cache@v3
16+
with:
17+
path: ${HOME}/android-ndk-r27-canary/
18+
key: ${{ runner.os }}-ndk-r27-canary
19+
20+
- name: Download canary ndk
21+
if: ${{ !steps.cache.outputs.cache-hit }}
22+
env:
23+
CANARY_URL: https://github.com/QuestPackageManager/ndk-canary-archive/releases/download/27.0.1/android-ndk-10883340-linux-x86_64.zip
24+
run: wget ${CANARY_URL} -O ${HOME}/ndk.zip
25+
shell: bash
26+
27+
- name: Unzip ndk
28+
if: ${{ !steps.cache.outputs.cache-hit }}
29+
run: 7z x "${HOME}/ndk.zip" -o"${HOME}/"
30+
shell: bash
31+
32+
- name: Set output
33+
id: path
34+
shell: bash
35+
run: echo "path=${HOME}/android-ndk-r27-canary" >> ${GITHUB_OUTPUT}

.github/workflows/build-ndk.yml

Lines changed: 74 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3,103 +3,107 @@ name: NDK build
33
on:
44
workflow_dispatch:
55
push:
6-
branches: [master, update-1.19]
6+
tags:
7+
- 'v*'
8+
branches:
9+
- 'master'
10+
- 'dev/*'
11+
- 'feat/*'
12+
- 'fix/*'
713
paths-ignore:
814
- '**.yml'
915
- '!.github/workflows/build-ndk.yml'
1016
- '**.json'
1117
- '!qpm.json'
18+
- '!qpm.shared.json'
1219
- '**.ps1'
1320
- '!build.ps1'
1421
- '!buildQmod.ps1'
1522
- '!CreateQmod.ps1'
1623
- '**.md'
1724
- '.gitignore'
1825
pull_request:
19-
branches: master
26+
branches:
27+
- 'master'
2028

2129
env:
2230
ndkname: android-ndk-r22
2331
module_id: pinkcore
24-
qmodName: PinkCore
32+
qmod_name: PinkCore
2533

2634
jobs:
2735
build:
2836
runs-on: ubuntu-latest
29-
37+
3038
steps:
3139
- uses: actions/checkout@v2
3240
name: Checkout
3341
with:
3442
submodules: true
3543
lfs: true
36-
44+
3745
- uses: seanmiddleditch/gha-setup-ninja@v3
3846

47+
# Use canary NDK to avoid lesser known compile bugs
48+
- name: Setup canary NDK
49+
id: setup-ndk
50+
uses: ./.github/actions/canary-ndk
51+
3952
- name: Create ndkpath.txt
4053
run: |
41-
echo "$ANDROID_NDK_LATEST_HOME" > ${GITHUB_WORKSPACE}/ndkpath.txt
54+
echo ${{ steps.setup-ndk.outputs.ndk-path }} > ${GITHUB_WORKSPACE}/ndkpath.txt
4255
cat ${GITHUB_WORKSPACE}/ndkpath.txt
4356
44-
- name: Get QPM
45-
if: steps.cache-qpm.outputs.cache-hit != 'true'
46-
uses: dawidd6/action-download-artifact@v2
47-
with:
48-
github_token: ${{secrets.GITHUB_TOKEN}}
49-
workflow: cargo-build.yml
50-
name: linux-qpm-rust
51-
path: QPM
52-
repo: RedBrumbler/QuestPackageManager-Rust
53-
54-
- name: QPM Collapse
57+
# get version from pushed tag
58+
- name: Extract version
59+
if: startsWith(github.ref, 'refs/tags/v')
60+
id: version
5561
run: |
56-
chmod +x ./QPM/qpm-rust
57-
./QPM/qpm-rust collapse
58-
59-
- name: QPM Dependencies Cache
60-
id: cache-qpm-deps
61-
uses: actions/cache@v2
62-
env:
63-
cache-name: cache-qpm-deps
62+
echo "TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_OUTPUT}
63+
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> ${GITHUB_OUTPUT}
64+
65+
# if we don't have a tag, don't do anything special
66+
- name: Setup qpm
67+
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
68+
uses: Fernthedev/qpm-action@main
6469
with:
65-
path: /home/runner/.local/share/QPM-Rust/cache
66-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('qpm.json') }}
67-
restore-keys: |
68-
${{ runner.os }}-build-${{ env.cache-name }}-
69-
${{ runner.os }}-build-
70-
${{ runner.os }}-
71-
72-
- name: QPM Restore
73-
run: |
74-
./QPM/qpm-rust restore
70+
workflow_token: ${{ secrets.GITHUB_TOKEN }}
71+
restore: true
72+
cache: true
73+
publish: false
7574

76-
- name: List Post Restore
77-
run: |
78-
echo includes:
79-
ls -la ${GITHUB_WORKSPACE}/extern/includes
80-
echo libs:
81-
ls -la ${GITHUB_WORKSPACE}/extern/libs
82-
echo cache:
83-
ls -la $HOME/.local/share/QPM-Rust/cache
84-
85-
- name: Build
86-
run: |
87-
cd ${GITHUB_WORKSPACE}
88-
./QPM/qpm-rust qmod build
89-
pwsh -Command ./build.ps1
75+
# if we have a tag, we are making a qpm release
76+
- name: Setup qpm for release
77+
if: startsWith(github.ref, 'refs/tags/v')
78+
uses: Fernthedev/qpm-action@main
79+
with:
80+
workflow_token: ${{ secrets.GITHUB_TOKEN }}
81+
restore: true
82+
cache: true
83+
publish: true
84+
publish_token: ${{ secrets.QPM_KEY }}
85+
version: ${{ steps.version.outputs.VERSION }}
86+
tag: ${{ steps.version.outputs.TAG }}
87+
qpm_release_bin: true
88+
qpm_debug_bin: true
89+
qpm_qmod: ${{ env.qmod_name }}.qmod
9090

91-
- name: Create Qmod
91+
- name: Build & Create Qmod
9292
run: |
93-
pwsh -Command ./createqmod.ps1 ${{env.qmodName}}
93+
cd ${GITHUB_WORKSPACE}
94+
qpm s qmod
9495
9596
- name: Get Library Name
9697
id: libname
9798
run: |
9899
cd ./build/
99100
pattern="lib${module_id}*.so"
100101
files=( $pattern )
101-
echo ::set-output name=NAME::"${files[0]}"
102-
102+
echo "NAME=${files[0]}" >> ${GITHUB_OUTPUT}
103+
104+
- name: Rename debug artifact
105+
run: mv "./build/debug/${{ steps.libname.outputs.NAME }}" "./build/debug_${{ steps.libname.outputs.NAME }}"
106+
103107
- name: Upload non-debug artifact
104108
uses: actions/upload-artifact@v2
105109
with:
@@ -111,12 +115,26 @@ jobs:
111115
uses: actions/upload-artifact@v2
112116
with:
113117
name: debug_${{ steps.libname.outputs.NAME }}
114-
path: ./build/debug/${{ steps.libname.outputs.NAME }}
118+
path: ./build/debug_${{ steps.libname.outputs.NAME }}
115119
if-no-files-found: error
116120

117121
- name: Upload qmod artifact
118122
uses: actions/upload-artifact@v2
119123
with:
120-
name: ${{env.qmodName}}.qmod
121-
path: ./${{ env.qmodName }}.qmod
124+
name: ${{env.qmod_name}}.qmod
125+
path: ./${{ env.qmod_name }}.qmod
122126
if-no-files-found: error
127+
128+
# if we had a tag, we should make a release
129+
- name: Upload release artifacts
130+
if: startsWith(github.ref, 'refs/tags/v')
131+
id: upload_file_release
132+
uses: softprops/action-gh-release@v0.1.15
133+
with:
134+
tag_name: ${{ github.event.inputs.version }}
135+
files: |
136+
./build/${{ steps.libname.outputs.NAME }}
137+
./build/debug_${{ steps.libname.outputs.NAME }}
138+
./${{ env.qmod_name }}.qmod
139+
env:
140+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ ndkpath.txt
4848
Android.mk
4949
*.log
5050
cover.gif
51-
qpm.shared.json
5251
extern/
5352
Android.mk.backup
5453
src/QuestNotes.cpp.txt
@@ -91,7 +90,7 @@ sysinfo.txt
9190
/Assets/AssetStoreTools*
9291
*.apk
9392
*.unitypackage
94-
93+
9594
# ===================================== #
9695
# Visual Studio / MonoDevelop generated #
9796
# ===================================== #
@@ -109,7 +108,8 @@ sysinfo.txt
109108
.consulo/
110109
/*.tmp
111110
/*.svd
112-
111+
.cache/
112+
113113
# ============ #
114114
# OS generated #
115115
# ============ #
@@ -135,7 +135,7 @@ sysinfo.txt
135135
/Assets/AssetStoreTools*
136136
*.apk
137137
*.unitypackage
138-
138+
139139
# ===================================== #
140140
# Visual Studio / MonoDevelop generated #
141141
# ===================================== #
@@ -153,7 +153,7 @@ sysinfo.txt
153153
.consulo/
154154
/*.tmp
155155
/*.svd
156-
156+
157157
# ============ #
158158
# OS generated #
159159
# ============ #
@@ -166,4 +166,4 @@ ehthumbs.db
166166
[Tt]humbs.db
167167
[Dd]esktop.ini
168168
Corridor/Library/ShaderCache/
169-
Corridor/Library/metadata/
169+
Corridor/Library/metadata/

CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ include(qpm_defines.cmake)
33

44
cmake_minimum_required(VERSION 3.22)
55
project(${COMPILE_ID})
6+
include(${EXTERN_DIR}/includes/kaleb/shared/cmake/assets.cmake)
67

78
# c++ standard
89
set(CMAKE_CXX_STANDARD 20)
@@ -18,16 +19,18 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1819
add_compile_options(-frtti -fPIE -fPIC -fexceptions)
1920
# compile definitions used
2021
add_compile_definitions(VERSION=\"${MOD_VERSION}\")
22+
add_compile_definitions(VERSION_LONG=0)
2123
add_compile_definitions(MOD_ID=\"${MOD_ID}\")
24+
add_compile_definitions(HAS_CODEGEN)
2225
2326
# recursively get all src files
2427
RECURSE_FILES(cpp_file_list ${SOURCE_DIR}/*.cpp)
2528
RECURSE_FILES(c_file_list ${SOURCE_DIR}/*.c)
2629
2730
# add all src files to compile
2831
add_library(
29-
${COMPILE_ID}
30-
SHARED
32+
${COMPILE_ID}
33+
SHARED
3134
${cpp_file_list}
3235
${c_file_list}
3336
)
@@ -38,10 +41,9 @@ target_include_directories(${COMPILE_ID} PRIVATE ${SOURCE_DIR})
3841
target_include_directories(${COMPILE_ID} PRIVATE ${INCLUDE_DIR})
3942
# add shared dir as include dir
4043
target_include_directories(${COMPILE_ID} PUBLIC ${SHARED_DIR})
41-
# codegen includes
42-
target_include_directories(${COMPILE_ID} PRIVATE ${EXTERN_DIR}/includes/${CODEGEN_ID}/include)
4344
44-
target_link_libraries(${COMPILE_ID} PRIVATE -llog -lz)
45+
add_assets(${COMPILE_ID}-assets STATIC ${CMAKE_CURRENT_LIST_DIR}/assets ${INCLUDE_DIR}/assets.hpp)
46+
target_link_libraries(${COMPILE_ID} PRIVATE -llog -lz ${COMPILE_ID}-assets)
4547
# add extern stuff like libs and other includes
4648
include(extern.cmake)
4749
@@ -51,7 +53,7 @@ add_custom_command(TARGET ${COMPILE_ID} POST_BUILD
5153
COMMAND ${CMAKE_STRIP} -g -S -d --strip-all
5254
"lib${COMPILE_ID}.so" -o "stripped_lib${COMPILE_ID}.so"
5355
COMMENT "Strip debug symbols done on final binary.")
54-
56+
5557
add_custom_command(TARGET ${COMPILE_ID} POST_BUILD
5658
COMMAND ${CMAKE_COMMAND} -E make_directory debug
5759
COMMENT "Make directory for debug symbols"
@@ -87,5 +89,3 @@ add_custom_command(TARGET ${COMPILE_ID} POST_BUILD
8789
COMMAND ${CMAKE_COMMAND} -E copy ${a_file} debug/${file}
8890
COMMENT "Copy a files for ndk stack")
8991
endforeach()
90-
91-
include(assets_include.cmake)

0 commit comments

Comments
 (0)