2019-01-14 06:03:18 +02:00
|
|
|
# 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)
|
|
|
|
|
2019-01-15 09:10:59 +02:00
|
|
|
get_filename_component(MYNTETE_ROOT "${PROJECT_SOURCE_DIR}/../../../.." ABSOLUTE)
|
2019-01-14 06:03:18 +02:00
|
|
|
message(STATUS "MYNTETE_ROOT: ${MYNTETE_ROOT}")
|
|
|
|
|
2019-01-17 05:58:55 +02:00
|
|
|
get_filename_component(PRO_ROOT "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
|
|
|
|
message(STATUS "PRO_ROOT: ${PRO_ROOT}")
|
|
|
|
|
|
|
|
set(LIB_ROOT "${PROJECT_SOURCE_DIR}")
|
|
|
|
message(STATUS "LIB_ROOT: ${LIB_ROOT}")
|
|
|
|
|
2019-01-15 09:10:59 +02:00
|
|
|
if(NOT DJINNI_DIR)
|
|
|
|
if(DEFINED ENV{DJINNI_DIR})
|
|
|
|
set(DJINNI_DIR $ENV{DJINNI_DIR})
|
|
|
|
else()
|
2019-01-17 05:58:55 +02:00
|
|
|
set(DJINNI_DIR "${PRO_ROOT}/third_party/djinni")
|
2019-01-15 09:10:59 +02:00
|
|
|
endif()
|
|
|
|
endif()
|
2019-01-14 06:03:18 +02:00
|
|
|
|
2019-01-15 09:10:59 +02:00
|
|
|
# libs
|
2019-01-14 06:03:18 +02:00
|
|
|
|
2019-01-15 09:10:59 +02:00
|
|
|
## log
|
2019-01-14 06:03:18 +02:00
|
|
|
|
|
|
|
find_library(log-lib log)
|
|
|
|
|
2019-02-18 08:11:14 +02:00
|
|
|
## jnigraphics
|
|
|
|
|
|
|
|
find_library(jnigraphics-lib jnigraphics)
|
|
|
|
|
2019-01-15 09:10:59 +02:00
|
|
|
## djinni_jni
|
2019-01-14 06:03:18 +02:00
|
|
|
|
2019-01-15 09:10:59 +02:00
|
|
|
include_directories(
|
|
|
|
${DJINNI_DIR}/support-lib/jni
|
|
|
|
)
|
|
|
|
add_library(djinni_jni STATIC
|
|
|
|
${DJINNI_DIR}/support-lib/jni/djinni_support.cpp
|
|
|
|
)
|
|
|
|
|
2019-02-12 03:54:02 +02:00
|
|
|
## mynteye_internal
|
|
|
|
|
|
|
|
add_library(mynteye_internal SHARED IMPORTED)
|
|
|
|
set_target_properties(mynteye_internal PROPERTIES
|
|
|
|
IMPORTED_LOCATION "${LIB_ROOT}/src/main/jniLibs/${ANDROID_ABI}/libmynteye_internal.so"
|
|
|
|
)
|
|
|
|
|
2019-01-15 09:10:59 +02:00
|
|
|
# targets
|
|
|
|
|
|
|
|
## libmynteye
|
2019-01-14 06:03:18 +02:00
|
|
|
|
|
|
|
add_definitions(-DMYNTEYE_EXPORTS)
|
|
|
|
|
2019-01-15 09:10:59 +02:00
|
|
|
set(MYNTEYE_NAMESPACE "mynteye")
|
|
|
|
#message(STATUS "Namespace: ${MYNTEYE_NAMESPACE}")
|
|
|
|
|
|
|
|
configure_file(
|
|
|
|
${MYNTETE_ROOT}/include/mynteye/mynteye.h.in
|
|
|
|
include/mynteye/mynteye.h @ONLY
|
|
|
|
)
|
|
|
|
|
2019-01-14 06:03:18 +02:00
|
|
|
set(MYNTEYE_SRCS
|
2019-02-12 03:54:02 +02:00
|
|
|
#${MYNTETE_ROOT}/src/mynteye/uvc/linux/uvc-v4l2.cc
|
2019-01-14 06:03:18 +02:00
|
|
|
${MYNTETE_ROOT}/src/mynteye/types.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/util/files.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/util/strings.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/channel/bytes.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/channel/channels.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/channel/file_channel.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/config.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/context.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/device.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/motions.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/standard/channels_adapter_s.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/standard/device_s.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/standard/streams_adapter_s.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/standard2/channels_adapter_s2.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/standard2/device_s2.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/standard2/streams_adapter_s2.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/streams.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/types.cc
|
|
|
|
${MYNTETE_ROOT}/src/mynteye/device/utils.cc
|
|
|
|
)
|
|
|
|
|
|
|
|
list(APPEND MYNTEYE_SRCS ${MYNTETE_ROOT}/src/mynteye/miniglog.cc)
|
|
|
|
|
2019-01-15 09:10:59 +02:00
|
|
|
add_library(mynteye STATIC ${MYNTEYE_SRCS})
|
|
|
|
target_link_libraries(mynteye ${log-lib})
|
2019-01-14 06:03:18 +02:00
|
|
|
|
2019-01-15 09:10:59 +02:00
|
|
|
target_include_directories(mynteye PUBLIC
|
2019-01-14 06:03:18 +02:00
|
|
|
"$<BUILD_INTERFACE:${MYNTETE_ROOT}/include>"
|
|
|
|
"$<BUILD_INTERFACE:${MYNTETE_ROOT}/src>"
|
|
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
|
|
|
|
"$<INSTALL_INTERFACE:include>"
|
|
|
|
)
|
2019-01-15 09:10:59 +02:00
|
|
|
|
|
|
|
## libmynteye_jni
|
|
|
|
|
|
|
|
set(CPP_DIR "${PROJECT_SOURCE_DIR}/src/main/cpp")
|
|
|
|
|
|
|
|
include_directories(
|
|
|
|
${CPP_DIR}/mynteye/cpp
|
|
|
|
${CPP_DIR}/mynteye/impl
|
|
|
|
${CPP_DIR}/mynteye/jni
|
|
|
|
)
|
|
|
|
|
|
|
|
set(MYNTEYE_JNI_SRCS "")
|
|
|
|
foreach(__dir cpp impl jni)
|
|
|
|
file(GLOB __srcs "${CPP_DIR}/mynteye/${__dir}/*.cpp")
|
|
|
|
list(APPEND MYNTEYE_JNI_SRCS ${__srcs})
|
|
|
|
endforeach()
|
|
|
|
#message(STATUS "MYNTEYE_JNI_SRCS: ${MYNTEYE_JNI_SRCS}")
|
|
|
|
|
|
|
|
add_library(mynteye_jni SHARED
|
|
|
|
${DJINNI_DIR}/support-lib/jni/djinni_main.cpp
|
2019-02-18 08:11:14 +02:00
|
|
|
${CPP_DIR}/mynteye/impl/util/jni_util.cpp
|
2019-01-15 09:10:59 +02:00
|
|
|
${MYNTEYE_JNI_SRCS}
|
|
|
|
)
|
2019-02-18 08:11:14 +02:00
|
|
|
target_link_libraries(mynteye_jni ${log-lib} ${jnigraphics-lib} djinni_jni mynteye mynteye_internal)
|