Skip to content

Commit

Permalink
feat: 支持安卓
Browse files Browse the repository at this point in the history
(cherry picked from commit f304428b156d43ca46119788af6aea6d8e3d68bb)
  • Loading branch information
s12mmm3 committed Dec 6, 2024
1 parent ab9bb95 commit 055df6e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
16 changes: 15 additions & 1 deletion QCloudMusicApi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,21 @@ add_library(${PROJECT_NAME}
${HEADERS}
${SOURCES}
)
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")

if (ANDROID)
include(FetchContent)
FetchContent_Declare(
android_openssl
DOWNLOAD_EXTRACT_TIMESTAMP true
URL https://github.com/KDAB/android_openssl/archive/refs/heads/master.zip
)
FetchContent_MakeAvailable(android_openssl)
include(${android_openssl_SOURCE_DIR}/android_openssl.cmake)

add_android_openssl_libraries(${PROJECT_NAME})
else()
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
endif()

target_link_libraries(${PROJECT_NAME} Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Gui ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})

Expand Down
15 changes: 15 additions & 0 deletions Test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ else()
endif()
endif()

if (ANDROID)
include(FetchContent)
FetchContent_Declare(
android_openssl
DOWNLOAD_EXTRACT_TIMESTAMP true
URL https://github.com/KDAB/android_openssl/archive/refs/heads/master.zip
)
FetchContent_MakeAvailable(android_openssl)
include(${android_openssl_SOURCE_DIR}/android_openssl.cmake)

add_android_openssl_libraries(${PROJECT_NAME})
else()

endif()

target_link_libraries(${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Concurrent QCloudMusicApi qrencode)

target_compile_definitions(${PROJECT_NAME} PRIVATE
Expand Down

0 comments on commit 055df6e

Please sign in to comment.