CI update and DPPAsExternalProject improvements

This commit is contained in:
Syping 2024-03-11 03:24:01 +01:00
parent 92d9aba8d0
commit 0dfb2cebe9
2 changed files with 22 additions and 14 deletions

View file

@ -23,14 +23,20 @@ jobs:
- name: Cloning
uses: actions/checkout@v4
- name: Configure CMake
run: cmake -B ./build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_EXE_LINKER_FLAGS="-static -lc++" -DWITH_DPP_AS_EXTERNAL_PROJECT=TRUE -GNinja
- name: Build
run: cmake --build ./build --config ${{env.BUILD_TYPE}}
run: cmake -B dtranslatebot-build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_EXE_LINKER_FLAGS="-static -lc++" -DWITH_DPP_AS_EXTERNAL_PROJECT=TRUE -GNinja
- name: Download and build OpenSSL
run: cmake --build dtranslatebot-build --config ${{env.BUILD_TYPE}} --target OpenSSL
- name: Download and build zlib
run: cmake --build dtranslatebot-build --config ${{env.BUILD_TYPE}} --target ZLIB
- name: Download and build DPP
run: cmake --build dtranslatebot-build --config ${{env.BUILD_TYPE}} --target DPP
- name: Build dtranslatebot
run: cmake --build dtranslatebot-build --config ${{env.BUILD_TYPE}}
- name: Install
run: cmake --install ./build --config ${{env.BUILD_TYPE}} --prefix ./install --strip
run: cmake --install dtranslatebot-build --config ${{env.BUILD_TYPE}} --prefix dtranslatebot-install --strip
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Windows
path: |
./install/bin/
dtranslatebot-install/bin/dtranslatebot.exe

View file

@ -32,7 +32,7 @@ if (DEFINED NPROC_EXECUTABLE)
OUTPUT_VARIABLE NPROC
)
string(STRIP "${NPROC}" NPROC)
set(JOBS_ARGUMENT "-j${NPROC}" CACHE INTERNAL "make jobs argument")
set(MAKE_JOBS_ARG "-j${NPROC}")
endif()
include(ExternalProject)
@ -41,13 +41,15 @@ ExternalProject_Add(ZLIB
URL_HASH SHA256=38ef96b8dfe510d42707d9c781877914792541133e1870841463bfa73f883e32
CMAKE_ARGS
-DBUILD_SHARED_LIBS=OFF
"${CMAKE_PASSTHROUGH_ARGS}"
${CMAKE_PASSTHROUGH_ARGS}
"-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>"
-DZLIB_BUILD_EXAMPLES=OFF
${ZLIB_CONFIGURE_ARGS}
)
ExternalProject_Get_Property(ZLIB INSTALL_DIR)
set(ZLIB_INSTALL_DIR "${INSTALL_DIR}")
set(OPENSSL_PLATFORM_ARG $<$<BOOL:$ENV{MSYSTEM}>:mingw64>)
ExternalProject_Add(OpenSSL
URL https://www.openssl.org/source/openssl-3.0.13.tar.gz
URL_HASH SHA256=88525753f79d3bec27d2fa7c66aa0b92b3aa9498dafd93d7cfa4b3780cdae313
@ -63,8 +65,10 @@ ExternalProject_Add(OpenSSL
no-engine
no-shared
no-zlib
BUILD_COMMAND "${MAKE_EXECUTABLE}" "${JOBS_ARGUMENT}"
INSTALL_COMMAND "${MAKE_EXECUTABLE}" "${JOBS_ARGUMENT}" install_sw
${OPENSSL_PLATFORM_ARG}
${OPENSSL_CONFIGURE_ARGS}
BUILD_COMMAND "${MAKE_EXECUTABLE}" ${MAKE_JOBS_ARG} build_libs
INSTALL_COMMAND "${MAKE_EXECUTABLE}" ${MAKE_JOBS_ARG} install_dev
)
ExternalProject_Get_Property(OpenSSL INSTALL_DIR)
set(OpenSSL_INSTALL_DIR "${INSTALL_DIR}")
@ -75,15 +79,15 @@ ExternalProject_Add(DPP
CMAKE_ARGS
-DBUILD_SHARED_LIBS=OFF
-DBUILD_VOICE_SUPPORT=OFF
"${CMAKE_PASSTHROUGH_ARGS}"
${CMAKE_PASSTHROUGH_ARGS}
"-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>"
-DDPP_BUILD_TEST=OFF
-DDPP_NO_VCPKG=ON
-DRUN_LDCONFIG=OFF
"-DOpenSSL_ROOT=${OpenSSL_INSTALL_DIR}"
"-DZLIB_ROOT=${ZLIB_INSTALL_DIR}"
DEPENDS OpenSSL
DEPENDS ZLIB
${DPP_CONFIGURE_ARGS}
DEPENDS OpenSSL ZLIB
)
ExternalProject_Get_Property(DPP INSTALL_DIR)
set(DPP_INSTALL_DIR "${INSTALL_DIR}")
@ -106,7 +110,5 @@ if (WIN32)
set(DPP_DEFINITIONS DPP_STATIC)
list(APPEND DPP_LIBRARIES
ws2_32
gdi32
crypt32
)
endif()