-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuildOnly.ps1
50 lines (40 loc) · 1.3 KB
/
buildOnly.ps1
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
$ErrorActionPreference = 'Stop'
function log {
[CmdletBinding()]
Param
(
[Parameter(Mandatory = $true, Position = 0)]
[string]$LogMessage
)
Write-Output ("[{0}] {1}" -f (Get-Date), $LogMessage)
}
if ( (Test-Path build) -ne "True" ) {
mkdir build
}
log "Building..."
$id = Get-Content magiskModule/module.prop | Where-Object { $_ -match "id=" }
$id = $id.split('=')[1]
# 下载最新工具链
# https://developer.android.com/ndk/downloads
# https://github.com/android/ndk/wiki
# 将 NDK 与其他构建系统配合使用
# https://developer.android.com/ndk/guides/other_build_systems
# https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md
$NDK_PATH = "E:\NDK\android-ndk-r27"
$clang = "${NDK_PATH}/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe"
# Android 10+ Q+ SDK29+ (如果最低支持SDK是28或以下,则需要进行align_fix)
& $clang --target=aarch64-linux-android29 -std=c++20 -static -s -O2 -Wall -Iinclude src/*.cc -o build/$id
if ( -not $? ) {
log "Compile fail"
exit
}
log "Compile success"
# (如果最低支持SDK是28或以下,则需要进行align_fix)
# $res=./align_fix.exe build/$id
# if ( -not $? ) {
# log "align_fix失败"
# exit
# }
# log $res
# log "align_fix完成"
log "Compile output: build/$id"