microsoft/onnxruntime-extensions

Public

mirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
0f45fef2d9301cc5b479b4df4bd8ecbaac93e1e6

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

cmake/ext_python.cmake

39lines · modecode

1set(Python3_FIND_REGISTRY NEVER CACHE STRING "...")
2if(NOT "${Python3_FIND_REGISTRY}" STREQUAL "NEVER")
3 message(FATAL_ERROR "Python3_FIND_REGISTRY is not NEVER")
4endif()
5find_package(Python3 COMPONENTS Interpreter Development.Module NumPy)
6if (NOT Python3_FOUND)
7 message(FATAL_ERROR "Python3 or NumPy not found!")
8endif()
9if (WIN32)
10 list(APPEND shared_TARGET_SRC "${PROJECT_SOURCE_DIR}/pyop/extensions_pydll.def")
11endif()
12
13file(GLOB TARGET_SRC_PYOPS "pyop/*.cc" "pyop/*.h" "shared/*.cc")
14add_library(extensions_pydll SHARED ${TARGET_SRC_PYOPS} ${shared_TARGET_LIB_SRC})
15standardize_output_folder(extensions_pydll)
16list(APPEND OCOS_COMPILE_DEFINITIONS PYTHON_OP_SUPPORT)
17target_compile_definitions(extensions_pydll PRIVATE ${OCOS_COMPILE_DEFINITIONS})
18
19message(STATUS "Fetch pybind11")
20include(pybind11)
21target_include_directories(extensions_pydll PRIVATE
22 ${pybind11_INCLUDE_DIRS}
23 $<TARGET_PROPERTY:Python3::Module,INTERFACE_INCLUDE_DIRECTORIES>
24 $<TARGET_PROPERTY:Python3::NumPy,INTERFACE_INCLUDE_DIRECTORIES>
25 $<TARGET_PROPERTY:ocos_operators,INTERFACE_INCLUDE_DIRECTORIES>)
26
27target_compile_definitions(extensions_pydll PRIVATE
28 $<TARGET_PROPERTY:Python3::Module,INTERFACE_COMPILE_DEFINITIONS>)
29
30target_link_libraries(extensions_pydll PRIVATE Python3::Module ocos_operators)
31
32if(NOT "${OCOS_EXTENTION_NAME}" STREQUAL "")
33 if(NOT WIN32)
34 set_target_properties(extensions_pydll PROPERTIES
35 LIBRARY_OUTPUT_NAME ${OCOS_EXTENTION_NAME}
36 PREFIX ""
37 SUFFIX "")
38 endif()
39endif()
40