Add MBedTLS as a submodule

This commit is contained in:
anthony@rabine.fr 2025-02-03 08:23:02 +01:00
parent 44ba940b85
commit 5016cc365d
2 changed files with 35 additions and 6 deletions

3
.gitmodules vendored
View file

@ -13,3 +13,6 @@
[submodule "story-editor/externals/curl"]
path = story-editor/externals/curl
url = https://github.com/curl/curl
[submodule "story-editor/externals/mbedtls"]
path = story-editor/externals/mbedtls
url = https://github.com/Mbed-TLS/mbedtls/

View file

@ -58,12 +58,25 @@ add_subdirectory(externals/civetweb EXCLUDE_FROM_ALL)
include_directories(externals/civetweb/include)
# set(CURL_USE_OPENSSL OFF CACHE BOOL "Disable OpenSSL." FORCE)
# set(CURL_USE_MBEDTLS ON CACHE BOOL "Use MBED TLS." FORCE)
# set(MBEDTLS_INCLUDE_DIRS ${mbedtls_SOURCE_DIR}/include)
# set(MBEDTLS_LIBRARY ${mbedtls_BINARY_DIR}/libmbedtls.a)
# set(MBEDX509_LIBRARY ${mbedtls_BINARY_DIR}/libmbedx509.a)
# set(MBEDCRYPTO_LIBRARY ${mbedtls_BINARY_DIR}/libmbedcrypto.a)
# =========================================================================================================================
# MBEDTLS
# =========================================================================================================================
set(USE_STATIC_MBEDTLS_LIBRARY ON)
set(ENABLE_PROGRAMS OFF)
set(ENABLE_TESTING OFF)
add_subdirectory(externals/mbedtls EXCLUDE_FROM_ALL)
# =========================================================================================================================
# CURL
# =========================================================================================================================
set(CURL_USE_OPENSSL OFF CACHE BOOL "Disable OpenSSL." FORCE)
set(CURL_USE_MBEDTLS ON CACHE BOOL "Use MBED TLS." FORCE)
set(MBEDTLS_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/externals/mbedtls/include)
set(MBEDTLS_LIBRARY ${CMAKE_BINARY_DIR}/externals/mbedtls/library/libmbedtls.a)
set(MBEDX509_LIBRARY ${CMAKE_BINARY_DIR}/externals/mbedtls/library/libmbedx509.a)
set(MBEDCRYPTO_LIBRARY ${CMAKE_BINARY_DIR}/externals/mbedtls/library/libmbedcrypto.a)
set(CURL_USE_LIBSSH2 OFF CACHE BOOL "Disable SSH." FORCE)
set(CURL_USE_LIBPSL OFF CACHE BOOL "Disable PSL" FORCE) # PSL not working for cross builds (ie, mingw32), or needs to cross-build one
@ -71,6 +84,11 @@ set(BUILD_CURL_EXE FALSE)
set(BUILD_STATIC_LIBS TRUE)
add_subdirectory(externals/curl EXCLUDE_FROM_ALL)
# =========================================================================================================================
# SDL
# =========================================================================================================================
# Configure SDL by calling its CMake file.
# we use EXCLUDE_FROM_ALL so that its install targets and configs don't
# pollute upwards into our configuration.
@ -250,11 +268,16 @@ set(SDL_MIXER_BIN_DIR ${CMAKE_BINARY_DIR}/externals/SDL_mixer)
if(UNIX)
target_link_libraries(${STORY_EDITOR_PROJECT}
PUBLIC
SDL3_image::SDL3_image
SDL3_mixer::SDL3_mixer
SDL3::SDL3
CURL::libcurl
civetweb-cpp
MbedTLS::mbedtls
MbedTLS::mbedcrypto
MbedTLS::mbedx509
pthread
OpenGL::GL
dl
@ -268,6 +291,9 @@ elseif(WIN32)
civetweb-cpp
SDL3::SDL3
libcurl_static
MbedTLS::mbedtls
MbedTLS::tfpsacrypto
MbedTLS::mbedx509
ws2_32.lib psapi.lib setupapi.lib cfgmgr32.lib advapi32.lib
)
endif()