718c41634f
1.项目后端整体迁移至PaddleOCR-NCNN算法,已通过基本的兼容性测试 2.工程改为使用CMake组织,后续为了更好地兼容第三方库,不再提供QMake工程 3.重整权利声明文件,重整代码工程,确保最小化侵权风险 Log: 切换后端至PaddleOCR-NCNN,切换工程为CMake Change-Id: I4d5d2c5d37505a4a24b389b1a4c5d12f17bfa38c
33 lines
1.4 KiB
CMake
33 lines
1.4 KiB
CMake
cmake_minimum_required(VERSION 3.4)
|
|
|
|
project(pyncnn)
|
|
|
|
set(PACKAGE_VERSION ${NCNN_VERSION_STRING})
|
|
add_definitions(-DVERSION_INFO="${PACKAGE_VERSION}")
|
|
|
|
set( CMAKE_CXX_STANDARD 11 )
|
|
set( CMAKE_CXX_STANDARD_REQUIRED ON )
|
|
|
|
add_subdirectory(pybind11)
|
|
|
|
if("${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" STREQUAL "")
|
|
if(MSVC OR CMAKE_GENERATOR STREQUAL "Xcode")
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}/ncnn/)
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}/ncnn/)
|
|
endif(MSVC OR CMAKE_GENERATOR STREQUAL "Xcode")
|
|
endif("${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" STREQUAL "")
|
|
|
|
include_directories(${pybind11_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS})
|
|
pybind11_add_module(pyncnn src/main.cpp)
|
|
set_target_properties(pyncnn PROPERTIES OUTPUT_NAME "ncnn")
|
|
target_link_libraries(pyncnn PUBLIC ncnn)
|
|
set_target_properties(pyncnn PROPERTIES PREFIX "" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ncnn")
|
|
set_property(TARGET pyncnn PROPERTY FOLDER "python")
|
|
if("${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" STREQUAL "")
|
|
add_custom_command(TARGET pyncnn POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/ncnn/ncnn${PYTHON_MODULE_PREFIX}${PYTHON_MODULE_EXTENSION}
|
|
${PROJECT_SOURCE_DIR}/ncnn/ncnn${PYTHON_MODULE_PREFIX}${PYTHON_MODULE_EXTENSION})
|
|
endif("${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" STREQUAL "")
|
|
|
|
configure_file(setup.py.i ${PROJECT_SOURCE_DIR}/setup.py)
|