:-'Generic Commit'

This commit is contained in:
Your Name
2025-05-28 15:59:21 +12:00
parent 5c919e1146
commit 26a7e2da1b
50 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,295 @@
#!/bin/bash
set -euo pipefail
# SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
ARCHS=(
"x86_64"
"aarch64"
)
HOSTARCH=$(uname -m)
SOURCE_DIR=""
BUILD_DIR=""
OUTPUT_DIR=""
EXECUTABLE_NAME=""
# set flags from command line
RELEASE=0
MULTIBUILD=0
function help() {
echo "Usage: $0 [options]"
echo "Options:"
echo " version Show version information and exit"
echo " "
echo " <directory> Build the project in <directory>"
echo " -r, --release Build release version"
echo " -m, --multi Build for multiple architectures"
}
function version() {
echo "magicbuild 0.1"
}
# ----------------------------------------------------------------------------------------------------------
# CHECK PACKAGES
# ----------------------------------------------------------------------------------------------------------
function check_packages() {
# Define packages based on distribution
case $OS in
"Ubuntu"|"Debian GNU/Linux")
# Common packages for both Ubuntu and Debian
PACKAGES="cmake make g++ build-essential upx musl-tools wget tar ccache ninja-build mold"
;;
*)
print_error "Unsupported distribution: $OS"
exit 1
;;
esac
# Function to check if a package is installed
is_package_installed() {
dpkg -l "$1" 2>/dev/null | grep -q "^ii"
}
# Install missing packages
print_status "Checking required packages..."
for pkg in $PACKAGES; do
if ! is_package_installed "$pkg"; then
echo "Missing package: $pkg"
exit 1
fi
echo "Package $pkg is installed"
done
}
# ----------------------------------------------------------------------------------------------------------
# MUSL CROSS COMPILERS
# ----------------------------------------------------------------------------------------------------------
function installmusl() {
echo "Installing musl toolchain"
# Set install directory
if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then
USER_HOME=$(eval echo "~${SUDO_USER}")
else
USER_HOME="$HOME"
fi
INSTALL_DIR="$USER_HOME/.musl-cross"
mkdir -p "$INSTALL_DIR"
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
function install_musl_cross() {
local TOOLCHAIN="$1"
local MUSL_CC_URL="https://musl.cc"
if [ ! -d "$INSTALL_DIR/$TOOLCHAIN" ]; then
echo "Downloading $TOOLCHAIN musl cross toolchain..."
wget -nc -O "$TMPDIR/$TOOLCHAIN.tgz" "$MUSL_CC_URL/$TOOLCHAIN.tgz"
tar -C "$INSTALL_DIR" -xvf "$TMPDIR/$TOOLCHAIN.tgz"
fi
}
function check_path() {
if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then
local BASHRC="$USER_HOME/.bashrc"
local TOOLCHAIN="$1"
local MUSL_PATH="$INSTALL_DIR/$TOOLCHAIN/bin"
if ! echo "$PATH" | grep -q "$MUSL_PATH"; then
echo "Adding $MUSL_PATH to PATH in $BASHRC"
PATH_LINE="export PATH=\"$MUSL_PATH:\$PATH\""
if ! grep -Fxq "$PATH_LINE" "$BASHRC"; then
echo "" >> "$BASHRC"
echo "# Add musl cross compilers to PATH for dropshell" >> "$BASHRC"
echo "$PATH_LINE" >> "$BASHRC"
echo "Added musl cross compilers to $BASHRC"
echo "You should run 'source ~/.bashrc' to update your PATH"
else
echo "You should run 'source ~/.bashrc' to update your PATH"
fi
fi
fi
}
TOOLCHAIN_LIST=(
"aarch64-linux-musl-cross"
"x86_64-linux-musl-cross"
"x86_64-linux-musl-native"
)
for TOOLCHAIN in "${TOOLCHAIN_LIST[@]}"; do
install_musl_cross "$TOOLCHAIN"
check_path "$TOOLCHAIN"
done
# Clean up
rm -rf "$TMPDIR"
}
# ----------------------------------------------------------------------------------------------------------
# BUILD
# ----------------------------------------------------------------------------------------------------------
CMAKE_FILE="CMakeLists.txt"
function get_executable_name() {
EXECUTABLE_NAME=""
local target_name=""
while IFS= read -r line; do
if [[ "$line" =~ add_executable.* ]]; then
target_name=$(echo "$line" | sed 's/.*add_executable(\([^ ]*\).*/\1/' | tr -d ')')
EXECUTABLE_NAME=$target_name
elif [[ "$line" =~ set_target_properties.*OUTPUT_NAME.* ]]; then
local prop_target_name
prop_target_name=$(echo "$line" | sed 's/.*set_target_properties(\([^ ]*\).*/\1/' | tr -d ' ')
if [[ "$prop_target_name" == "$target_name" ]]; then
EXECUTABLE_NAME=$(echo "$line" | sed 's/.*OUTPUT_NAME \([^)]*\).*/\1/' | tr -d ')')
fi
fi
done < "${SOURCE_DIR}/${CMAKE_FILE}"
if [[ -z "$EXECUTABLE_NAME" ]]; then
echo "Executable name not found."
else
echo "Executable name: $EXECUTABLE_NAME"
fi
}
function build_arch() {
local ARCH="$1"
local PREVDIR="$PWD"
local JOBS;
JOBS=$(nproc) # Set JOBS to the number of available CPU cores
cd "${SOURCE_DIR}" || exit 1
local ARCH_BUILD_DIR=${BUILD_DIR}/${ARCH}
mkdir -p "${ARCH_BUILD_DIR}"
echo "Building for ${ARCH} in ${ARCH_BUILD_DIR}, from ${SOURCE_DIR}"
if [ ! -f "${HOME}/.musl-cross/${ARCH}-linux-musl-cross/bin/${ARCH}-linux-musl-g++" ]; then
installmusl
fi
CMAKE_BUILD_TYPE="Release"
if [ "$RELEASE" -eq 0 ]; then
CMAKE_BUILD_TYPE="Debug"
fi
CC="${HOME}/.musl-cross/${ARCH}-linux-musl-cross/bin/${ARCH}-linux-musl-gcc"
CXX="${HOME}/.musl-cross/${ARCH}-linux-musl-cross/bin/${ARCH}-linux-musl-g++"
cmake -B "${ARCH_BUILD_DIR}" -G Ninja \
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_LINKER=mold \
-DCMAKE_C_COMPILER="${CC}" \
-DCMAKE_CXX_COMPILER="${CXX}"
cd "${ARCH_BUILD_DIR}" || exit 1
ninja -j"${JOBS}"
upx "${ARCH_BUILD_DIR}/${EXECUTABLE_NAME}"
mkdir -p "${OUTPUT_DIR}/${ARCH}"
cp "${ARCH_BUILD_DIR}/${EXECUTABLE_NAME}" "${OUTPUT_DIR}/${EXECUTABLE_NAME}.${ARCH}"
cd "${PREVDIR}" || exit 1
}
function build() {
if [ -z "$1" ]; then
help
echo " "
echo "Error: DIR is required"
exit 1
fi
echo "Building project in directory $1"
if [ ! -d "$1" ]; then
echo "Directory $1 does not exist"
exit 1
fi
# remove trailing slash from SOURCE_DIR
SOURCE_DIR="$1"
SOURCE_DIR=$(echo "$SOURCE_DIR" | sed 's:/*$::')
# make SOURCE_DIR absolute
SOURCE_DIR=$(realpath "$SOURCE_DIR")
BUILD_DIR="${SOURCE_DIR}/build"
OUTPUT_DIR="${SOURCE_DIR}/output"
if [ ! -f "${SOURCE_DIR}/${CMAKE_FILE}" ]; then
echo "${CMAKE_FILE} not found in ${SOURCE_DIR}"
exit 1
fi
get_executable_name
# if have the -m option, then build for multiple architectures
if [ $MULTIBUILD -eq 1 ]; then
for arch in "${ARCHS[@]}"; do
build_arch "$arch"
done
else
build_arch "$HOSTARCH"
fi
}
# ----------------------------------------------------------------------------------------------------------
# MAIN
# ----------------------------------------------------------------------------------------------------------
function main() {
while getopts "rm" opt; do
case $opt in
r)
RELEASE=1
;;
m)
MULTIBUILD=1
;;
*)
help
exit 1
;;
esac
done
# Shift the processed options out of the argument list
shift $((OPTIND-1))
# get command argument, now that the flags are set
CMD="$1"
if [ -z "$CMD" ]; then
help
exit 1
fi
case "$CMD" in
version)
version
;;
*)
build "$1"
;;
esac
}
main "$@"

17
dropshell-build/install_host.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
set -euo pipefail
sudo apt install -y nlohmann-json3-dev wget curl cmake ninja-build mold
if [ ! -f /usr/local/lib/libassert.a ]; then
git clone https://github.com/jeremy-rifkin/libassert.git
git checkout v2.1.5
mkdir libassert/build
cd "libassert/build" || exit 1
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j
sudo make install
cd ../..
rm -rf libassert
fi

View File

@ -0,0 +1,4 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by ccache.
# For information about cache directory tags, see:
# http://www.brynosaurus.com/cachedir/

View File

@ -0,0 +1,82 @@
0
0
0
0
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3
0
6
0
0
0
0
0
0
6
0
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

View File

@ -0,0 +1,82 @@
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

View File

@ -0,0 +1,82 @@
0
0
0
0
0
0
0
0
0
0
0
1
16
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
16
0
0
0
0

View File

@ -0,0 +1,82 @@
0
0
0
0
0
0
0
0
0
0
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

View File

@ -0,0 +1,82 @@
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

View File

@ -0,0 +1,82 @@
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
2
0
0
0
0
0
0
2
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

View File

@ -0,0 +1,82 @@
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

View File

@ -0,0 +1,4 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by ccache.
# For information about cache directory tags, see:
# http://www.brynosaurus.com/cachedir/

View File

@ -0,0 +1,82 @@
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
2
0
0
0
0
0
0
2
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

View File

@ -0,0 +1,82 @@
0
0
0
0
0
0
0
0
0
0
0
1
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0
0

View File

@ -0,0 +1,82 @@
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

View File

@ -0,0 +1,82 @@
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
2
0
0
0
0
0
0
2
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

View File

@ -0,0 +1,82 @@
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

View File

@ -0,0 +1,4 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by ccache.
# For information about cache directory tags, see:
# http://www.brynosaurus.com/cachedir/

View File

@ -0,0 +1,82 @@
0
0
0
0
0
0
0
0
0
0
0
2
472
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
236
0
0
0
0
0
0
0
0
0
0
236
0
0
0
0
0

View File

@ -0,0 +1,4 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by ccache.
# For information about cache directory tags, see:
# http://www.brynosaurus.com/cachedir/

View File

@ -0,0 +1,82 @@
0
0
0
0
0
0
0
0
0
0
0
2
8
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
4
0
0
0
0
0
0
0
0
0
0
4
0
0
0
0

View File

@ -0,0 +1,4 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by ccache.
# For information about cache directory tags, see:
# http://www.brynosaurus.com/cachedir/

View File

@ -0,0 +1,82 @@
0
0
0
0
0
0
0
0
0
0
0
1
16
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
16
0
0
0
0
0
0

View File

@ -0,0 +1,4 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by ccache.
# For information about cache directory tags, see:
# http://www.brynosaurus.com/cachedir/

View File

@ -0,0 +1,82 @@
0
0
0
0
0
0
0
0
0
0
0
2
20
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
16
0
0
0
0
0
0
0

View File

@ -0,0 +1,4 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by ccache.
# For information about cache directory tags, see:
# http://www.brynosaurus.com/cachedir/

View File

@ -0,0 +1,82 @@
0
0
0
0
0
0
0
0
0
0
0
1
236
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
236
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

View File

@ -0,0 +1,4 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by ccache.
# For information about cache directory tags, see:
# http://www.brynosaurus.com/cachedir/

View File

@ -0,0 +1,82 @@
0
0
0
0
0
0
0
0
0
0
0
1
16
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
16
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

View File

@ -0,0 +1,4 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by ccache.
# For information about cache directory tags, see:
# http://www.brynosaurus.com/cachedir/

View File

@ -0,0 +1,82 @@
0
0
0
0
0
0
0
0
0
0
0
1
236
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
236
0
0
0
0
0
0
0
0
0
0
0
0

Binary file not shown.

View File

@ -0,0 +1,108 @@
cmake_minimum_required(VERSION 3.10)
project(ipdemo VERSION 1.0.0 LANGUAGES CXX)
# Force static linking globally
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE)
set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
set(ZLIB_USE_STATIC_LIBS "ON")
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_C_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set default build type to Release if not specified
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
endif()
# Configure build-specific compiler flags
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
# Configure version information
string(TIMESTAMP CURRENT_YEAR "%Y")
string(TIMESTAMP CURRENT_MONTH "%m")
string(TIMESTAMP CURRENT_DAY "%d")
string(TIMESTAMP CURRENT_HOUR "%H")
string(TIMESTAMP CURRENT_MINUTE "%M")
set(PROJECT_VERSION "${CURRENT_YEAR}.${CURRENT_MONTH}${CURRENT_DAY}.${CURRENT_HOUR}${CURRENT_MINUTE}")
string(TIMESTAMP RELEASE_DATE "%Y-%m-%d")
# Configure version.hpp file
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/src/version.hpp.in"
"${CMAKE_CURRENT_BINARY_DIR}/src/autogen/version.hpp"
@ONLY
)
# Set CMAKE_MODULE_PATH to include our custom find modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Auto-detect source files
file(GLOB_RECURSE SOURCES "src/*.cpp")
file(GLOB_RECURSE HEADERS "src/*.hpp")
# Add custom target to run cmake_prebuild.sh at the start of the build process
add_custom_target(run_prebuild_script ALL
COMMAND ${CMAKE_COMMAND} -E echo "Running cmake_prebuild.sh..."
COMMAND ${CMAKE_COMMAND} -E env bash ${CMAKE_CURRENT_SOURCE_DIR}/cmake_prebuild.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
# Add executable
add_executable(ipdemo ${SOURCES})
add_dependencies(ipdemo run_prebuild_script)
# Set include directories
# build dir goes first so that we can use the generated version.hpp
target_include_directories(ipdemo PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src/autogen>
${CMAKE_CURRENT_SOURCE_DIR}/src
)
# Configure libassert
include(FetchContent)
FetchContent_Declare(
libassert
GIT_REPOSITORY https://github.com/jeremy-rifkin/libassert.git
GIT_TAG v2.1.5
)
FetchContent_MakeAvailable(libassert)
# Add cpptrace
FetchContent_Declare(
cpptrace
GIT_REPOSITORY https://github.com/jeremy-rifkin/cpptrace.git
GIT_TAG v0.8.3
)
FetchContent_MakeAvailable(cpptrace)
# Add nlohmann/json
FetchContent_Declare(
nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.11.3
)
FetchContent_MakeAvailable(nlohmann_json)
# Link libraries
target_link_libraries(ipdemo PRIVATE
libassert::assert
cpptrace::cpptrace
nlohmann_json::nlohmann_json
)
# Set static linking flags
set_target_properties(ipdemo PROPERTIES
LINK_FLAGS "-static"
)
# Install targets
install(TARGETS ipdemo
RUNTIME DESTINATION $ENV{HOME}/.local/bin
)

View File

@ -0,0 +1,3 @@
#!/bin/bash
echo "cmake_prebuild.sh complete."

View File

@ -0,0 +1,21 @@
#pragma once
/*
version.hpp is automatically generated by the build system, from version.hpp.in.
DO NOT EDIT VERSION.HPP!
*/
#include <string>
namespace dropshell {
// Version information
const std::string VERSION = "@PROJECT_VERSION@";
const std::string RELEASE_DATE = "@RELEASE_DATE@";
const std::string AUTHOR = "j842";
const std::string LICENSE = "MIT";
} // namespace dropshell

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
#include <iostream>
#include <nlohmann/json.hpp>
#include <libassert/assert.hpp>
#include "httplib.hpp"
#include "version.hpp"
int main() {
std::cout << "Retrieving IP address..." << std::endl;
httplib::Client cli("http://ipinfo.io");
auto res = cli.Get("/ip");
ASSERT(res->status == 200, "Failed to get IP");
nlohmann::json j;
j["ip"] = res->body;
j["status"] = res->status;
std::cout << j.dump(4) << std::endl;
std::cout << "Done" << std::endl;
return 0;
}

View File

@ -0,0 +1,21 @@
#pragma once
/*
version.hpp is automatically generated by the build system, from version.hpp.in.
DO NOT EDIT VERSION.HPP!
*/
#include <string>
namespace dropshell {
// Version information
const std::string VERSION = "@PROJECT_VERSION@";
const std::string RELEASE_DATE = "@RELEASE_DATE@";
const std::string AUTHOR = "j842";
const std::string LICENSE = "MIT";
} // namespace dropshell