Ninja and ccache - faster builds!
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 1m28s

This commit is contained in:
Your Name 2025-05-25 22:18:58 +12:00
parent f45baa8362
commit 9375acafa9
3 changed files with 18 additions and 10 deletions

View File

@ -116,18 +116,22 @@ FetchContent_MakeAvailable(nlohmann_json)
# Find zlib
find_package(ZLIB REQUIRED)
# Force static linking for zlib
set(ZLIB_USE_STATIC_LIBS TRUE)
set(ZLIB_LIBRARIES z)
# Link libraries
target_link_libraries(dropshell PRIVATE
libassert::assert
cpptrace::cpptrace
httplib::httplib
nlohmann_json::nlohmann_json
ZLIB::ZLIB
${ZLIB_LIBRARIES}
)
# Set static linking flags
set_target_properties(dropshell PROPERTIES
LINK_FLAGS "-static-libstdc++ -static-libgcc -Wl,-Bstatic -Wl,-Bdynamic"
LINK_FLAGS "-static-libstdc++ -static-libgcc -Wl,-Bstatic -lz -Wl,-Bdynamic"
)
# Install targets

View File

@ -17,7 +17,6 @@ if command -v nproc >/dev/null 2>&1; then
JOBS=$(nproc)
fi
# Function to print status messages
print_status() {
echo -e "${GREEN}[*] $1${NC}"
@ -49,20 +48,25 @@ if ! command -v cmake &> /dev/null; then
exit 1
fi
# Check if make is installed
if ! command -v make &> /dev/null; then
print_error "Make is not installed. Please install Make first."
# Check if Ninja is installed
if ! command -v ninja &> /dev/null; then
print_error "Ninja is not installed. Please install Ninja first."
exit 1
fi
# Check if ccache is installed
if ! command -v ccache &> /dev/null; then
print_warning "ccache is not installed. Builds will be slower without it."
print_warning "Consider installing ccache for faster builds."
fi
# Configure with CMake
print_status "Configuring with CMake..."
cmake .. -DCMAKE_BUILD_TYPE=Debug
#cmake .. -DCMAKE_BUILD_TYPE=Release
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
# Build the project
print_status "Building project..."
make -j"$JOBS"
ninja -j"$JOBS"
# Check if build was successful
if [ $? -eq 0 ]; then

View File

@ -85,7 +85,7 @@ done
# Install other required packages
apt install -y musl-tools wget tar
apt install -y musl-tools wget tar ccache ninja-build
# Set install directory
if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then