Skip to content

Commit 5644761

Browse files
committed
Use lzhiyong tooling
1 parent 06a8462 commit 5644761

Some content is hidden

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

61 files changed

+2339
-1282
lines changed

.github/workflows/build.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
workflow_dispatch:
99
inputs:
1010
logLevel:
11-
description: 'Reason'
11+
description: 'Reason'
1212
required: false
1313
default: 'Update package'
1414

@@ -24,22 +24,39 @@ jobs:
2424
target_arch: [x86_64, x86, arm64-v8a, armeabi-v7a]
2525
fail-fast: false
2626
steps:
27-
- name: Checkout
27+
- name: Checkout repo
2828
uses: actions/checkout@v4
2929
with:
3030
submodules: 'true'
3131

32-
- uses: nttld/setup-ndk@v1
32+
- name: Setting up NDK
33+
uses: nttld/setup-ndk@v1
3334
id: setup-ndk
3435
with:
3536
ndk-version: r23c
3637
add-to-path: false
37-
- run: ./build.sh ${{ matrix.target_arch }}
38+
39+
- name: Getting AOSP's source code
40+
run: |
41+
python3 ./get_source.py --tags platform-tools-35.0.2
42+
43+
- name: Compiling protoc
44+
run: |
45+
mkdir -p src/protobuf/build
46+
pushd src/protobuf/build
47+
cmake -GNinja -Dprotobuf_BUILD_TESTS=OFF ..
48+
ninja -j$(nproc --all)
49+
popd
50+
env:
51+
NDK_TOOLCHAIN: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64
52+
53+
- name: Compiling aapt2
54+
run: python3 ./build.py --ndk=${{ steps.setup-ndk.outputs.ndk-path }} --abi=${{ matrix.target_arch }} --build="build/${{ matrix.target_arch }}" --protoc=/${{ github.workspace }}/src/protobuf/build/protoc --target aapt2
3855
env:
3956
NDK_TOOLCHAIN: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64
4057

4158
- name: Upload artifacts
4259
uses: actions/upload-artifact@v4
4360
with:
44-
name: dist-${{ matrix.target_arch }}
45-
path: dist
61+
name: aapt2-${{ matrix.target_arch }}
62+
path: ${{ github.workspace }}/build/${{ matrix.target_arch }}/bin/aapt2

.gitignore

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
1-
bin/
2-
build/
1+
CMakeCache.txt
2+
CMakeFiles
3+
CMakeScripts
4+
Testing
5+
Makefile
6+
cmake_install.cmake
7+
install_manifest.txt
8+
compile_commands.json
9+
CTestTestfile.cmake
10+
build
11+
pack
12+
src
13+
# remove git history
14+
git_remove_history.sh

.gitmodules

Lines changed: 0 additions & 56 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 57 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,81 @@
1+
#
2+
# Copyright © 2022 Github Lzhiyong
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
117
cmake_minimum_required(VERSION 3.14.2)
218
project(sdk-tools)
319

4-
if(ANDROID_ABI STREQUAL "arm64-v8a" OR ANDROID_ABI STREQUAL "armeabi-v7a")
5-
enable_language(ASM)
6-
elseif(ANDROID_ABI STREQUAL "x86_64" OR ANDROID_ABI STREQUAL "x86")
7-
enable_language(ASM_NASM)
8-
else()
9-
message(FATAL_ERROR "Unsupported architecture: ${ANDROID_ABI}")
10-
endif()
20+
set(CMAKE_C_STANDARD 11)
21+
set(CMAKE_CXX_STANDARD 20)
22+
enable_language(ASM)
1123

1224
# set global cflags and cxxflags
13-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics -fPIC -Wno-attributes -std=gnu11")
14-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics -fPIC -Wno-attributes -std=gnu++2a")
25+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics -fPIC -Wno-attributes")
26+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics -fPIC -Wno-attributes")
1527
# static link
1628
set(CMAKE_EXE_LINKER_FLAGS "-static")
1729

1830
# platform tools version
1931
# see the patches/other/platform_tools_version.h
20-
set(TOOLS_VERSION 33.0.1)
32+
set(TOOLS_VERSION 35.0.1)
2133
set(SRC ${PROJECT_SOURCE_DIR}/src)
2234

2335
# 64-bit off_t for lseek.
2436
add_definitions(-D_FILE_OFFSET_BITS=64)
2537

26-
if(NOT DEFINED PROTOC_PATH)
27-
message(FATAL_ERROR "PROTOC_PATH undefined, please make sure to build and install protoc from the cloned submodule." )
28-
endif()
38+
set(PROTOC_COMPILER)
39+
40+
if(DEFINED PROTOC_PATH)
41+
set(PROTOC_COMPILER ${PROTOC_PATH})
2942

30-
set(PROTOC_COMPILER ${PROTOC_PATH})
31-
32-
if(NOT EXISTS ${PROTOC_COMPILER})
33-
unset(PROTOC_PATH CACHE)
34-
message(FATAL_ERROR "Invalid protoc: ${PROTOC_COMPILER}, please check if the path is correct")
43+
if(NOT EXISTS ${PROTOC_COMPILER})
44+
unset(PROTOC_PATH CACHE)
45+
message(FATAL_ERROR "Invalid protoc: ${PROTOC_COMPILER}, please check if the path is correct")
46+
endif()
47+
48+
# check protoc version
49+
execute_process(
50+
COMMAND ${PROTOC_COMPILER} --version
51+
OUTPUT_VARIABLE PTOTOBUF_VERSION
52+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
53+
)
54+
55+
if(NOT PTOTOBUF_VERSION MATCHES "^libprotoc*")
56+
unset(PROTOC_PATH CACHE)
57+
message(FATAL_ERROR "Invalid protoc: ${PROTOC_COMPILER}, this may not be an executable")
58+
endif()
59+
60+
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" VERSIONS ${PTOTOBUF_VERSION})
61+
# please note that if the protobuf version is too high, you may encounter the following error
62+
# error: This file was generated by a newer version of protoc
63+
if(VERSIONS VERSION_GREATER "3.21.12")
64+
message(WARNING "${PTOTOBUF_VERSION}, the protobuf version is too high, may be incompatible!!")
65+
endif()
3566
endif()
3667

3768
# thrid-party libraries
3869
add_subdirectory(src/boringssl EXCLUDE_FROM_ALL)
3970
add_subdirectory(src/fmtlib EXCLUDE_FROM_ALL)
4071
add_subdirectory(src/pcre EXCLUDE_FROM_ALL)
41-
add_subdirectory(src/expat EXCLUDE_FROM_ALL)
42-
add_subdirectory(src/zopfli EXCLUDE_FROM_ALL)
43-
add_subdirectory(src/protobuf/cmake EXCLUDE_FROM_ALL)
72+
add_subdirectory(src/libpng EXCLUDE_FROM_ALL)
73+
add_subdirectory(src/jsoncpp EXCLUDE_FROM_ALL)
74+
add_subdirectory(src/expat/expat EXCLUDE_FROM_ALL)
75+
add_subdirectory(src/protobuf EXCLUDE_FROM_ALL)
76+
add_subdirectory(src/googletest EXCLUDE_FROM_ALL)
4477

4578
# building sdk-tools
46-
add_subdirectory(cmake)
79+
add_subdirectory(lib)
80+
add_subdirectory(build-tools)
81+

0 commit comments

Comments
 (0)