Skip to content

Split the cmake file for build target#3385

Open
chentong319 wants to merge 6 commits intoonnx:mainfrom
chentong319:cmake-split
Open

Split the cmake file for build target#3385
chentong319 wants to merge 6 commits intoonnx:mainfrom
chentong319:cmake-split

Conversation

@chentong319
Copy link
Collaborator

@chentong319 chentong319 commented Feb 5, 2026

This PR is to rewrite the cmake file for ONNX_MLIR_ENABLE_PYRUNTIME_LIGHT to split the related part in cmake to OMPyInfer.cmake in related directory, and keep the current cmake unchanged to test.
Now the CMakeList.txt will start with:

# SPDX-License-Identifier: Apache-2.0

# Check whether the build is for a tool (sub-project for now)
# Otherwise, continue with default onnx-mlir project
choose_build_target()

The choose_build_target is a macro with return:

macro(choose_build_target)
# Check whether the build is for a tool (sub-project for now)
  if (DEFINED ONNX_MLIR_TARGET_TO_BUILD)
    include(${ONNX_MLIR_TARGET_TO_BUILD}.cmake)
    return()
  endif()
# Otherwise, continue with default onnx-mlir project
endmacro()

In this PR, I introduced two new targets:

  1. OMPyInfer: the previous light-weight PyRuntime.
  2. OMCRuntime: the dynamic library for C Runtime used by model.so.

To build the target, in a build directory: cmake -DONNX_MLIR_TARGET_TO_BUILD=OMPyInfer /path/to/onnx-mlir

Test: the onnx-mlir and OMPyInfer is tested with zdlc_pyrt package.

In future, ${ONNX_MLIR_TARGET_TO_BUILD}.cmake will become the CMakeList.txt for its project.
No directory change is done in this PR.

Signed-off-by: Tong Chen <chentong@us.ibm.com>
Signed-off-by: Tong Chen <chentong@us.ibm.com>
Signed-off-by: Tong Chen <chentong@us.ibm.com>
Signed-off-by: Tong Chen <chentong@us.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant