cmake打包ICONV库

### Android跨平台编译 ---ICONV

// step1: app.gradle

externalNativeBuild {

            cmake {

                cppFlags "-frtti -fexceptions --std=c++1z"

                arguments "-DANDROID_STL=c++_static"

            }

        }

// step2:然后将最新的iconv代码全部复制到项目的cpp目录下。

// 然后打开命令行,在cpp目录下运行./configure

// step3:cmakeLists.txt

cmake_minimum_required(VERSION 3.4.1)

project(mylib)

add_compile_options(

-Wno-multichar

-DANDROID

-DLIBDIR=\"c\"

-DBUILDING_LIBICONV

-DIN_LIBRARY

)

include_directories(src/main/cpp/)

include_directories(src/main/cpp/include)

include_directories(src/main/cpp/libcharset)

include_directories(src/main/cpp/lib)

include_directories(src/main/cpp/libcharset/include)

include_directories(src/main/cpp/srclib)

add_library( # Sets the name of the library.

            iconv

            # Sets the library as a static library.

            SHARED

            # Provides a relative path to your source file(s).

            src/main/cpp/libcharset/lib/localcharset.c src/main/cpp/lib/iconv.c src/main/cpp/lib/relocatable.c

            )

// step4:修改宏定义 #define HAVE_LANGINFO_CODESET 0


 

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 精致技术 设计师:CSDN官方博客 返回首页