minor fixes for DPPAsExternalProject

This commit is contained in:
Syping 2024-03-02 22:22:05 +01:00
parent 820593ca2d
commit c21ed31889
3 changed files with 26 additions and 7 deletions

View file

@ -102,7 +102,7 @@ target_compile_definitions(dtranslatebot PRIVATE
if (MSVC AND MSVC_VERSION GREATER_EQUAL 1914) if (MSVC AND MSVC_VERSION GREATER_EQUAL 1914)
target_compile_options(dtranslatebot PRIVATE $<$<COMPILE_LANGUAGE:CXX>:/Zc:__cplusplus>) target_compile_options(dtranslatebot PRIVATE $<$<COMPILE_LANGUAGE:CXX>:/Zc:__cplusplus>)
endif() endif()
target_link_libraries(dtranslatebot PRIVATE Threads::Threads ${DPP_LIBRARIES} ${DTRANSLATEBOT_LIBRARIES}) target_link_libraries(dtranslatebot PRIVATE ${DPP_LIBRARIES} ${DTRANSLATEBOT_LIBRARIES} Threads::Threads)
target_include_directories(dtranslatebot PRIVATE ${DPP_INCLUDE_DIR}) target_include_directories(dtranslatebot PRIVATE ${DPP_INCLUDE_DIR})
set_target_properties(dtranslatebot PROPERTIES set_target_properties(dtranslatebot PROPERTIES
CXX_STANDARD 17 CXX_STANDARD 17

View file

@ -2,7 +2,7 @@
Open Source Discord Translation Bot Open Source Discord Translation Bot
- Translate incoming channel messages to a Webhook - Translate incoming channel messages to a Webhook
- Support configuration through slashcommands and JSON - Support configuration through slash commands and JSON
- Cross-Platform - Cross-Platform
#### Build Dependencies #### Build Dependencies
@ -24,4 +24,5 @@ sudo cmake --install dtranslatebot-build
##### Optional CMake flags ##### Optional CMake flags
`-DWITH_BOOST=TRUE` `-DWITH_BOOST=TRUE`
`-DWITH_DPP_AS_EXTERNAL_PROJECT=TRUE`
`-DWITH_SYSTEMD=TRUE` `-DWITH_SYSTEMD=TRUE`

View file

@ -16,7 +16,17 @@
* responsible for anything with use of the software, you are self responsible. * responsible for anything with use of the software, you are self responsible.
****************************************************************************]] ****************************************************************************]]
# OpenSSL needs to build with make # Needed for compiler passthrough
if (DEFINED CMAKE_C_COMPILER)
set(CC_ENV "CC=${CMAKE_C_COMPILER}")
set(DEFINE_CMAKE_C_COMPILER "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}")
endif()
if (DEFINED CMAKE_CXX_COMPILER)
set(DEFINE_CMAKE_CXX_COMPILER "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}")
endif()
# OpenSSL needs to be build with make
find_program(MAKE_EXECUTABLE NAMES make gmake) find_program(MAKE_EXECUTABLE NAMES make gmake)
if (NOT MAKE_EXECUTABLE) if (NOT MAKE_EXECUTABLE)
message(SEND_ERROR "make not found") message(SEND_ERROR "make not found")
@ -36,9 +46,10 @@ include(ExternalProject)
ExternalProject_Add(ZLIB ExternalProject_Add(ZLIB
URL https://www.zlib.net/zlib-1.3.1.tar.xz URL https://www.zlib.net/zlib-1.3.1.tar.xz
URL_HASH SHA256=38ef96b8dfe510d42707d9c781877914792541133e1870841463bfa73f883e32 URL_HASH SHA256=38ef96b8dfe510d42707d9c781877914792541133e1870841463bfa73f883e32
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
CMAKE_ARGS CMAKE_ARGS
-DBUILD_SHARED_LIBS=OFF -DBUILD_SHARED_LIBS=OFF
"-DCMAKE_BUILD_TYPE=$<CONFIG>"
"${DEFINE_CMAKE_C_COMPILER}"
"-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>" "-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>"
-DZLIB_BUILD_EXAMPLES=OFF -DZLIB_BUILD_EXAMPLES=OFF
) )
@ -48,12 +59,15 @@ set(ZLIB_INSTALL_DIR "${INSTALL_DIR}")
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
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
CONFIGURE_COMMAND CONFIGURE_COMMAND
"${CC_ENV}"
"<SOURCE_DIR>/config" "<SOURCE_DIR>/config"
"--prefix=<INSTALL_DIR>" "--prefix=<INSTALL_DIR>"
$<$<CONFIG:Debug>:-d>
no-deprecated no-deprecated
no-dtls no-dtls
no-dso
no-engine
no-shared no-shared
no-zlib no-zlib
BUILD_COMMAND ${MAKE_EXECUTABLE} ${JOBS_ARGUMENT} BUILD_COMMAND ${MAKE_EXECUTABLE} ${JOBS_ARGUMENT}
@ -63,11 +77,13 @@ ExternalProject_Get_Property(OpenSSL INSTALL_DIR)
set(OpenSSL_INSTALL_DIR "${INSTALL_DIR}") set(OpenSSL_INSTALL_DIR "${INSTALL_DIR}")
ExternalProject_Add(DPP ExternalProject_Add(DPP
GIT_REPOSITORY https://github.com/Syping/DPP.git URL https://github.com/Syping/DPP/archive/dcd00001dfa145a03f80a0ad5317bc3e63252ead.tar.gz
GIT_TAG dcd00001dfa145a03f80a0ad5317bc3e63252ead URL_HASH SHA256=42ff04b13a384591e819c100c4f40e12e31c8076769c168631eef85a8eeb0be3
CMAKE_ARGS CMAKE_ARGS
-DBUILD_SHARED_LIBS=OFF -DBUILD_SHARED_LIBS=OFF
-DBUILD_VOICE_SUPPORT=OFF -DBUILD_VOICE_SUPPORT=OFF
"-DCMAKE_BUILD_TYPE=$<CONFIG>"
"${DEFINE_CMAKE_CXX_COMPILER}"
"-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>" "-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>"
-DDPP_NO_VCPKG=ON -DDPP_NO_VCPKG=ON
-DRUN_LDCONFIG=OFF -DRUN_LDCONFIG=OFF
@ -80,6 +96,7 @@ ExternalProject_Get_Property(DPP INSTALL_DIR)
set(DPP_INSTALL_DIR "${INSTALL_DIR}") set(DPP_INSTALL_DIR "${INSTALL_DIR}")
set(DPP_INCLUDE_DIR "${DPP_INSTALL_DIR}/include") set(DPP_INCLUDE_DIR "${DPP_INSTALL_DIR}/include")
set(DPP_LIBRARIES set(DPP_LIBRARIES
-Wl,-Bstatic
"-L${DPP_INSTALL_DIR}/lib" "-L${DPP_INSTALL_DIR}/lib"
"-L${DPP_INSTALL_DIR}/lib64" "-L${DPP_INSTALL_DIR}/lib64"
-ldpp -ldpp
@ -90,4 +107,5 @@ set(DPP_LIBRARIES
"-L${ZLIB_INSTALL_DIR}/lib" "-L${ZLIB_INSTALL_DIR}/lib"
"-L${ZLIB_INSTALL_DIR}/lib64" "-L${ZLIB_INSTALL_DIR}/lib64"
-lz -lz
-Wl,-Bdynamic
) )