From: Andrey Kamaev Date: Fri, 24 Jun 2011 15:40:27 +0000 (+0000) Subject: Modified install layout for Android X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~6868 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c1940b4ec702d111af64a9ff3e98961a6f9804ad;p=platform%2Fupstream%2Fopencv.git Modified install layout for Android --- diff --git a/3rdparty/libjasper/CMakeLists.txt b/3rdparty/libjasper/CMakeLists.txt index 4a5a2fa..9b894da 100644 --- a/3rdparty/libjasper/CMakeLists.txt +++ b/3rdparty/libjasper/CMakeLists.txt @@ -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() diff --git a/3rdparty/libjpeg/CMakeLists.txt b/3rdparty/libjpeg/CMakeLists.txt index c78bfc3..dfb5a8a 100644 --- a/3rdparty/libjpeg/CMakeLists.txt +++ b/3rdparty/libjpeg/CMakeLists.txt @@ -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() diff --git a/3rdparty/libpng/CMakeLists.txt b/3rdparty/libpng/CMakeLists.txt index 4eda135..5602023 100644 --- a/3rdparty/libpng/CMakeLists.txt +++ b/3rdparty/libpng/CMakeLists.txt @@ -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() diff --git a/3rdparty/libtiff/CMakeLists.txt b/3rdparty/libtiff/CMakeLists.txt index 899ff98..c79f4a0 100644 --- a/3rdparty/libtiff/CMakeLists.txt +++ b/3rdparty/libtiff/CMakeLists.txt @@ -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() diff --git a/3rdparty/zlib/CMakeLists.txt b/3rdparty/zlib/CMakeLists.txt index 1fc3c5d..ae1887f 100644 --- a/3rdparty/zlib/CMakeLists.txt +++ b/3rdparty/zlib/CMakeLists.txt @@ -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() diff --git a/CMakeLists.txt b/CMakeLists.txt index e8585af..84546fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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" diff --git a/OpenCVModule.cmake b/OpenCVModule.cmake index f7620b6..00382ea 100644 --- a/OpenCVModule.cmake +++ b/OpenCVModule.cmake @@ -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} diff --git a/android/android.toolchain.cmake b/android/android.toolchain.cmake index d8497f7..d204c80 100644 --- a/android/android.toolchain.cmake +++ b/android/android.toolchain.cmake @@ -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 ) diff --git a/modules/androidcamera/CMakeLists.txt b/modules/androidcamera/CMakeLists.txt index 908ebd2..485d6ca 100644 --- a/modules/androidcamera/CMakeLists.txt +++ b/modules/androidcamera/CMakeLists.txt @@ -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() diff --git a/modules/androidcamera/camera_wrapper/CMakeLists.txt b/modules/androidcamera/camera_wrapper/CMakeLists.txt index 1453f68..e0a1458 100644 --- a/modules/androidcamera/camera_wrapper/CMakeLists.txt +++ b/modules/androidcamera/camera_wrapper/CMakeLists.txt @@ -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 - ) \ No newline at end of file +install(TARGETS ${the_target} LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main) diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index a407431..c565cdf 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -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 diff --git a/modules/java/CMakeLists.txt b/modules/java/CMakeLists.txt index 94dfd58..8fab4c4 100644 --- a/modules/java/CMakeLists.txt +++ b/modules/java/CMakeLists.txt @@ -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() diff --git a/modules/traincascade/CMakeLists.txt b/modules/traincascade/CMakeLists.txt index ebc6c84..21d968a 100644 --- a/modules/traincascade/CMakeLists.txt +++ b/modules/traincascade/CMakeLists.txt @@ -41,4 +41,6 @@ endif() target_link_libraries(${the_target} ${traincascade_libs}) -install(TARGETS ${the_target} RUNTIME DESTINATION bin COMPONENT main) +if(NOT ANDROID) + install(TARGETS ${the_target} RUNTIME DESTINATION bin COMPONENT main) +endif()