@@ -209,12 +209,14 @@ add_onnx_mlir_library(OMCompilerUtils
209209# CompilerUtils does not require cruntime or jniruntime to build,
210210# however, they are required for execution when using the EmitLib or EmitJNI
211211# options
212- add_dependencies (OMCompilerUtils cruntime)
213- if (ONNX_MLIR_ENABLE_JNI)
214- add_dependencies (OMCompilerUtils jniruntime)
215- endif ()
216- if (TARGET omp)
217- add_dependencies (OMCompilerUtils ompruntime)
212+ if (ONNX_MLIR_ENABLE_PYBIND)
213+ add_dependencies (OMCompilerUtils cruntime)
214+ if (ONNX_MLIR_ENABLE_JNI)
215+ add_dependencies (OMCompilerUtils jniruntime)
216+ endif ()
217+ if (TARGET omp)
218+ add_dependencies (OMCompilerUtils ompruntime)
219+ endif ()
218220endif ()
219221
220222add_onnx_mlir_library(OMCompiler
@@ -239,29 +241,31 @@ if (NOT BUILD_SHARED_LIBS)
239241 target_compile_definitions (OMCompiler PUBLIC ONNX_MLIR_BUILT_AS_STATIC)
240242endif ()
241243
242- pybind11_add_module(PyCompile PyOMCompileSession.cpp)
243- add_dependencies (PyCompile onnx_proto)
244- if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC" )
245- target_compile_options (PyCompile PRIVATE /EHsc /GR)
246- elseif (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU" )
247- target_compile_options (PyCompile PRIVATE -frtti -fexceptions)
248- endif ()
249-
250- target_compile_definitions (PyCompile
251- PRIVATE
252- $<TARGET_PROPERTY:onnx,COMPILE_DEFINITIONS >
253- )
254- target_include_directories (PyCompile
255- PRIVATE
256- $<TARGET_PROPERTY:onnx,INCLUDE_DIRECTORIES >
257- )
258- target_link_libraries (PyCompile
259- PRIVATE
260- OMCompiler
261- )
244+ if (ONNX_MLIR_ENABLE_PYBIND)
245+ pybind11_add_module(PyCompile PyOMCompileSession.cpp)
246+ add_dependencies (PyCompile onnx_proto)
247+ if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC" )
248+ target_compile_options (PyCompile PRIVATE /EHsc /GR)
249+ elseif (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU" )
250+ target_compile_options (PyCompile PRIVATE -frtti -fexceptions)
251+ endif ()
262252
263- if (ONNX_MLIR_INSTALL_PYTHON_EXTENSIONS)
264- install (TARGETS PyCompile
265- DESTINATION lib
253+ target_compile_definitions (PyCompile
254+ PRIVATE
255+ $<TARGET_PROPERTY:onnx,COMPILE_DEFINITIONS >
256+ )
257+ target_include_directories (PyCompile
258+ PRIVATE
259+ $<TARGET_PROPERTY:onnx,INCLUDE_DIRECTORIES >
266260 )
261+ target_link_libraries (PyCompile
262+ PRIVATE
263+ OMCompiler
264+ )
265+
266+ if (ONNX_MLIR_INSTALL_PYTHON_EXTENSIONS)
267+ install (TARGETS PyCompile
268+ DESTINATION lib
269+ )
270+ endif ()
267271endif ()
0 commit comments