2011-06-17 15:52:55 +02:00
|
|
|
SET (the_target native_camera_r${ANDROID_VERSION})
|
|
|
|
|
|
|
|
project(${the_target})
|
|
|
|
|
|
|
|
link_directories("${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib")
|
|
|
|
|
2012-07-31 09:09:34 +02:00
|
|
|
if (ANDROID_VERSION VERSION_LESS "4.1")
|
|
|
|
INCLUDE_DIRECTORIES(BEFORE
|
2012-09-05 18:31:09 +02:00
|
|
|
${ANDROID_SOURCE_TREE}
|
|
|
|
${ANDROID_SOURCE_TREE}/frameworks/base/include/ui
|
|
|
|
${ANDROID_SOURCE_TREE}/frameworks/base/include/surfaceflinger
|
|
|
|
${ANDROID_SOURCE_TREE}/frameworks/base/include/camera
|
|
|
|
${ANDROID_SOURCE_TREE}/frameworks/base/include/media
|
|
|
|
${ANDROID_SOURCE_TREE}/frameworks/base/include
|
|
|
|
${ANDROID_SOURCE_TREE}/system/core/include
|
|
|
|
${ANDROID_SOURCE_TREE}/hardware/libhardware/include
|
|
|
|
${ANDROID_SOURCE_TREE}/frameworks/base/native/include
|
|
|
|
${ANDROID_SOURCE_TREE}/frameworks/base/opengl/include
|
|
|
|
)
|
2012-07-31 09:09:34 +02:00
|
|
|
else()
|
|
|
|
INCLUDE_DIRECTORIES(BEFORE
|
2012-09-05 18:31:09 +02:00
|
|
|
${ANDROID_SOURCE_TREE}
|
|
|
|
${ANDROID_SOURCE_TREE}/frameworks/native/include
|
|
|
|
${ANDROID_SOURCE_TREE}/frameworks/av/include
|
|
|
|
${ANDROID_SOURCE_TREE}/system/core/include
|
|
|
|
${ANDROID_SOURCE_TREE}/hardware/libhardware/include
|
|
|
|
)
|
2012-07-31 09:09:34 +02:00
|
|
|
endif()
|
2011-06-17 15:52:55 +02:00
|
|
|
|
2012-01-18 15:33:39 +01:00
|
|
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
|
2011-06-17 15:52:55 +02:00
|
|
|
|
2012-01-18 15:33:39 +01:00
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}")
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
|
|
|
|
SET(CMAKE_C_FLAGS_RELEASE "")
|
|
|
|
SET(CMAKE_CXX_FLAGS_RELEASE "")
|
|
|
|
|
|
|
|
string(REPLACE "-O3" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
2012-09-05 18:31:09 +02:00
|
|
|
string(REPLACE "-frtti" "-fno-rtti" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # because Android libraries are built without rtti
|
2012-01-18 15:33:39 +01:00
|
|
|
|
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -fno-strict-aliasing -finline-limit=64 -fuse-cxa-atexit" )
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -fno-strict-aliasing -finline-limit=64 -fuse-cxa-atexit")
|
|
|
|
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,noexecstack")
|
|
|
|
|
|
|
|
ADD_LIBRARY(${the_target} SHARED camera_wrapper.h camera_wrapper.cpp)
|
2011-06-17 15:52:55 +02:00
|
|
|
|
|
|
|
string(REGEX REPLACE "[.]" "_" LIBRARY_DEF ${ANDROID_VERSION})
|
|
|
|
add_definitions(-DANDROID_r${LIBRARY_DEF})
|
|
|
|
|
2012-01-18 15:33:39 +01:00
|
|
|
target_link_libraries(${the_target} c m dl utils camera_client binder log)
|
|
|
|
|
|
|
|
if(NOT ANDROID_VERSION VERSION_LESS "3.0.0")
|
|
|
|
target_link_libraries(${the_target} gui )
|
|
|
|
endif()
|
2011-06-17 15:52:55 +02:00
|
|
|
|
|
|
|
SET_TARGET_PROPERTIES(${the_target} PROPERTIES
|
|
|
|
OUTPUT_NAME "${the_target}"
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
|
|
|
|
)
|
|
|
|
|
2012-08-14 10:03:05 +02:00
|
|
|
if (NOT (CMAKE_BUILD_TYPE MATCHES "debug"))
|
|
|
|
ADD_CUSTOM_COMMAND( TARGET ${the_target} POST_BUILD COMMAND ${CMAKE_STRIP} "${LIBRARY_OUTPUT_PATH}/lib${the_target}.so" )
|
|
|
|
endif()
|
2012-01-18 15:33:39 +01:00
|
|
|
|
|
|
|
|
2011-06-24 17:40:27 +02:00
|
|
|
install(TARGETS ${the_target} LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|