# For more information about using CMake with Android Studio, read the # documentation: https://d.android.com/studio/projects/add-native-code.html # Sets the minimum version of CMake required to build the native library. cmake_minimum_required(VERSION 3.4.1) #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") set(distribution_DIR ${CMAKE_SOURCE_DIR}/distribution) add_library(lib_crypto STATIC IMPORTED) set_target_properties(lib_crypto PROPERTIES IMPORTED_LOCATION ${distribution_DIR}/openssl/lib/${ANDROID_ABI}/libcrypto.a) add_library(lib_ssl STATIC IMPORTED) set_target_properties(lib_ssl PROPERTIES IMPORTED_LOCATION ${distribution_DIR}/openssl/lib/${ANDROID_ABI}/libssl.a) add_library(lib_re STATIC IMPORTED) set_target_properties(lib_re PROPERTIES IMPORTED_LOCATION ${distribution_DIR}/re/lib/${ANDROID_ABI}/libre.a) add_library(lib_rem STATIC IMPORTED) set_target_properties(lib_rem PROPERTIES IMPORTED_LOCATION ${distribution_DIR}/rem/lib/${ANDROID_ABI}/librem.a) add_library(lib_opus STATIC IMPORTED) set_target_properties(lib_opus PROPERTIES IMPORTED_LOCATION ${distribution_DIR}/opus/lib/${ANDROID_ABI}/libopus.a) add_library(lib_g722_1 STATIC IMPORTED) set_target_properties(lib_g722_1 PROPERTIES IMPORTED_LOCATION ${distribution_DIR}/g7221/lib/${ANDROID_ABI}/libg722_1.a) add_library(lib_ilbc STATIC IMPORTED) set_target_properties(lib_ilbc PROPERTIES IMPORTED_LOCATION ${distribution_DIR}/ilbc/lib/${ANDROID_ABI}/libilbc.a) add_library(lib_webrtc STATIC IMPORTED) set_target_properties(lib_webrtc PROPERTIES IMPORTED_LOCATION ${distribution_DIR}/webrtc/lib/${ANDROID_ABI}/libwebrtc.a) add_library(lib_bn STATIC IMPORTED) set_target_properties(lib_bn PROPERTIES IMPORTED_LOCATION ${distribution_DIR}/bn/lib/${ANDROID_ABI}/libbn.a) add_library(lib_zrtp STATIC IMPORTED) set_target_properties(lib_zrtp PROPERTIES IMPORTED_LOCATION ${distribution_DIR}/zrtp/lib/${ANDROID_ABI}/libzrtp.a) add_library(lib_baresip STATIC IMPORTED) set_target_properties(lib_baresip PROPERTIES IMPORTED_LOCATION ${distribution_DIR}/baresip/lib/${ANDROID_ABI}/libbaresip.a) add_library(lib_x264 STATIC IMPORTED) set_target_properties(lib_x264 PROPERTIES IMPORTED_LOCATION ${distribution_DIR}/x264/lib/${ANDROID_ABI}/libx264.a) add_library( avcodec-58 SHARED IMPORTED) add_library( avdevice-58 SHARED IMPORTED) add_library( avfilter-7 SHARED IMPORTED) add_library( avformat-58 SHARED IMPORTED) add_library( avutil-56 SHARED IMPORTED) add_library( postproc-55 SHARED IMPORTED) add_library( swresample-3 SHARED IMPORTED) add_library( swscale-5 SHARED IMPORTED) add_library( bcg729 SHARED IMPORTED) set_target_properties( bcg729 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libbcg729.so) set_target_properties( avcodec-58 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libavcodec-58.so) set_target_properties( avdevice-58 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libavdevice-58.so) set_target_properties( avfilter-7 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libavfilter-7.so) set_target_properties( avformat-58 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libavformat-58.so) set_target_properties( avutil-56 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libavutil-56.so) set_target_properties( postproc-55 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libpostproc-55.so) set_target_properties( swresample-3 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libswresample-3.so) set_target_properties( swscale-5 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libswscale-5.so) # Creates and names a library, sets it as either STATIC # or SHARED, and provides the relative paths to its source code. # You can define multiple libraries, and CMake builds them for you. # Gradle automatically packages shared libraries with your APK. add_library( # Sets the name of the library. native-lib # Sets the library as a shared library. SHARED baresip/FrameQueue.cpp baresip/JavaListener.cpp baresip/BaresipObj.cpp # Provides a relative path to your source file(s). native-lib.cpp) # Searches for a specified prebuilt library and stores the path as a # variable. Because CMake includes system libraries in the search path by # default, you only need to specify the name of the public NDK library # you want to add. CMake verifies that the library exists before # completing its build. include_directories(native-lib ${CMAKE_SOURCE_DIR}/include ${distribution_DIR}/baresip/include ${distribution_DIR}/re/include ${distribution_DIR}/rem/include ${distribution_DIR}/x264/include ) find_library( # Sets the name of the path variable. log-lib # Specifies the name of the NDK library that # you want CMake to locate. log) # Specifies libraries CMake should link to your target library. You # can link multiple libraries, such as libraries you define in this # build script, prebuilt third-party libraries, or system libraries. target_link_libraries( # Specifies the target library. native-lib android OpenSLES lib_x264 avcodec-58 avdevice-58 avfilter-7 avformat-58 avutil-56 postproc-55 swresample-3 swscale-5 bcg729 lib_baresip lib_rem lib_re lib_ssl lib_crypto lib_opus lib_g722_1 lib_ilbc lib_webrtc lib_zrtp lib_bn z # Links the target library to the log library # included in the NDK. ${log-lib})