fix version build step
Some checks failed
Docker Build & Publish / build (push) Failing after 1h39m43s

This commit is contained in:
Nicholas Orlowsky 2025-02-24 21:34:54 -05:00
parent 0fc8400066
commit efd19d3bba
3 changed files with 14 additions and 19 deletions

View file

@ -2,16 +2,19 @@ cmake_minimum_required(VERSION 3.10)
project(anthracite) project(anthracite)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS_RELEASE "-O3") set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
add_custom_target(build-version configure_file(build_supp/version.txt version.txt COPYONLY)
COMMAND cd ../build_supp && ./version.sh
DEPENDS build_supp/version.txt add_custom_command(
COMMAND ../build_supp/version.sh
DEPENDS version.txt
OUTPUT ${CMAKE_BINARY_DIR}/version.cpp
COMMENT "Generated supplemental build files (version)" COMMENT "Generated supplemental build files (version)"
) )
@ -19,19 +22,13 @@ add_custom_target(build-supplemental
COMMAND cd ../build_supp && python3 ./error_gen.py COMMAND cd ../build_supp && python3 ./error_gen.py
COMMAND mkdir -p www && cp -r ../default_www/regular/* ./www/ COMMAND mkdir -p www && cp -r ../default_www/regular/* ./www/
COMMAND cp ../build_supp/default_config.cfg ./anthracite.cfg COMMAND cp ../build_supp/default_config.cfg ./anthracite.cfg
DEPENDS build_supp/version.txt ../default_www/regular/* build_supp/error_gen.py build-version DEPENDS ../default_www/regular/* build_supp/error_gen.py ${CMAKE_BINARY_DIR}/version.cpp
COMMENT "Generated supplemental build files (default www dir + default config + error pages)" COMMENT "Generated supplemental build files (default www dir + default config + error pages)"
) )
add_custom_target(run FILE(GLOB LIB_SOURCES lib/*.cpp lib/**/*.cpp)
COMMAND anthracite-bin add_library(anthracite ${LIB_SOURCES} ${CMAKE_BINARY_DIR}/version.cpp)
DEPENDS anthracite-bin add_dependencies(anthracite build-supplemental)
WORKING_DIRECTORY ${CMAKE_PROJECT_DIR}
)
FILE(GLOB LIB_SOURCES lib/*.cpp lib/**/*.cpp build_supp/version.cpp)
add_library(anthracite ${LIB_SOURCES})
add_dependencies(anthracite build-version)
target_link_libraries(anthracite OpenSSL::SSL OpenSSL::Crypto) target_link_libraries(anthracite OpenSSL::SSL OpenSSL::Crypto)
target_include_directories(anthracite PUBLIC ${OPENSSL_INCLUDE_DIR}) target_include_directories(anthracite PUBLIC ${OPENSSL_INCLUDE_DIR})

View file

@ -1,4 +1,4 @@
FROM alpine as build-env FROM alpine AS build-env
RUN apk add --no-cache build-base python3 cmake openssl-dev RUN apk add --no-cache build-base python3 cmake openssl-dev
COPY ./src ./src COPY ./src ./src

View file

@ -3,10 +3,8 @@
#include "../lib/socket/openssl_socket.hpp" #include "../lib/socket/openssl_socket.hpp"
#include "../lib/socket/socket.hpp" #include "../lib/socket/socket.hpp"
#include "../lib/thread_mgr/event_loop.hpp" #include "../lib/thread_mgr/event_loop.hpp"
#include "../lib/version.hpp" #include "signal.h"
#include "getopt.h" #include "getopt.h"
#include "string.h"
#include "sys/signal.h"
#include <fstream> #include <fstream>
#include <memory> #include <memory>
#include <optional> #include <optional>
@ -251,7 +249,7 @@ int main(int argc, char* argv[])
while ((c = getopt_long(argc, argv, "hc:", options, &opt_index)) != -1) { while ((c = getopt_long(argc, argv, "hc:", options, &opt_index)) != -1) {
switch (c) { switch (c) {
case 'h': { case 'h': {
std::cerr << "Anthracite " << ANTHRACITE_VERSION_STRING << " Help" << std::endl; std::cerr << "Anthracite Help" << std::endl;
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "-h, --help Prints this help menu " << std::endl; std::cerr << "-h, --help Prints this help menu " << std::endl;
std::cerr << std::endl; std::cerr << std::endl;