Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: KDAB/android_openssl
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: AlpineMapsOrg/android_openssl
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 10 commits
  • 3 files changed
  • 1 contributor

Commits on May 25, 2023

  1. move the code into a function, so that the calling code can decide la…

    …ter which targets should get openssl
    adam-ce committed May 25, 2023
    Copy the full SHA
    867b080 View commit details
  2. update readme

    adam-ce committed May 25, 2023
    Copy the full SHA
    70eeb78 View commit details

Commits on Jun 15, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c465f5e View commit details
  2. Copy the full SHA
    33d3416 View commit details
  3. Copy the full SHA
    0857870 View commit details
  4. rename add_android_openssl_libraries_for_targets again, this time to …

    …add_android_openssl_libraries_to, which reads nicer in the client cmake file
    adam-ce committed Jun 15, 2023
    Copy the full SHA
    1d21f00 View commit details
  5. update readme

    adam-ce committed Jun 15, 2023
    Copy the full SHA
    897e3ab View commit details
  6. add sections

    adam-ce committed Jun 15, 2023
    Copy the full SHA
    80aa433 View commit details

Commits on Jun 20, 2023

  1. Merge remote-tracking branch 'upstream/master'

    # Conflicts:
    #    README.md
    adam-ce committed Jun 20, 2023
    Copy the full SHA
    5e8ea44 View commit details
  2. Copy the full SHA
    b923e46 View commit details
Showing with 50 additions and 23 deletions.
  1. +0 −18 CMakeLists.txt
  2. +30 −5 README.md
  3. +20 −0 android_openssl.cmake
18 changes: 0 additions & 18 deletions CMakeLists.txt

This file was deleted.

35 changes: 30 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,51 @@
# Android OpenSSL support for Qt
OpenSSL scripts and binaries for Android (useful for Qt Android apps)

In this repo you can find the prebuilt OpenSSL libs for Android and a qmake include project `.pri` file that can be used integrated with Qt projects.
In this repo you can find the prebuilt OpenSSL libs for Android, a QMake include project `.pri` file that can be used integrated with Qt projects, and a `.cmake` file for CMake based projects.

The following directories are available
* `ssl_3`: used for Qt 6.5.0+.
* `ssl_1_1`: for Qt Qt 5.12.5+, 5.13.1+, 5.14.0+, 5.15.0+, Qt 6.x.x up to 6.4.x

## How to use it

To add OpenSSL in your QMake project, append the following to your `.pro` project file:
### QMake based projects
To add OpenSSL to your QMake project, append the following to your `.pro` project file:

```
android: include(<path/to/android_openssl/openssl.pri)
```

To add OpenSSL in your CMake project, append the following to your project's `CMakeLists.txt` file, anywhere after the qt_add_executable() call for your target application:
### CMake based projects
To add OpenSSL to your CMake project, append the following to your project's `CMakeLists.txt` file:

```
if (ANDROID)
FetchContent_Declare(
android_openssl
DOWNLOAD_EXTRACT_TIMESTAMP true
URL https://github.com/KDAB/android_openssl/archive/refs/heads/master.zip
# URL_HASH MD5=c97d6ad774fab16be63b0ab40f78d945 #optional
)
FetchContent_MakeAvailable(android_openssl)
include(${android_openssl_SOURCE_DIR}/android_openssl.cmake)
endif()
```
or, if you cloned the repository into a subdirectory:

```
include(<path/to/android_openssl>/android_openssl.cmake)
```

Then

```
qt_add_executable(your_target_name ..)
qt_add_executable(your_second_target_name ..)
if (ANDROID)
include(<path/to/android_openssl/CMakeLists.txt)
add_android_openssl_libraries(your_target_name your_second_target_name)
endif()
```

## Build Script
20 changes: 20 additions & 0 deletions android_openssl.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
function(add_android_openssl_libraries)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set (ssl_root_path ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/no-asm)
else()
set (ssl_root_path ${CMAKE_CURRENT_FUNCTION_LIST_DIR})
endif()

if (Qt6_VERSION VERSION_GREATER_EQUAL 6.5.0)
list(APPEND android_extra_libs
${ssl_root_path}/ssl_3/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_3.so
${ssl_root_path}/ssl_3/${CMAKE_ANDROID_ARCH_ABI}/libssl_3.so)
else()
list(APPEND android_extra_libs
${ssl_root_path}/ssl_1.1/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_1_1.so
${ssl_root_path}/ssl_1.1/${CMAKE_ANDROID_ARCH_ABI}/libssl_1_1.so)
endif()

set_target_properties(${ARGN} PROPERTIES
QT_ANDROID_EXTRA_LIBS "${android_extra_libs}")
endfunction()