Ninja and ccache - faster builds!
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 1m28s
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 1m28s
This commit is contained in:
parent
f45baa8362
commit
9375acafa9
@ -116,18 +116,22 @@ FetchContent_MakeAvailable(nlohmann_json)
|
|||||||
# Find zlib
|
# Find zlib
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
|
|
||||||
|
# Force static linking for zlib
|
||||||
|
set(ZLIB_USE_STATIC_LIBS TRUE)
|
||||||
|
set(ZLIB_LIBRARIES z)
|
||||||
|
|
||||||
# Link libraries
|
# Link libraries
|
||||||
target_link_libraries(dropshell PRIVATE
|
target_link_libraries(dropshell PRIVATE
|
||||||
libassert::assert
|
libassert::assert
|
||||||
cpptrace::cpptrace
|
cpptrace::cpptrace
|
||||||
httplib::httplib
|
httplib::httplib
|
||||||
nlohmann_json::nlohmann_json
|
nlohmann_json::nlohmann_json
|
||||||
ZLIB::ZLIB
|
${ZLIB_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Set static linking flags
|
# Set static linking flags
|
||||||
set_target_properties(dropshell PROPERTIES
|
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
|
# Install targets
|
||||||
|
@ -17,7 +17,6 @@ if command -v nproc >/dev/null 2>&1; then
|
|||||||
JOBS=$(nproc)
|
JOBS=$(nproc)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Function to print status messages
|
# Function to print status messages
|
||||||
print_status() {
|
print_status() {
|
||||||
echo -e "${GREEN}[*] $1${NC}"
|
echo -e "${GREEN}[*] $1${NC}"
|
||||||
@ -49,20 +48,25 @@ if ! command -v cmake &> /dev/null; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if make is installed
|
# Check if Ninja is installed
|
||||||
if ! command -v make &> /dev/null; then
|
if ! command -v ninja &> /dev/null; then
|
||||||
print_error "Make is not installed. Please install Make first."
|
print_error "Ninja is not installed. Please install Ninja first."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
# Configure with CMake
|
||||||
print_status "Configuring with CMake..."
|
print_status "Configuring with CMake..."
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=Debug
|
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||||
#cmake .. -DCMAKE_BUILD_TYPE=Release
|
|
||||||
|
|
||||||
# Build the project
|
# Build the project
|
||||||
print_status "Building project..."
|
print_status "Building project..."
|
||||||
make -j"$JOBS"
|
ninja -j"$JOBS"
|
||||||
|
|
||||||
# Check if build was successful
|
# Check if build was successful
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
@ -85,7 +85,7 @@ done
|
|||||||
|
|
||||||
|
|
||||||
# Install other required packages
|
# Install other required packages
|
||||||
apt install -y musl-tools wget tar
|
apt install -y musl-tools wget tar ccache ninja-build
|
||||||
|
|
||||||
# Set install directory
|
# Set install directory
|
||||||
if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then
|
if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user