From fa0a9ca889d865cb399f619151f07c47bc8efcd8 Mon Sep 17 00:00:00 2001 From: TSR Berry <20988865+TSRBerry@users.noreply.github.com> Date: Mon, 4 Mar 2024 02:02:34 +0100 Subject: [PATCH] Use prebuilt OpenSSL libraries if available --- .../app/src/main/cpp/CMakeLists.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/RyujinxAndroid/app/src/main/cpp/CMakeLists.txt b/src/RyujinxAndroid/app/src/main/cpp/CMakeLists.txt index 8700f6d9f..14b0c57f8 100644 --- a/src/RyujinxAndroid/app/src/main/cpp/CMakeLists.txt +++ b/src/RyujinxAndroid/app/src/main/cpp/CMakeLists.txt @@ -14,9 +14,6 @@ project("ryujinxjni") set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) -# libssl.so and libcrypto.so -include(../../../../libryujinx/libs/OpenSSL.cmake) - FetchContent_Declare( adrenotools GIT_REPOSITORY https://github.com/bylaws/libadrenotools.git @@ -41,8 +38,6 @@ add_library( # Sets the name of the library. string_helper.cpp ryujinx.cpp) -add_dependencies(ryujinxjni openssl) - # Searches for a specified prebuilt library and stores the path as a # variable. Because CMake includes system libraries in the search path by # default, you only need to specify the name of the public NDK library @@ -69,3 +64,15 @@ target_link_libraries( # Specifies the target library. -landroid adrenotools ) + +# Build external libraries if prebuilt files don't exist +set(JNI_PATH ../jniLibs/${CMAKE_ANDROID_ARCH_ABI}) +cmake_path(ABSOLUTE_PATH JNI_PATH NORMALIZE) + +cmake_path(APPEND JNI_PATH libcrypto.so OUTPUT_VARIABLE LIBCRYPTO_JNI_PATH) +cmake_path(APPEND JNI_PATH libssl.so OUTPUT_VARIABLE LIBSSL_JNI_PATH) + +if (NOT (EXISTS ${LIBCRYPTO_JNI_PATH} AND EXISTS ${LIBSSL_JNI_PATH})) + include(../../../../libryujinx/libs/OpenSSL.cmake) + add_dependencies(ryujinxjni openssl) +endif ()