2011-06-17 21:52:55 +08: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 15:09:34 +08:00
|
|
|
if (ANDROID_VERSION VERSION_LESS "4.1")
|
|
|
|
INCLUDE_DIRECTORIES(BEFORE
|
2011-06-17 21:52:55 +08: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
|
|
|
|
)
|
2012-07-31 15:09:34 +08:00
|
|
|
else()
|
|
|
|
INCLUDE_DIRECTORIES(BEFORE
|
|
|
|
${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
|
|
|
|
)
|
|
|
|
endif()
|
2011-06-17 21:52:55 +08:00
|
|
|
|
2012-01-18 22:33:39 +08:00
|
|
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
|
2011-06-17 21:52:55 +08:00
|
|
|
|
2012-01-18 22:33:39 +08: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_C_FLAGS "${CMAKE_C_FLAGS}")
|
|
|
|
string(REPLACE "-O3" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
|
|
|
|
|
|
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 21:52:55 +08:00
|
|
|
|
|
|
|
string(REGEX REPLACE "[.]" "_" LIBRARY_DEF ${ANDROID_VERSION})
|
|
|
|
add_definitions(-DANDROID_r${LIBRARY_DEF})
|
|
|
|
|
2012-01-18 22:33:39 +08: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 21:52:55 +08:00
|
|
|
|
|
|
|
SET_TARGET_PROPERTIES(${the_target} PROPERTIES
|
|
|
|
OUTPUT_NAME "${the_target}"
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
|
|
|
|
)
|
|
|
|
|
2012-01-18 22:33:39 +08:00
|
|
|
# force strip library after the build command
|
|
|
|
ADD_CUSTOM_COMMAND( TARGET ${the_target} POST_BUILD COMMAND ${CMAKE_STRIP} "${LIBRARY_OUTPUT_PATH}/lib${the_target}.so" )
|
|
|
|
|
|
|
|
|
2011-06-24 23:40:27 +08:00
|
|
|
install(TARGETS ${the_target} LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|