Giter Club home page Giter Club logo

cmake-openssl's Introduction

鸣谢

生成asm的脚本抄自 OpenSSL for Andorid 已经停止维护

我补全了一些没有的代码

cmake部分抄自 luvit的github 没有见到协议,在此鸣谢。

当然还有OpenSSL

说明

build openssl lib with cmake, Android 平台下可以使用

主要改动是做了拆分,并做了Android的兼容, Android Studio 3.0.1 Android NDK 16 OpenSSL 1.0.2n 已经build过

使用步骤

  1. 下载OpenSSL并解压
wget https://www.openssl.org/source/openssl-1.0.2n.tar.gz
tar xf openssl-1.0.2n.tar.gz
mv openssl-1.0.2n.tar.gz openssl

或者

git submodule update --init

看需要进去checkout不同的版本

  1. Configure

然后跑一次Configure,根据不同的平台config,如果Android还有若干平台则不需要跑这步了,我已经生成了Android不同的平台下的opensslconfig.h,放在opnessl-configs.h文件夹下

注意,如果已经做了一次,就要删除,不然会造成重定义

rm openssl/openssl-config.h
  1. 生成汇编代码
cd openssl 
../gen_asm.sh
  1. cmake build

根据不同的平台进行这一步,如果是Android,用Android Studio建立一个支持C++的项目,然后在项目下的CMakeLists指一下就行了

如果是其他平台就像普通CMake一样用

需要继承汇编代码就加 -DWithOpenSSLASM:BOOL=ON

defaultConfig {
    externalNativeBuild {
        cmake {
            cppFlags "-std=c++11 -fPIC"
            cFlags "-fPIC"
            arguments "-DWithOpenSSLASM:BOOL=ON"
            abiFilters "armeabi", "mips", "mips64", "arm64-v8a", "armeabi-v7a", "x86", "x86_64"
        }
    }
}
externalNativeBuild {
    cmake {
        path "../CMakeLists.txt"
    }
}

BUGS

  1. 在Android x86平台内嵌汇编的时候,会提示shared library text segment is not shareable,加了-Wl,--no-warn-shared-textrel在link动态库的时候也会失败

现在walkaround的方法就是全代码编译, 现在Android x86

  1. ghash-armv4.S的宏要去掉

cmake-openssl's People

Contributors

hemincong avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.