编辑 | blame | 历史 | 原始文档
cmake_minimum_required(VERSION 3.4.1)

# Ensure C++ standard library is linked (apptimer.cpp / watermark.cpp use STL).
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 创建变量JNI_LIBS_DIR
set(JNI_LIBS_DIR ${CMAKE_SOURCE_DIR}/src/main/jniLibs)

set(CMAKE_BUILD_TYPE "Release")

add_definitions("-O3")
#set(CMAKE_CXX_FLAGS "-O3")
#set(CMAKE_C_FLAGS "-O3")

add_library( # Sets the name of the library.
        usbcamera-lib

        # Sets the library as a shared library.
        SHARED

        # Provides a relative path to your source file(s).
        src/main/cpp/libyuv.c
        src/main/cpp/ImageProc.c
        src/main/cpp/charencode.cpp
        src/main/cpp/jpeg.c
        src/main/cpp/watermark.cpp
        src/main/cpp/SonixCamera/ROMData.c
        src/main/cpp/SonixCamera/SFData.c
        src/main/cpp/SonixCamera/SonixCamera.c
        src/main/cpp/SonixCamera/XUOptDev.c
        src/main/cpp/apptimer.cpp
        )



find_library( # Sets the name of the path variable.
        log-lib

        log)
find_library( # Sets the name of the path variable.
        g-lib


        jnigraphics)

add_library(jpeg
        SHARED
        IMPORTED)
set_target_properties(jpeg
        PROPERTIES IMPORTED_LOCATION
        ${JNI_LIBS_DIR}/${ANDROID_ABI}/libjpeg.so)

add_library(turbojpeg
        SHARED
        IMPORTED)
set_target_properties(turbojpeg
        PROPERTIES IMPORTED_LOCATION
        ${JNI_LIBS_DIR}/${ANDROID_ABI}/libturbojpeg.so)

# 指定头文件的位置
include_directories(${JNI_LIBS_DIR}/includes)

target_link_libraries( # Specifies the target library.
        usbcamera-lib

        jpeg
        turbojpeg
        c++_shared
        atomic
        ${log-lib}
        ${g-lib})

#target_link_libraries( # Specifies the target library.
#        usbcamera-lib
#
#        jpeg
#        turbojpeg
#        ${g-lib})