mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-07-01 07:05:44 +02:00
[externals] allow OpenSSL to be built
Signed-off-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
feb8c5f88e
commit
e0d992cf1a
6 changed files with 125 additions and 19 deletions
|
|
@ -66,6 +66,10 @@ if (YUZU_STATIC_ROOM)
|
||||||
set(fmt_FORCE_BUNDLED ON)
|
set(fmt_FORCE_BUNDLED ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (YUZU_USE_EXTERNAL_OPENSSL)
|
||||||
|
set(httplib_FORCE_BUNDLED ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
# qt stuff
|
# qt stuff
|
||||||
option(ENABLE_QT "Enable the Qt frontend" ON)
|
option(ENABLE_QT "Enable the Qt frontend" ON)
|
||||||
option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF)
|
option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF)
|
||||||
|
|
@ -207,6 +211,10 @@ endif()
|
||||||
option(YUZU_USE_BUNDLED_FFMPEG "Download bundled FFmpeg" ${EXT_DEFAULT})
|
option(YUZU_USE_BUNDLED_FFMPEG "Download bundled FFmpeg" ${EXT_DEFAULT})
|
||||||
cmake_dependent_option(YUZU_USE_EXTERNAL_FFMPEG "Build FFmpeg from external source" "${PLATFORM_SUN}" "NOT WIN32 AND NOT ANDROID" OFF)
|
cmake_dependent_option(YUZU_USE_EXTERNAL_FFMPEG "Build FFmpeg from external source" "${PLATFORM_SUN}" "NOT WIN32 AND NOT ANDROID" OFF)
|
||||||
|
|
||||||
|
# openssl
|
||||||
|
option(YUZU_USE_BUNDLED_OPENSSL "Download bundled OpenSSL" ON)
|
||||||
|
option(YUZU_USE_EXTERNAL_OPENSSL "Build OpenSSL from external source" OFF)
|
||||||
|
|
||||||
# sirit
|
# sirit
|
||||||
set(BUNDLED_SIRIT_DEFAULT OFF)
|
set(BUNDLED_SIRIT_DEFAULT OFF)
|
||||||
if (MSVC AND NOT (CMAKE_BUILD_TYPE MATCHES "Deb") OR ANDROID)
|
if (MSVC AND NOT (CMAKE_BUILD_TYPE MATCHES "Deb") OR ANDROID)
|
||||||
|
|
@ -378,17 +386,6 @@ find_package(Threads REQUIRED)
|
||||||
|
|
||||||
find_package(RenderDoc MODULE)
|
find_package(RenderDoc MODULE)
|
||||||
|
|
||||||
# openssl funniness
|
|
||||||
if (YUZU_USE_BUNDLED_OPENSSL)
|
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
|
||||||
AddJsonPackage(openssl)
|
|
||||||
if (OpenSSL_ADDED)
|
|
||||||
add_compile_definitions(YUZU_BUNDLED_OPENSSL)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(OpenSSL 3 REQUIRED)
|
|
||||||
|
|
||||||
message(STATUS "Fetching needed dependencies with CPM")
|
message(STATUS "Fetching needed dependencies with CPM")
|
||||||
|
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
|
|
@ -424,6 +421,9 @@ if (Boost_ADDED)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# OpenSSL
|
||||||
|
add_subdirectory(externals/openssl)
|
||||||
|
|
||||||
# fmt
|
# fmt
|
||||||
AddJsonPackage(fmt)
|
AddJsonPackage(fmt)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,13 @@
|
||||||
{
|
{
|
||||||
"openssl": {
|
"openssl": {
|
||||||
|
"package": "OpenSSL",
|
||||||
|
"name": "openssl",
|
||||||
|
"repo": "openssl/openssl",
|
||||||
|
"tag": "openssl-%VERSION%",
|
||||||
|
"version": "4.0.0",
|
||||||
|
"git_version": "4.0.0"
|
||||||
|
},
|
||||||
|
"openssl-ci": {
|
||||||
"ci": true,
|
"ci": true,
|
||||||
"package": "OpenSSL",
|
"package": "OpenSSL",
|
||||||
"name": "openssl",
|
"name": "openssl",
|
||||||
|
|
|
||||||
102
externals/openssl/CMakeLists.txt
vendored
Normal file
102
externals/openssl/CMakeLists.txt
vendored
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
# SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
if (YUZU_USE_BUNDLED_OPENSSL)
|
||||||
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
|
AddJsonPackage(openssl-ci)
|
||||||
|
if (OpenSSL_ADDED)
|
||||||
|
add_compile_definitions(YUZU_BUNDLED_OPENSSL)
|
||||||
|
endif()
|
||||||
|
# openssl funniness
|
||||||
|
find_package(OpenSSL 3 COMPONENTS SSL Crypto REQUIRED)
|
||||||
|
else()
|
||||||
|
message(STATUS "Using OpenSSL from externals")
|
||||||
|
AddJsonPackage(openssl)
|
||||||
|
set(OpenSSL_PREFIX ${OpenSSL_SOURCE_DIR})
|
||||||
|
set(OpenSSL_BUILD_DIR ${OpenSSL_BINARY_DIR})
|
||||||
|
set(OpenSSL_MAKEFILE ${OpenSSL_BUILD_DIR}/Makefile)
|
||||||
|
set(OpenSSL_BUILD_LIBRARIES "")
|
||||||
|
list(APPEND OpenSSL_BUILD_LIBRARIES
|
||||||
|
"${OpenSSL_BUILD_DIR}/libssl.a"
|
||||||
|
"${OpenSSL_BUILD_DIR}/libcrypto.a")
|
||||||
|
|
||||||
|
make_directory(${OpenSSL_BUILD_DIR})
|
||||||
|
|
||||||
|
# The ABSOLUTE best language, hands down, better than bash by a MILE
|
||||||
|
find_program(PERL_PROGRAM perl)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT
|
||||||
|
${OpenSSL_MAKEFILE}
|
||||||
|
COMMAND
|
||||||
|
${PERL_PROGRAM} ${OpenSSL_PREFIX}/Configure
|
||||||
|
shared
|
||||||
|
no-makedepend
|
||||||
|
--release
|
||||||
|
threads
|
||||||
|
no-tests
|
||||||
|
no-docs
|
||||||
|
enable-camellia
|
||||||
|
enable-ec
|
||||||
|
enable-ec2m
|
||||||
|
enable-sm2
|
||||||
|
enable-srp
|
||||||
|
enable-idea
|
||||||
|
enable-mdc2
|
||||||
|
enable-rc5
|
||||||
|
enable-rfc3779
|
||||||
|
enable-asm
|
||||||
|
enable-quic
|
||||||
|
enable-fips
|
||||||
|
WORKING_DIRECTORY
|
||||||
|
${OpenSSL_BUILD_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Workaround for Ubuntu 18.04's older version of make not being able to call make as a child
|
||||||
|
# with context of the jobserver. Also helps ninja users.
|
||||||
|
execute_process(COMMAND nproc OUTPUT_VARIABLE SYSTEM_THREADS)
|
||||||
|
# BSD make or Solaris make don't support ffmpeg make-j8
|
||||||
|
set(OpenSSL_MAKE_ARGS "")
|
||||||
|
if (PLATFORM_LINUX OR ANDROID OR APPLE OR WIN32 OR PLATFORM_FREEBSD)
|
||||||
|
set(OpenSSL_MAKE_ARGS -j${SYSTEM_THREADS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT
|
||||||
|
${OpenSSL_BUILD_LIBRARIES}
|
||||||
|
COMMAND
|
||||||
|
gmake ${OpenSSL_MAKE_ARGS}
|
||||||
|
WORKING_DIRECTORY
|
||||||
|
${OpenSSL_BUILD_DIR}
|
||||||
|
)
|
||||||
|
add_custom_target(openssl-configure ALL DEPENDS ${OpenSSL_MAKEFILE})
|
||||||
|
add_custom_target(openssl-build ALL DEPENDS ${OpenSSL_BUILD_LIBRARIES} openssl-configure)
|
||||||
|
|
||||||
|
add_library(SSL INTERFACE)
|
||||||
|
target_include_directories(SSL INTERFACE ${OpenSSL_SOURCE_DIR}/include)
|
||||||
|
target_link_libraries(SSL INTERFACE openssl-build)
|
||||||
|
|
||||||
|
add_library(Crypto INTERFACE)
|
||||||
|
target_include_directories(Crypto INTERFACE ${OpenSSL_SOURCE_DIR}/include)
|
||||||
|
target_link_libraries(Crypto INTERFACE openssl-build)
|
||||||
|
|
||||||
|
add_library(OpenSSL::SSL ALIAS SSL)
|
||||||
|
add_library(OpenSSL::Crypto ALIAS Crypto)
|
||||||
|
|
||||||
|
# evil haxx for httplib https://cmake.org/cmake/help/latest/module/FindOpenSSL.html
|
||||||
|
# fuck httplib
|
||||||
|
set(OpenSSL_FOUND TRUE PARENT_SCOPE)
|
||||||
|
set(OpenSSL_VERSION "4.0.0" PARENT_SCOPE)
|
||||||
|
# Deprecated but some people run older cmake
|
||||||
|
set(OPENSSL_FOUND TRUE PARENT_SCOPE)
|
||||||
|
set(OPENSSL_VERSION "4.0.0" PARENT_SCOPE)
|
||||||
|
|
||||||
|
set(OPENSSL_INCLUDE_DIR ${OpenSSL_SOURCE_DIR}/include PARENT_SCOPE)
|
||||||
|
set(OPENSSL_CRYPTO_LIBRARY ${OpenSSL_BUILD_DIR}/libcrypto.a PARENT_SCOPE)
|
||||||
|
set(OPENSSL_CRYPTO_LIBRARIES ${OpenSSL_BUILD_DIR}/libcrypto.a PARENT_SCOPE)
|
||||||
|
set(OPENSSL_SSL_LIBRARY ${OpenSSL_BUILD_DIR}/libssl.a PARENT_SCOPE)
|
||||||
|
set(OPENSSL_SSL_LIBRARIES ${OpenSSL_BUILD_DIR}/libssl.a PARENT_SCOPE)
|
||||||
|
set(OPENSSL_LIBRARIES "${OpenSSL_BUILD_DIR}/libssl.a;${OpenSSL_BUILD_DIR}/libcrypto.a" PARENT_SCOPE)
|
||||||
|
|
||||||
|
set(OPENSSL_ROOT_DIR ${OpenSSL_BUILD_DIR} PARENT_SCOPE)
|
||||||
|
set(OPENSSL_USE_STATIC_LIBS TRUE PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
|
@ -150,13 +150,13 @@ add_library(
|
||||||
httplib.h
|
httplib.h
|
||||||
net/net.h net/net.cpp)
|
net/net.h net/net.cpp)
|
||||||
|
|
||||||
|
# httplib must be put first otherwise external-openssl builds won't work
|
||||||
|
target_link_libraries(common PRIVATE httplib::httplib)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_sources(common PRIVATE windows/timer_resolution.cpp
|
target_sources(common PRIVATE windows/timer_resolution.cpp
|
||||||
windows/timer_resolution.h)
|
windows/timer_resolution.h)
|
||||||
target_link_libraries(common PRIVATE ntdll)
|
target_link_libraries(common PRIVATE ntdll)
|
||||||
endif()
|
else()
|
||||||
|
|
||||||
if(NOT WIN32)
|
|
||||||
target_sources(common PRIVATE signal_chain.cpp signal_chain.h)
|
target_sources(common PRIVATE signal_chain.cpp signal_chain.h)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
@ -239,7 +239,7 @@ else()
|
||||||
target_link_libraries(common PUBLIC Boost::headers)
|
target_link_libraries(common PUBLIC Boost::headers)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(common PUBLIC Boost::filesystem Boost::context httplib::httplib nlohmann_json::nlohmann_json)
|
target_link_libraries(common PUBLIC Boost::filesystem Boost::context nlohmann_json::nlohmann_json)
|
||||||
|
|
||||||
if (lz4_ADDED)
|
if (lz4_ADDED)
|
||||||
target_include_directories(common PRIVATE ${lz4_SOURCE_DIR}/lib)
|
target_include_directories(common PRIVATE ${lz4_SOURCE_DIR}/lib)
|
||||||
|
|
|
||||||
|
|
@ -331,9 +331,7 @@ endif()
|
||||||
if (YUZU_USE_EXTERNAL_FFMPEG)
|
if (YUZU_USE_EXTERNAL_FFMPEG)
|
||||||
add_dependencies(video_core ffmpeg-build)
|
add_dependencies(video_core ffmpeg-build)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(video_core PRIVATE ${FFmpeg_INCLUDE_DIR})
|
target_include_directories(video_core PRIVATE ${FFmpeg_INCLUDE_DIR})
|
||||||
|
|
||||||
target_link_libraries(video_core PRIVATE ${FFmpeg_LIBRARIES})
|
target_link_libraries(video_core PRIVATE ${FFmpeg_LIBRARIES})
|
||||||
target_link_options(video_core PRIVATE ${FFmpeg_LDFLAGS})
|
target_link_options(video_core PRIVATE ${FFmpeg_LDFLAGS})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,4 @@ add_library(web_service STATIC
|
||||||
create_target_directory_groups(web_service)
|
create_target_directory_groups(web_service)
|
||||||
target_include_directories(web_service PUBLIC ${cpp-jwt_SOURCE_DIR}/include)
|
target_include_directories(web_service PUBLIC ${cpp-jwt_SOURCE_DIR}/include)
|
||||||
target_link_libraries(web_service PRIVATE common network nlohmann_json::nlohmann_json httplib::httplib cpp-jwt::cpp-jwt)
|
target_link_libraries(web_service PRIVATE common network nlohmann_json::nlohmann_json httplib::httplib cpp-jwt::cpp-jwt)
|
||||||
|
|
||||||
find_package(OpenSSL REQUIRED)
|
|
||||||
target_link_libraries(web_service PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
target_link_libraries(web_service PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue