-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d2de87c
Showing
23 changed files
with
1,755 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# Credit to darknight1050 https://github.com/darknight1050/CrashReporter/blob/master/.github/workflows/build-ndk.yml | ||
|
||
name: NDK build | ||
|
||
env: | ||
module_id: BSNightcoreQuest | ||
qmodName: BSNightcoreQuest | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
name: Checkout | ||
with: | ||
submodules: true | ||
lfs: true | ||
|
||
- uses: seanmiddleditch/gha-setup-ninja@v3 | ||
|
||
- name: Create ndkpath.txt | ||
run: | | ||
echo "$ANDROID_NDK_LATEST_HOME" > ${GITHUB_WORKSPACE}/ndkpath.txt | ||
cat ${GITHUB_WORKSPACE}/ndkpath.txt | ||
- name: Get QPM | ||
if: steps.cache-qpm.outputs.cache-hit != 'true' | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
github_token: ${{secrets.GITHUB_TOKEN}} | ||
workflow: cargo-build.yml | ||
name: linux-qpm-rust | ||
path: QPM | ||
repo: QuestPackageManager/QPM.CLI | ||
|
||
- name: QPM Collapse | ||
run: | | ||
chmod +x ./QPM/qpm-rust | ||
./QPM/qpm-rust collapse | ||
- name: QPM Dependencies Cache | ||
id: cache-qpm-deps | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-qpm-deps | ||
with: | ||
path: /home/runner/.local/share/QPM-Rust/cache | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('qpm.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: QPM Restore | ||
run: | | ||
./QPM/qpm-rust restore | ||
- name: List Post Restore | ||
run: | | ||
echo includes: | ||
ls -la ${GITHUB_WORKSPACE}/extern/includes | ||
echo libs: | ||
ls -la ${GITHUB_WORKSPACE}/extern/libs | ||
echo cache: | ||
ls -la $HOME/.local/share/QPM-Rust/cache | ||
- name: Build | ||
run: | | ||
cd ${GITHUB_WORKSPACE} | ||
./QPM/qpm-rust qmod build | ||
pwsh -Command ./build.ps1 | ||
- name: Create Qmod | ||
run: | | ||
pwsh -Command ./createqmod.ps1 ${{env.qmodName}} | ||
- name: Get Library Name | ||
id: libname | ||
run: | | ||
cd ./build/ | ||
pattern="lib${module_id}*.so" | ||
files=( $pattern ) | ||
echo ::set-output name=NAME::"${files[0]}" | ||
- name: Upload so artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ steps.libname.outputs.NAME }} | ||
path: ./build/${{ steps.libname.outputs.NAME }} | ||
if-no-files-found: error | ||
|
||
- name: Upload qmod artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{env.qmodName}}.qmod | ||
path: ./${{ env.qmodName }}.qmod | ||
if-no-files-found: error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Prerequisites | ||
*.d | ||
|
||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
|
||
# VSCode config stuff | ||
.vscode/ | ||
|
||
# Jetbrains IDEs | ||
.idea/ | ||
|
||
# NDK stuff | ||
out/ | ||
[Ll]ib/ | ||
[Ll]ibs/ | ||
[Oo]bj/ | ||
[Oo]bjs/ | ||
ndkpath.txt | ||
*.zip | ||
*.txt | ||
*.log | ||
Android.mk.backup | ||
|
||
# QPM stuff | ||
[Ee]xtern/ | ||
*.qmod | ||
qpm.shared.json | ||
qpm_defines.cmake | ||
![Cc][Mm]ake[Ll]ists.txt | ||
|
||
# CMake stuff | ||
[Bb]uild/ | ||
cmake-build-*/ | ||
extern.cmake | ||
|
||
# QMOD Schema | ||
mod.json.schema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# include some defines automatically made by qpm | ||
include(qpm_defines.cmake) | ||
|
||
# override mod id | ||
set(MOD_ID "RecentlyPlayed") | ||
|
||
# Enable link time optimization | ||
# In my experience, this can be highly unstable but it nets a huge size optimization and likely performance | ||
# However, the instability was seen using Android.mk/ndk-build builds. With Ninja + CMake, this problem seems to have been solved. | ||
# As always, test thoroughly | ||
# - Fern | ||
# set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) | ||
|
||
cmake_minimum_required(VERSION 3.21) | ||
project(${COMPILE_ID}) | ||
|
||
# c++ standard | ||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_STANDARD_REQUIRED 20) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
# define that stores the actual source directory | ||
set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src) | ||
set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
|
||
# compile options used | ||
add_compile_options(-frtti -fexceptions) | ||
add_compile_options(-O3) | ||
# compile definitions used | ||
add_compile_definitions(VERSION=\"${MOD_VERSION}\") | ||
add_compile_definitions(MOD_ID=\"${MOD_ID}\") | ||
|
||
# recursively get all src files | ||
RECURSE_FILES(cpp_file_list ${SOURCE_DIR}/*.cpp) | ||
RECURSE_FILES(c_file_list ${SOURCE_DIR}/*.c) | ||
|
||
# add all src files to compile | ||
add_library( | ||
${COMPILE_ID} | ||
SHARED | ||
${cpp_file_list} | ||
${c_file_list} | ||
) | ||
|
||
target_include_directories(${COMPILE_ID} PRIVATE .) | ||
|
||
# add src dir as include dir | ||
target_include_directories(${COMPILE_ID} PRIVATE ${SOURCE_DIR}) | ||
# add include dir as include dir | ||
target_include_directories(${COMPILE_ID} PRIVATE ${INCLUDE_DIR}) | ||
# add shared dir as include dir | ||
target_include_directories(${COMPILE_ID} PUBLIC ${SHARED_DIR}) | ||
# codegen includes | ||
target_include_directories(${COMPILE_ID} PRIVATE ${EXTERN_DIR}/includes/${CODEGEN_ID}/include) | ||
|
||
target_link_libraries(${COMPILE_ID} PRIVATE -llog) | ||
# add extern stuff like libs and other includes | ||
include(extern.cmake) | ||
|
||
add_custom_command(TARGET ${COMPILE_ID} POST_BUILD | ||
COMMAND ${CMAKE_STRIP} -d --strip-all | ||
"lib${COMPILE_ID}.so" -o "stripped_lib${COMPILE_ID}.so" | ||
COMMENT "Strip debug symbols done on final binary.") | ||
|
||
add_custom_command(TARGET ${COMPILE_ID} POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E make_directory debug | ||
COMMENT "Make directory for debug symbols" | ||
) | ||
|
||
add_custom_command(TARGET ${COMPILE_ID} POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E rename lib${COMPILE_ID}.so debug/lib${COMPILE_ID}.so | ||
COMMENT "Rename the lib to debug_ since it has debug symbols" | ||
) | ||
|
||
# strip debug symbols from the .so and all dependencies | ||
add_custom_command(TARGET ${COMPILE_ID} POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E rename stripped_lib${COMPILE_ID}.so lib${COMPILE_ID}.so | ||
COMMENT "Rename the stripped lib to regular" | ||
) | ||
foreach(so_file ${so_list}) | ||
cmake_path(GET so_file FILENAME file) | ||
|
||
add_custom_command(TARGET ${COMPILE_ID} POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy ${so_file} debug/${file} | ||
COMMENT "Copy so files for ndk stack" | ||
) | ||
|
||
add_custom_command(TARGET ${COMPILE_ID} POST_BUILD | ||
COMMAND ${CMAKE_STRIP} -g -S -d --strip-all ${so_file} -o ${file} | ||
COMMENT "Strip debug symbols from the dependencies") | ||
endforeach() | ||
|
||
foreach(a_file ${a_list}) | ||
cmake_path(GET a_file FILENAME file) | ||
|
||
add_custom_command(TARGET ${COMPILE_ID} POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy ${a_file} debug/${file} | ||
COMMENT "Copy a files for ndk stack") | ||
endforeach() |
Oops, something went wrong.