This commit is contained in:
@@ -53,6 +53,23 @@ target_include_directories(${PROJECT_NAME} PRIVATE
|
|||||||
# Find packages
|
# Find packages
|
||||||
set(CMAKE_PREFIX_PATH /usr/local)
|
set(CMAKE_PREFIX_PATH /usr/local)
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
|
|
||||||
|
# Create OpenSSL targets if they don't exist (for cross-compilation)
|
||||||
|
if(NOT TARGET OpenSSL::SSL)
|
||||||
|
add_library(OpenSSL::SSL STATIC IMPORTED)
|
||||||
|
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||||
|
IMPORTED_LOCATION "/usr/local/lib64/libssl.a"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "/usr/local/include"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
if(NOT TARGET OpenSSL::Crypto)
|
||||||
|
add_library(OpenSSL::Crypto STATIC IMPORTED)
|
||||||
|
set_target_properties(OpenSSL::Crypto PROPERTIES
|
||||||
|
IMPORTED_LOCATION "/usr/local/lib64/libcrypto.a"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "/usr/local/include"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(Drogon CONFIG REQUIRED)
|
find_package(Drogon CONFIG REQUIRED)
|
||||||
find_package(nlohmann_json REQUIRED)
|
find_package(nlohmann_json REQUIRED)
|
||||||
|
|
||||||
|
@@ -9,8 +9,7 @@ WORKDIR /app
|
|||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Configure and build with ccache
|
# Configure and build with ccache
|
||||||
RUN --mount=type=cache,target=/build \
|
RUN mkdir -p /build && \
|
||||||
mkdir -p /build && \
|
|
||||||
cmake -G Ninja -S /app -B /build \
|
cmake -G Ninja -S /app -B /build \
|
||||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
|
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
|
||||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||||
@@ -25,16 +24,19 @@ RUN --mount=type=cache,target=/build \
|
|||||||
-DPROJECT_NAME="${PROJECT}" \
|
-DPROJECT_NAME="${PROJECT}" \
|
||||||
-DCMAKE_STRIP=OFF \
|
-DCMAKE_STRIP=OFF \
|
||||||
-DIGNORE_DYNAMIC_LOADING=ON \
|
-DIGNORE_DYNAMIC_LOADING=ON \
|
||||||
|
-DOPENSSL_ROOT_DIR=/usr/local \
|
||||||
|
-DOPENSSL_LIBRARIES="/usr/local/lib64/libssl.a;/usr/local/lib64/libcrypto.a" \
|
||||||
|
-DOPENSSL_INCLUDE_DIR=/usr/local/include \
|
||||||
${CMAKE_TOOLCHAIN_FILE:+-DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE}
|
${CMAKE_TOOLCHAIN_FILE:+-DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE}
|
||||||
|
|
||||||
|
|
||||||
# Explicitly build dependencies first (cached separately)
|
# Explicitly build dependencies first
|
||||||
RUN --mount=type=cache,target=/build cmake --build /build --target run_prebuild_script
|
RUN cmake --build /build --target run_prebuild_script
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/build cmake --build /build
|
RUN cmake --build /build
|
||||||
|
|
||||||
# Copy the built executable to a regular directory for the final stage
|
# Copy the built executable to a regular directory for the final stage
|
||||||
RUN --mount=type=cache,target=/build mkdir -p /output && \
|
RUN mkdir -p /output && \
|
||||||
find /build -type f -executable -name "*${PROJECT}*" -exec cp {} /output/${PROJECT} \; || \
|
find /build -type f -executable -name "*${PROJECT}*" -exec cp {} /output/${PROJECT} \; || \
|
||||||
find /build -type f -executable -exec cp {} /output/${PROJECT} \;
|
find /build -type f -executable -exec cp {} /output/${PROJECT} \;
|
||||||
|
|
||||||
|
@@ -53,5 +53,6 @@ mkdir -p "${SCRIPT_DIR}/output"
|
|||||||
|
|
||||||
build "linux/amd64"
|
build "linux/amd64"
|
||||||
build "linux/arm64"
|
build "linux/arm64"
|
||||||
build "windows/amd64"
|
# Temporarily disabled - Windows cross-compilation needs different approach
|
||||||
|
# build "windows/amd64"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user