This commit is contained in:
@@ -54,8 +54,13 @@ if docker buildx ls | grep -q "sos-builder"; then
|
||||
fi
|
||||
docker buildx create --name sos-builder --use
|
||||
|
||||
VERSION=$("${EXE_DIR}/simple_object_storage.amd64" version)
|
||||
|
||||
echo "Building multi-platform Docker image"
|
||||
docker buildx build --no-cache --push -t gitea.jde.nz/public/simple-object-storage:latest --platform linux/amd64,linux/arm64 .
|
||||
docker buildx build --no-cache --push \
|
||||
-t gitea.jde.nz/public/simple-object-storage:latest \
|
||||
-t "gitea.jde.nz/public/simple-object-storage:${VERSION}" \
|
||||
--platform linux/amd64,linux/arm64 .
|
||||
|
||||
echo "Build completed successfully!"
|
||||
|
||||
|
17
.vscode/c_cpp_properties.json
vendored
Normal file
17
.vscode/c_cpp_properties.json
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"${workspaceFolder}/source/build/src/autogen"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/g++",
|
||||
"cStandard": "c23",
|
||||
"cppStandard": "c++23",
|
||||
"intelliSenseMode": "linux-gcc-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
@@ -4,13 +4,29 @@ project(simple_object_storage)
|
||||
# Set the build type to Debug
|
||||
#set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type (e.g., Debug, Release)" FORCE)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Linking flags (removed -static)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
|
||||
# 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
|
||||
)
|
||||
|
||||
# Find all source files in src directory
|
||||
file(GLOB_RECURSE SOURCES
|
||||
"src/*.cpp"
|
||||
@@ -25,8 +41,10 @@ file(GLOB_RECURSE HEADERS
|
||||
|
||||
# Add include directories
|
||||
include_directories(
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src/autogen>
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/autogen
|
||||
)
|
||||
|
||||
# Create executable
|
||||
|
1
build.sh
1
build.sh
@@ -105,5 +105,6 @@ if [ "$BUILDSTR" = "all" ] || [ "$BUILDSTR" = "amd64" ]; then
|
||||
fi
|
||||
|
||||
echo "Build completed successfully!"
|
||||
"${EXE_DIR}/${PROJECTNAME}.amd64" version
|
||||
|
||||
cd "$OLD_DIR"
|
10
src/main.cpp
10
src/main.cpp
@@ -8,6 +8,8 @@
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
|
||||
#include "version.hpp"
|
||||
|
||||
namespace simple_object_storage {
|
||||
|
||||
std::atomic<bool> g_running{true};
|
||||
@@ -106,6 +108,14 @@ void signal_handler(int signal) {
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc > 1) {
|
||||
if (std::string(argv[1]) == "version") {
|
||||
std::cout << dropshell::VERSION << std::endl;
|
||||
return 0;
|
||||
}
|
||||
std::cout << "simple_object_storage version: " << dropshell::VERSION << std::endl;
|
||||
}
|
||||
|
||||
// Set up signal handlers
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = signal_handler;
|
||||
|
21
src/version.hpp.in
Normal file
21
src/version.hpp.in
Normal 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
|
Reference in New Issue
Block a user