Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: switch build system to cmake #31

Merged
merged 3 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/attach_termux_elf_cleaner_to_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ jobs:
echo "The versionName '${RELEASE_VERSION_NAME/v/}' is not a valid version as per semantic version '2.0.0' spec in the format 'major.minor.patch(-prerelease)(+buildmetadata)'. https://semver.org/spec/v2.0.0.html."
exit 1
fi
- name: Install required packages
run: |
sudo apt update
sudo apt upgrade
sudo apt install cmake ninja-build
- name: Build
run: |
autoreconf -vfi
mkdir build && cd build
../configure
make
cmake . -Bbuild -GNinja
ninja -C build/
- name: Test
run: |
ninja -C build/ test
- name: Attach termux-elf-cleaner to release
uses: termux/[email protected]
with:
Expand Down
23 changes: 8 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,15 @@ jobs:
with:
ref: ${{ env.GITHUB_REF }}

- name: Prepare
- name: Install required packages
run: |
autoreconf -vfi
mkdir build

- name: Configure
run: |
cd build
../configure

- name: Make
sudo apt update
sudo apt upgrade
sudo apt install cmake ninja-build
- name: Build
run: |
cd build
make

cmake . -Bbuild -GNinja
ninja -C build/
- name: Test
run: |
cd build
make check
ninja -C build/ test
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ elf-cleaner
# In case of out-of-src build in a directory build/:
build/

# Some people prefer to use this as build directory
out/

# Used for editor integration (completions, etc)
compile_commands.json

*~

# Generated files from old autotools
# Although we no longer use autotools, some contributors might still be having it in their trees
Makefile.in
aclocal.m4
autom4te.cache/
Expand Down
70 changes: 70 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
cmake_minimum_required(VERSION 3.25 FATAL_ERROR)

set(VERSION_MAJOR 3)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)

set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")

set(ARCHES aarch64;arm;i686;x86_64)
set(APIS 21;24)

project(elf-cleaner
LANGUAGES C CXX
VERSION ${VERSION}
)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(PACKAGE_NAME "termux-elf-cleaner" CACHE STRING "Name of the package")

add_executable("${PACKAGE_NAME}"
elf-cleaner.cpp
arghandling.c
)

target_compile_definitions("${PACKAGE_NAME}"
PRIVATE "COPYRIGHT=\"Copyright (C) 2022-2024 Termux and contributors.\""
PRIVATE "PACKAGE_VERSION=\"${VERSION}\""
PRIVATE "PACKAGE_NAME=\"${PACKAGE_NAME}\""
)


enable_testing()

# Dynamic section tests
foreach(arch ${ARCHES})
foreach(api ${APIS})
add_test(
NAME "dynamic-section-${arch}-api${api}"
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/test-dynamic-section.sh
${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}
${CMAKE_CURRENT_SOURCE_DIR}
curl-7.83.1
${arch}
${api}
)
endforeach()
endforeach()

# TLS alignment tests
foreach(arch ${ARCHES})
add_test(
NAME "tls-alignment-${arch}-api${api}"
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/test-tls-alignment.sh
${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}
${CMAKE_CURRENT_SOURCE_DIR}
valgrind-3.19.0
${arch}
)
endforeach()

# Thread test
add_test(
NAME "thread"
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/test-threads.sh
${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}
${CMAKE_CURRENT_SOURCE_DIR}
)
24 changes: 0 additions & 24 deletions Makefile.am

This file was deleted.

43 changes: 0 additions & 43 deletions configure.ac

This file was deleted.

1 change: 1 addition & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.test
62 changes: 0 additions & 62 deletions tests/Makefile.am

This file was deleted.

109 changes: 0 additions & 109 deletions tests/api-21.at

This file was deleted.

Loading