openssl
首先openssl的源码
方案
这里用到了janbar的方案,且作者一直在更新
基本直接可以编译,设置到的主要的cmake文件
CMakeLists.txt
c_rehash.cmake
crypto/CMakeLists.txt
crypto/bn_conf.h.cmake
crypto/buildinf.h.cmake
crypto/dso_conf.h.cmake
opensslconf.h.cmake
ssl/CMakeLists.txt
有兴趣可以自己研究下
这里有个场景,由于我的项目中的编译是比较严格的
add_compile_options(-g -fPIC -Wall -Wextra -Werror -pedantic -O3)
所以如果想要openssl能编译过你需要在crypto和ssl加入这些编译条件(这里gcc版本是GNU 10.1.0,ndk版本是android-ndk-r20b)
你需要在crypto/CMakeLists.txt中的add_library行后加入target_compile_options
add_library( crypto ${LIBSRC} ${OBJECTS_SRC} )
target_compile_options(crypto
PRIVATE
$:-Wcast-align
-Wcast-qual
-Wconversion
-Wexit-time-destructors
-Wglobal-constructors
-Wmissing-noreturn
-Wmissing-prototypes
<