Modified install layout for Android

This commit is contained in:
Andrey Kamaev 2011-06-24 15:40:27 +00:00
parent 10065d3321
commit c1940b4ec7
13 changed files with 59 additions and 38 deletions

View File

@ -45,7 +45,7 @@ set_target_properties(${the_target}
PROPERTIES
OUTPUT_NAME "${the_target}"
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
)
if(ENABLE_SOLUTION_FOLDERS)
@ -54,5 +54,5 @@ endif()
if(NOT BUILD_SHARED_LIBS)
install(TARGETS ${the_target}
ARCHIVE DESTINATION share/opencv/3rdparty/lib COMPONENT main)
ARCHIVE DESTINATION share/opencv/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
endif()

View File

@ -37,7 +37,7 @@ endif()
set_target_properties(${the_target}
PROPERTIES OUTPUT_NAME "${the_target}"
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty/lib
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}
)
if(ENABLE_SOLUTION_FOLDERS)
@ -46,5 +46,5 @@ endif()
if(NOT BUILD_SHARED_LIBS)
install(TARGETS ${the_target}
ARCHIVE DESTINATION share/opencv/3rdparty/lib COMPONENT main)
ARCHIVE DESTINATION share/opencv/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
endif()

View File

@ -38,7 +38,7 @@ endif()
set_target_properties(${the_target}
PROPERTIES OUTPUT_NAME "${the_target}"
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
)
if(ENABLE_SOLUTION_FOLDERS)
@ -47,5 +47,5 @@ endif()
if(NOT BUILD_SHARED_LIBS)
install(TARGETS ${the_target}
ARCHIVE DESTINATION share/opencv/3rdparty/lib COMPONENT main)
ARCHIVE DESTINATION share/opencv/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
endif()

View File

@ -92,7 +92,7 @@ set_target_properties(${the_target}
PROPERTIES
OUTPUT_NAME "${the_target}"
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib/"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
)
if(ENABLE_SOLUTION_FOLDERS)
@ -101,5 +101,5 @@ endif()
if(NOT BUILD_SHARED_LIBS)
install(TARGETS ${the_target}
ARCHIVE DESTINATION share/opencv/3rdparty/lib COMPONENT main)
ARCHIVE DESTINATION share/opencv/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
endif()

View File

@ -29,7 +29,7 @@ set_target_properties(${the_target}
PROPERTIES
OUTPUT_NAME "${the_target}"
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
)
if(ENABLE_SOLUTION_FOLDERS)
@ -38,5 +38,5 @@ endif()
if(NOT BUILD_SHARED_LIBS)
install(TARGETS ${the_target}
ARCHIVE DESTINATION share/opencv/3rdparty/lib COMPONENT main)
ARCHIVE DESTINATION share/opencv/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
endif()

View File

@ -1180,12 +1180,20 @@ endif("${CMAKE_CONFIGURE_LDFLAGS}")
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE PATH "Output directory for libraries" )
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE PATH "Output directory for applications" )
if(WIN32)
if(ANDROID)
set(OPENCV_DOC_INSTALL_PATH doc)
elseif(WIN32)
set(OPENCV_DOC_INSTALL_PATH doc)
else()
set(OPENCV_DOC_INSTALL_PATH share/opencv/doc)
endif()
if(ANDROID)
set(OPENCV_LIB_INSTALL_PATH libs/${ARMEABI_NDK_NAME})
else()
set(OPENCV_LIB_INSTALL_PATH lib)
endif()
# --------------------------------------------------------------------------------------------
# Installation for CMake Module: OpenCVConfig.cmake
@ -1318,10 +1326,13 @@ set(VERSION ${OPENCV_VERSION})
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/opencv.pc.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/opencv.pc" @ONLY IMMEDIATE)
if(UNIX)
install(FILES ${CMAKE_BINARY_DIR}/unix-install/opencv.pc DESTINATION lib/pkgconfig)
if(UNIX AND NOT ANDROID)
install(FILES ${CMAKE_BINARY_DIR}/unix-install/opencv.pc DESTINATION ${OPENCV_LIB_INSTALL_PATH}/pkgconfig)
endif()
if(ANDROID)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/android/android.toolchain.cmake" DESTINATION share/opencv)
endif()
# ----------------------------------------------------------------------------
# Uninstall target, for "make uninstall"

View File

@ -97,8 +97,8 @@ macro(define_opencv_module name)
install(TARGETS ${the_target}
RUNTIME DESTINATION bin COMPONENT main
LIBRARY DESTINATION lib COMPONENT main
ARCHIVE DESTINATION lib COMPONENT main)
LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
install(FILES ${lib_hdrs}
DESTINATION include/opencv2/${name}

View File

@ -38,8 +38,6 @@
#
# NO_UNDEFINED=true - set true to show all undefined symbols will as linker errors even if they are not used.
#
# NO_SWIG=false - set true to disable SWIG package
#
#
# Toolcahin will search for NDK/toolchain in following order:
# ANDROID_NDK - cmake parameter
@ -96,6 +94,7 @@
# [~] toolchain install directory is added to linker paths
# [-] removed SWIG-related stuff from toolchain
# [+] added macro find_host_package, find_host_program to search packages/programs on host system
# [~] fixed path to STL library
# ----------------------------------------------------------------------------
# this one is important
@ -261,7 +260,7 @@ if( DO_NOT_CHANGE_OUTPUT_PATHS_ON_FIRST_PASS )
set( EXECUTABLE_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH_ROOT}/bin CACHE PATH "Output directory for applications" FORCE)
endif()
set( LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ARMEABI_NDK_NAME} CACHE PATH "path for android libs" FORCE )
set( CMAKE_INSTALL_PREFIX ${ANDROID_NDK_TOOLCHAIN_ROOT}/user/${ARMEABI_NDK_NAME} CACHE STRING "path for installing" FORCE )
set( CMAKE_INSTALL_PREFIX ${ANDROID_NDK_TOOLCHAIN_ROOT}/user CACHE STRING "path for installing" FORCE )
endif()
SET( DO_NOT_CHANGE_OUTPUT_PATHS_ON_FIRST_PASS ON CACHE INTERNAL "" FORCE)
@ -271,11 +270,20 @@ set( CMAKE_FIND_ROOT_PATH ${ANDROID_NDK_TOOLCHAIN_ROOT}/bin ${ANDROID_NDK_TOOLCH
if( BUILD_WITH_ANDROID_NDK )
set( STL_PATH "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++" )
set( STL_LIBRARIES_PATH "${STL_PATH}/libs/${ARMEABI_NDK_NAME}" )
include_directories( ${STL_PATH}/include ${STL_LIBRARIES_PATH}/include )
include_directories( "${STL_PATH}/include" "${STL_LIBRARIES_PATH}/include" )
if ( NOT ARMEABI AND NOT FORCE_ARM )
set( STL_LIBRARIES_PATH "${ANDROID_NDK_TOOLCHAIN_ROOT}/arm-linux-androideabi/lib/${CMAKE_SYSTEM_PROCESSOR}/thumb" )
endif()
endif()
if( BUILD_WITH_ANDROID_NDK_TOOLCHAIN )
set( STL_LIBRARIES_PATH "${CMAKE_INSTALL_PREFIX}/lib" )
set( STL_LIBRARIES_PATH "${ANDROID_NDK_TOOLCHAIN_ROOT}/arm-linux-androideabi/lib" )
if( NOT ARMEABI )
set( STL_LIBRARIES_PATH "${STL_LIBRARIES_PATH}/${CMAKE_SYSTEM_PROCESSOR}" )
endif()
if( NOT FORCE_ARM )
set( STL_LIBRARIES_PATH "${STL_LIBRARIES_PATH}/thumb" )
endif()
#for some reason this is needed? TODO figure out why...
include_directories( ${ANDROID_NDK_TOOLCHAIN_ROOT}/arm-linux-androideabi/include/c++/4.4.3/arm-linux-androideabi )
endif()
@ -324,7 +332,7 @@ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags" )
#-L${LIBCPP_LINK_DIR} -lstdc++ -lsupc++
#Also, this is *required* to use the following linker flags that routes around
#a CPU bug in some Cortex-A8 implementations:
set( LINKER_FLAGS "-Wl,--fix-cortex-a8 -L${STL_LIBRARIES_PATH} -L${CMAKE_INSTALL_PREFIX}/lib -lstdc++ -lsupc++ " )
set( LINKER_FLAGS "-Wl,--fix-cortex-a8 -L${STL_LIBRARIES_PATH} -L${CMAKE_INSTALL_PREFIX}/libs/${ARMEABI_NDK_NAME} -lstdc++ -lsupc++ " )
set( NO_UNDEFINED ON CACHE BOOL "Don't all undefined symbols" )
if( NO_UNDEFINED )
@ -339,7 +347,7 @@ set( CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE
set( ANDROID True )
set( BUILD_ANDROID True )
#macro to find package on the host OS
#macro to find packages on the host OS
macro(find_host_package)
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )
@ -349,6 +357,7 @@ macro(find_host_package)
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
endmacro()
#macro to find programs on the host OS
macro(find_host_program)
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )

View File

@ -32,8 +32,8 @@ SET_TARGET_PROPERTIES(${the_target} PROPERTIES
IF (NOT BUILD_SHARED_LIBS)
install(TARGETS ${the_target}
RUNTIME DESTINATION bin COMPONENT main
ARCHIVE DESTINATION lib COMPONENT main
LIBRARY DESTINATION lib COMPONENT main
ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
)
ENDIF()
@ -48,7 +48,7 @@ if (ARMEABI_V7A AND NOT BUILD_ANDROID_CAMERA_WRAPPER)
)
get_filename_component(wrapper_name "${wrapper}" NAME)
install(FILES "${LIBRARY_OUTPUT_PATH}/${wrapper_name}"
DESTINATION lib
DESTINATION ${OPENCV_LIB_INSTALL_PATH}
COMPONENT main)
endforeach()
endif()

View File

@ -33,8 +33,4 @@ SET_TARGET_PROPERTIES(${the_target} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
)
install(TARGETS ${the_target}
RUNTIME DESTINATION bin COMPONENT main
ARCHIVE DESTINATION lib COMPONENT main
LIBRARY DESTINATION lib COMPONENT main
)
install(TARGETS ${the_target} LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main)

View File

@ -362,8 +362,8 @@ endif()
install(TARGETS ${the_target}
RUNTIME DESTINATION bin COMPONENT main
LIBRARY DESTINATION lib COMPONENT main
ARCHIVE DESTINATION lib COMPONENT main)
LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
install(FILES ${highgui_ext_hdrs}
DESTINATION include/opencv2/highgui

View File

@ -38,11 +38,9 @@ foreach(module ${OPENCV_JAVA_MODULES})
)
endforeach()
set(target "opencv_java")
set(target opencv_java)
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
FILE(GLOB handwrittren_cpp_sources "${CMAKE_CURRENT_SOURCE_DIR}/src/cpp/*.cpp")
SET (generated_cpp_sources "")
SET (generated_java_sources "")
SET (dependent_libs "")
@ -60,10 +58,9 @@ foreach(module ${OPENCV_EXTRA_JAVA_MODULES})
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../${module}/include")
endforeach()
#SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -L/home/andreyk/OpenCV2/trunk/opencv/android/build/libs/armeabi-v7a")
FILE(GLOB handwrittren_cpp_sources "${CMAKE_CURRENT_SOURCE_DIR}/src/cpp/*.cpp")
add_library(${target} SHARED ${handwrittren_cpp_sources} ${generated_cpp_sources})
target_link_libraries(${target} ${dependent_libs} ${dependent_extra_libs} ${OPENCV_LINKER_LIBS})
if(ANDROID)
target_link_libraries(${target} jnigraphics)
@ -79,6 +76,8 @@ set_target_properties(${target} PROPERTIES
INSTALL_NAME_DIR lib
)
install(TARGETS ${target} LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
set(api_target opencv_java_api)
add_custom_target(${api_target} ALL DEPENDS ${target})
@ -100,6 +99,7 @@ IF(ANDROID)
DEPENDS "${lib_file}"
COMMENT "Generating ${lib_file_name}"
)
install(FILES "${CMAKE_BINARY_DIR}/${lib_file_name}" DESTINATION . COMPONENT main)
endif()
endforeach()
ENDIF()
@ -116,5 +116,8 @@ foreach(java_file ${java_project_files} ${generated_java_sources})
DEPENDS "${JAVA_OUTPUT_DIR}"
COMMENT "Generating src/org/opencv/${java_file_name}"
)
if(ANDROID)
install(FILES "${JAVA_OUTPUT_DIR}/${java_file_name}" DESTINATION src/org/opencv COMPONENT main)
endif()
endforeach()

View File

@ -41,4 +41,6 @@ endif()
target_link_libraries(${the_target} ${traincascade_libs})
if(NOT ANDROID)
install(TARGETS ${the_target} RUNTIME DESTINATION bin COMPONENT main)
endif()