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 - name: Cloning
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Configure CMake - 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 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: Build - name: Download and build OpenSSL
run: cmake --build ./build --config ${{env.BUILD_TYPE}} 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 - 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 - name: Upload
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: Windows name: Windows
path: | path: |
./install/bin/ dtranslatebot-install/bin/dtranslatebot.exe

View file

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