Working with HTTPS
This commit is contained in:
1 parent
423d8b8f52
commit
28fb81ad45
7 files changed
+409
-58
No files matched your search
+103
-1
@@ -725,4 +725,106 @@ set_target_properties(SDL2_mixer_external_lib PROPERTIES
|
||||
"$<IF:$<CONFIG:Debug>,${SDL2MIXER_BASE_DIR}-Debug/include,${SDL2MIXER_BASE_DIR}-Release/include>"
|
||||
INTERFACE_LINK_LIBRARIES
|
||||
"SDL2_external_lib"
|
||||
)
|
||||
)
|
||||
# ===========================================
|
||||
# 12) OpenSSL (3.4.1) - TLS for wss:// (Windows only, static libs)
|
||||
# ===========================================
|
||||
if(WIN32)
|
||||
set(OPENSSL_SRC_DIR "${THIRDPARTY_DIR}/openssl-3.4.1")
|
||||
set(OPENSSL_BASE_DIR "${OPENSSL_SRC_DIR}/install")
|
||||
|
||||
set(_have_openssl TRUE)
|
||||
foreach(cfg IN LISTS BUILD_CONFIGS)
|
||||
if(NOT EXISTS "${OPENSSL_BASE_DIR}-${cfg}/lib/libssl.lib" OR
|
||||
NOT EXISTS "${OPENSSL_BASE_DIR}-${cfg}/lib/libcrypto.lib")
|
||||
set(_have_openssl FALSE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT _have_openssl)
|
||||
# Locate Visual Studio's vcvarsall.bat (provides cl, link, nmake).
|
||||
set(_vswhere "$ENV{ProgramFiles\(x86\)}/Microsoft Visual Studio/Installer/vswhere.exe")
|
||||
set(_vcvarsall "")
|
||||
if(EXISTS "${_vswhere}")
|
||||
execute_process(
|
||||
COMMAND "${_vswhere}" -latest -products * -property installationPath
|
||||
OUTPUT_VARIABLE _vs_path
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(_vs_path AND EXISTS "${_vs_path}/VC/Auxiliary/Build/vcvarsall.bat")
|
||||
set(_vcvarsall "${_vs_path}/VC/Auxiliary/Build/vcvarsall.bat")
|
||||
endif()
|
||||
endif()
|
||||
if(_vcvarsall STREQUAL "")
|
||||
message(FATAL_ERROR "Visual Studio (vcvarsall.bat) not found; it is required to build OpenSSL")
|
||||
endif()
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_ossl_vc_arch x64)
|
||||
set(_ossl_target VC-WIN64A)
|
||||
else()
|
||||
set(_ossl_vc_arch x86)
|
||||
set(_ossl_target VC-WIN32)
|
||||
endif()
|
||||
|
||||
file(TO_NATIVE_PATH "${_vcvarsall}" _vcvarsall_native)
|
||||
file(TO_NATIVE_PATH "${STRAWBERRY_PERL_DIR}/perl/bin" _perl_bin_native)
|
||||
file(TO_NATIVE_PATH "${STRAWBERRY_PERL_DIR}/perl/site/bin" _perl_site_native)
|
||||
|
||||
foreach(cfg IN LISTS BUILD_CONFIGS)
|
||||
set(_ossl_build "${OPENSSL_SRC_DIR}/build-${cfg}")
|
||||
file(REMOVE_RECURSE "${_ossl_build}")
|
||||
file(MAKE_DIRECTORY "${_ossl_build}")
|
||||
file(TO_NATIVE_PATH "${_ossl_build}" _ossl_build_native)
|
||||
file(TO_NATIVE_PATH "${OPENSSL_SRC_DIR}/Configure" _ossl_configure_native)
|
||||
file(TO_NATIVE_PATH "${OPENSSL_BASE_DIR}-${cfg}" _ossl_prefix_native)
|
||||
|
||||
set(_ossl_cfg_flags "")
|
||||
if(cfg STREQUAL "Debug")
|
||||
# /MDd: link the dynamic debug CRT like the game (static libs default to /MTd)
|
||||
set(_ossl_cfg_flags "--debug /MDd")
|
||||
else()
|
||||
set(_ossl_cfg_flags "--release /MD")
|
||||
endif()
|
||||
|
||||
# A batch file avoids cmd.exe quoting problems.
|
||||
set(_ossl_bat "${_ossl_build}/build_openssl.bat")
|
||||
file(WRITE "${_ossl_bat}"
|
||||
"@echo off
|
||||
call \"${_vcvarsall_native}\" ${_ossl_vc_arch} || exit /b 1
|
||||
set \"PATH=${_perl_bin_native};${_perl_site_native};%PATH%\"
|
||||
set CL=/MP
|
||||
cd /d \"${_ossl_build_native}\" || exit /b 1
|
||||
perl \"${_ossl_configure_native}\" ${_ossl_target} no-shared no-asm no-tests no-docs ${_ossl_cfg_flags} --prefix=\"${_ossl_prefix_native}\" --openssldir=\"${_ossl_prefix_native}/ssl\" || exit /b 1
|
||||
nmake || exit /b 1
|
||||
nmake install_sw || exit /b 1
|
||||
")
|
||||
log("Building OpenSSL (${cfg}) - this takes several minutes ...")
|
||||
execute_process(
|
||||
COMMAND cmd /c "${_ossl_bat}"
|
||||
RESULT_VARIABLE _ossl_res
|
||||
)
|
||||
if(NOT _ossl_res EQUAL 0)
|
||||
message(FATAL_ERROR "OpenSSL build failed for ${cfg} (see output above)")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
add_library(openssl_crypto_external_lib UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(openssl_crypto_external_lib PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${OPENSSL_BASE_DIR}-Debug/lib/libcrypto.lib"
|
||||
IMPORTED_LOCATION_RELEASE "${OPENSSL_BASE_DIR}-Release/lib/libcrypto.lib"
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"$<IF:$<CONFIG:Debug>,${OPENSSL_BASE_DIR}-Debug/include,${OPENSSL_BASE_DIR}-Release/include>"
|
||||
INTERFACE_LINK_LIBRARIES "ws2_32;crypt32;advapi32;user32;gdi32"
|
||||
)
|
||||
|
||||
add_library(openssl_ssl_external_lib UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(openssl_ssl_external_lib PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${OPENSSL_BASE_DIR}-Debug/lib/libssl.lib"
|
||||
IMPORTED_LOCATION_RELEASE "${OPENSSL_BASE_DIR}-Release/lib/libssl.lib"
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"$<IF:$<CONFIG:Debug>,${OPENSSL_BASE_DIR}-Debug/include,${OPENSSL_BASE_DIR}-Release/include>"
|
||||
INTERFACE_LINK_LIBRARIES "openssl_crypto_external_lib"
|
||||
)
|
||||
endif()
|
||||
Reference in new issue
Block a user