Revert "Improve build system, etc..."

This reverts commit 249b44a81a.
This commit is contained in:
2025-08-24 16:17:12 +03:00
parent 249b44a81a
commit 705f529f55
7 changed files with 42 additions and 56 deletions

3
.gitignore vendored
View File

@@ -7,7 +7,8 @@ cmake-build-*
include/generated include/generated
# Dont't add build directories # Dont't add build directories
build_* build_arm64-v8a
build_armeabi-v7a
# Don't add generated objects and libs # Don't add generated objects and libs
*.o *.o

View File

@@ -29,7 +29,7 @@ else()
endif() endif()
# Add pmt's CMake module(s) # Add pmt's CMake module(s)
include(build/cmake/generate_headers.cmake) include(cmake/generate_headers.cmake)
# Generate header(s) # Generate header(s)
get_property(FLAGS DIRECTORY PROPERTY COMPILE_OPTIONS) get_property(FLAGS DIRECTORY PROPERTY COMPILE_OPTIONS)

View File

@@ -15,61 +15,74 @@
# limitations under the License. # limitations under the License.
# #
set -e
BUILD_64="build_arm64-v8a"
BUILD_32="build_armeabi-v7a"
THIS="$(basename $0)" THIS="$(basename $0)"
TARGET_ABI_LIST=("arm64-v8a" "armeabi-v7a")
echo() { command echo "[$THIS]: $@"; } echo() { command echo "[$THIS]: $@"; }
checks() { checks()
{
if [ -z "$ANDROID_NDK" ]; then if [ -z "$ANDROID_NDK" ]; then
echo "Please set ANDROID_NDK variable as your NDK path." echo "Please set ANDROID_NDK variable as your NDK path."
exit 1 exit 1
fi fi
if ! which cmake &>/dev/null; then if [ ! -f /usr/bin/cmake ] && [ ! -f /bin/cmake ]; then
echo "Please verify your CMake installation." echo "Please verify your CMake installation."
exit 1 exit 1
fi fi
} }
clean() { clean()
{
echo "Cleaning workspace." echo "Cleaning workspace."
for a in ${TARGET_ABI_LIST[@]}; do rm -rf build_$a; done rm -rf $BUILD_32 $BUILD_64 \
rm -rf include/generated \ include/generated \
srclib/libhelper/tests/dir \ srclib/libhelper/tests/dir \
srclib/libhelper/tests/linkdir \ srclib/libhelper/tests/linkdir \
srclib/libhelper/tests/file.txt srclib/libhelper/tests/file.txt
} }
build() { build()
set -e {
mkdir -p $BUILD_64 $BUILD_32
command echo -e "BUILD INFO: command echo -e "BUILD INFO:
ARCHS: ${TARGET_ABI_LIST[@]} ARCHS: arm64-v8a armeabi-v7a
ANDROID_PLATFORM: $ANDROID_PLATFORM ANDROID_PLATFORM: $ANDROID_PLATFORM
ANDROID_TOOLCHAIN_FILE: $ANDROID_NDK/build/cmake/android.toolchain.cmake\n" ANDROID_TOOLCHAIN_FILE: $ANDROID_NDK/build/cmake/android.toolchain.cmake\n"
for a in ${TARGET_ABI_LIST[@]}; do echo "Configuring for arm64-v8a..."
echo "Configuring for $a..." cmake -B $BUILD_64 -S . $1 \
mkdir -p build_$a -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
cmake -B build_$a -S . $1 \ -DANDROID_ABI=arm64-v8a \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \ -DANDROID_PLATFORM=$ANDROID_PLATFORM \
-DANDROID_ABI=$a \ -DANDROID_STL=c++_static
-DANDROID_PLATFORM=$ANDROID_PLATFORM \
-DANDROID_STL=c++_static
done
for a in ${TARGET_ABI_LIST[@]}; do echo "Configuring for armeabi-v7a..."
echo "Building $a artifacts..." cmake -B $BUILD_32 -S . $1 \
cmake --build build_$a -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
echo "$a build complete, artifacts: $PWD/build_$a" -DANDROID_ABI=armeabi-v7a \
done -DANDROID_PLATFORM=$ANDROID_PLATFORM \
-DANDROID_STL=c++_static
echo "Building arm64-v8a artifacts..."
cmake --build $BUILD_64
echo "arm64-v8a build complete, artifacts: $PWD/$BUILD_64"
echo "Building armeabi-v7a artifacts..."
cmake --build $BUILD_32
echo "armeabi-v7a build complete, artifacts: $PWD/$BUILD_32"
} }
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
command echo -e "Usage: $0 build|rebuild|clean [EXTRA_CMAKE_FLAGS]\n HINT: Export ANDROID_PLATFORM if you set min Android target.\n HINT: Change TARGET_ABI_LIST array in build.sh if you build other archs." command echo "Usage: $0 build|rebuild|clean [EXTRA_CMAKE_FLAGS] [ANDROID_PLATFORM=SELECTED_ANDROID_PLATFORM]"
exit 1 exit 1
fi fi
[ -z $ANDROID_PLATFORM ] && ANDROID_PLATFORM="android-21" if [ -z $ANDROID_PLATFORM ]; then ANDROID_PLATFORM="android-21"; fi
checks checks
case $1 in case $1 in

View File

@@ -30,8 +30,7 @@ set(PMT_SOURCES
) )
# Add pmt # Add pmt
add_executable(pmt ${PMT_SOURCES} add_executable(pmt ${PMT_SOURCES})
functions/ShellFunction.cpp)
add_executable(pmt_static ${PMT_SOURCES}) add_executable(pmt_static ${PMT_SOURCES})
# Set linker options # Set linker options

View File

@@ -1,16 +0,0 @@
/*
Copyright 2025 Yağız Zengin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

View File

@@ -175,17 +175,6 @@ public:
[[nodiscard]] const char *name() const override; [[nodiscard]] const char *name() const override;
}; };
class shellFunction final : public FunctionBase {
public:
CLI::App *cmd = nullptr;
bool init(CLI::App &_app) override;
bool run() override;
[[nodiscard]] bool isUsed() const override;
[[nodiscard]] const char *name() const override;
};
} // namespace PartitionManager } // namespace PartitionManager
#endif // #ifndef FUNCTIONS_HPP #endif // #ifndef FUNCTIONS_HPP