其他分享
首页 > 其他分享> > android studio编译OpenBLAS

android studio编译OpenBLAS

作者:互联网

  1. 创建一个native c++项目
  2. 把OpenBLAS源码拷贝到src\main\cpp\OpenBLAS-0.3.10
  3. 修改 src\main\cpp\CMakeLists.txt,包含源码CMakeLists
cmake_minimum_required(VERSION 3.10.0)
add_subdirectory(OpenBLAS-0.3.10)
  1. 修改 app/build.gradle ,根据自己需要修改配置
   externalNativeBuild {
            cmake {
                cppFlags "-std=c++11"
                arguments "-DTARGET = ARMV7",
                        "-DBINARY = 32",
                        "-DONLY_CBLAS = 1",	 //仅需要CBLAS
                        "-DARM_SOFTFP_ABI=1",
                        "-DUSE_THREAD = 0"   //单线程,减少内存占用
            }
        }
        ndk {
            abiFilters  'armeabi-v7a'
        }
  1. 修改 src\main\cpp\OpenBLAS-0.3.10\CMakeLists.txt
	//g0删掉调试信息,减少库尺寸
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g0")

标签:CMakeLists,CMAKE,g0,0.3,FLAGS,studio,android,OpenBLAS
来源: https://blog.csdn.net/JCYAO_/article/details/121250203