Minor python search improvements

This commit is contained in:
Andrey Kamaev 2011-06-27 08:24:10 +00:00
parent ae649e8c30
commit f0227edd2c
3 changed files with 16 additions and 2 deletions

View File

@ -623,6 +623,10 @@ if(WIN32)
set(PYTHON_PACKAGES_PATH "${PYTHON_PATH}/Lib/site-packages")
endif()
IF (${PYTHON_VERSION_MAJOR_MINOR} VERSION_GREATER 2.5)
SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} -B)
ENDIF()
# Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
RESULT_VARIABLE PYTHON_NUMPY_PROCESS

View File

@ -30,7 +30,7 @@ foreach(module ${OPENCV_JAVA_MODULES})
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${module}.java"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${module}.cpp"
COMMAND "${PYTHON_EXECUTABLE}" -B "${GEN_JAVA}" "${HDR_PARSER}" ${module} ${module_cheaders} ${module_cppheaders}
COMMAND ${PYTHON_EXECUTABLE} "${GEN_JAVA}" "${HDR_PARSER}" ${module} ${module_cheaders} ${module_cppheaders}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS "${GEN_JAVA}"
DEPENDS "${HDR_PARSER}"
@ -102,6 +102,16 @@ IF(ANDROID)
install(FILES "${CMAKE_BINARY_DIR}/${lib_file_name}" DESTINATION . COMPONENT main)
endif()
endforeach()
foreach(jni_file ${handwrittren_cpp_sources} ${generated_cpp_sources})
get_filename_component(jni_file_name "${jni_file}" NAME)
add_custom_command(
TARGET ${api_target}
COMMAND ${CMAKE_COMMAND} -E copy "${jni_file}" "${CMAKE_BINARY_DIR}/jni/${jni_file_name}"
DEPENDS "${jni_file}"
COMMENT "Generating jni/${jni_file_name}"
)
endforeach()
ENDIF()
FILE(GLOB java_project_files "${CMAKE_CURRENT_SOURCE_DIR}/src/java/*.java")

View File

@ -53,7 +53,7 @@ target_link_libraries(${cv_target} ${PYTHON_LIBRARIES} opencv_core opencv_imgpro
set_target_properties(${cv_target} PROPERTIES PREFIX "")
set_target_properties(${cv_target} PROPERTIES OUTPUT_NAME "cv")
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('SO')"
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import distutils.sysconfig; print distutils.sysconfig.get_config_var('SO')"
RESULT_VARIABLE PYTHON_CVPY_PROCESS
OUTPUT_VARIABLE CVPY_SUFFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)