modding the 3rdparty CMakeLists.txt to allow for android compilation using cmake

Basically just adding lines at top of CMakeLists that alter behavior if ANDROID is set to
true.
This commit is contained in:
Ethan Rublee
2010-09-22 02:01:54 +00:00
parent fbac20273c
commit a732082526
7 changed files with 42 additions and 0 deletions

View File

@@ -1,3 +1,7 @@
if(ANDROID)
configure_file("${CMAKE_SOURCE_DIR}/Android.mk.modules.in" "${CMAKE_CURRENT_BINARY_DIR}/Android.mk")
endif()
add_subdirectory(flann) add_subdirectory(flann)
add_subdirectory(lapack) add_subdirectory(lapack)
add_subdirectory(zlib) add_subdirectory(zlib)
@@ -13,4 +17,7 @@ endif()
if(WITH_TIFF AND NOT TIFF_FOUND) if(WITH_TIFF AND NOT TIFF_FOUND)
add_subdirectory(libtiff) add_subdirectory(libtiff)
endif() endif()
if(NOT ANDROID)
add_subdirectory(gtest) add_subdirectory(gtest)
endif()

View File

@@ -1,3 +1,7 @@
if(ANDROID)
file(GLOB_RECURSE flann_sources_cpp *.cpp)
define_android_manual(flann "${flann_sources_cpp}" "$(LOCAL_PATH)/../include $(LOCAL_PATH)/../include/flann")
else(ANDROID)
if (DEFINED OPENCV_VERSION) if (DEFINED OPENCV_VERSION)
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@@ -100,3 +104,4 @@ INSTALL (
) )
ENDIF() ENDIF()
endif(ANDROID)#android

View File

@@ -2,6 +2,10 @@
# CMake file for opencv_lapack. See root CMakeLists.txt # CMake file for opencv_lapack. See root CMakeLists.txt
# #
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
if(ANDROID)
define_3rdparty_module(opencv_lapack)
else()
project(opencv_lapack) project(opencv_lapack)
# List of C++ files: # List of C++ files:
@@ -56,3 +60,4 @@ set_target_properties(${the_target}
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty/lib ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty/lib
) )
endif() #android

View File

@@ -1,9 +1,17 @@
if(ANDROID)
set(android_defs "-DEXCLUDE_MIF_SUPPORT -DEXCLUDE_PNM_SUPPORT -DEXCLUDE_BMP_SUPPORT -DEXCLUDE_RAS_SUPPORT -DEXCLUDE_JPG_SUPPORT -DEXCLUDE_PGX_SUPPORT")
define_3rdparty_module(jasper)
set(android_defs "")
else(ANDROID)
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# CMake file for libjasper. See root CMakeLists.txt # CMake file for libjasper. See root CMakeLists.txt
# #
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
project(libjasper) project(libjasper)
add_definitions(-DEXCLUDE_MIF_SUPPORT -DEXCLUDE_PNM_SUPPORT -DEXCLUDE_BMP_SUPPORT -DEXCLUDE_RAS_SUPPORT -DEXCLUDE_JPG_SUPPORT -DEXCLUDE_PGX_SUPPORT) add_definitions(-DEXCLUDE_MIF_SUPPORT -DEXCLUDE_PNM_SUPPORT -DEXCLUDE_BMP_SUPPORT -DEXCLUDE_RAS_SUPPORT -DEXCLUDE_JPG_SUPPORT -DEXCLUDE_PGX_SUPPORT)
# List of C++ files: # List of C++ files:
@@ -41,9 +49,12 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-function-declaration -Wno-unused") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-function-declaration -Wno-unused")
endif() endif()
set_target_properties(${the_target} set_target_properties(${the_target}
PROPERTIES PROPERTIES
OUTPUT_NAME "${the_target}" OUTPUT_NAME "${the_target}"
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib"
) )
endif(ANDROID)#!android

View File

@@ -1,3 +1,7 @@
if(ANDROID)
define_3rdparty_module(jpeg)
else()
#endif()#android
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# CMake file for libjpeg. See root CMakeLists.txt # CMake file for libjpeg. See root CMakeLists.txt
# #
@@ -39,3 +43,4 @@ set_target_properties(${the_target}
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty/lib ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty/lib
) )
endif()#android

View File

@@ -1,3 +1,6 @@
if(ANDROID)
define_3rdparty_module(png)
else()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# CMake file for libpng. See root CMakeLists.txt # CMake file for libpng. See root CMakeLists.txt
# #
@@ -38,3 +41,4 @@ set_target_properties(${the_target}
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib"
) )
endif()#android

View File

@@ -1,3 +1,6 @@
if(ANDROID)
define_3rdparty_module(zlib)
else()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# CMake file for zlib. See root CMakeLists.txt # CMake file for zlib. See root CMakeLists.txt
# #
@@ -35,3 +38,5 @@ set_target_properties(${the_target}
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib"
) )
endif(ANDROID)