From 230dafabbc64247175f1c204eabb359feee5d43b Mon Sep 17 00:00:00 2001 From: awelling2801 Date: Wed, 7 Oct 2026 12:32:45 -0400 Subject: [PATCH] fix(rocm): keep the mps-parser wheel from including WheelHelpers via the wrong source dir data_model/CMakeLists.txt is built by both the cuopt and rocopt_mps_parser projects. The libmps_parser.so install included WheelHelpers.cmake through CMAKE_SOURCE_DIR, which only exists for the cuopt wheel, so the rocopt_mps_parser build failed. Co-authored-by: Cursor --- .../data_model/CMakeLists.txt | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/python/cuopt/cuopt/linear_programming/data_model/CMakeLists.txt b/python/cuopt/cuopt/linear_programming/data_model/CMakeLists.txt index 2f2a27c702..4ae6763798 100644 --- a/python/cuopt/cuopt/linear_programming/data_model/CMakeLists.txt +++ b/python/cuopt/cuopt/linear_programming/data_model/CMakeLists.txt @@ -11,13 +11,23 @@ rapids_cython_create_modules(SOURCE_FILES "${cython_sources}" LINKED_LIBRARIES " # data_model_wrapper's compiled extension module is built with # INSTALL_RPATH=$ORIGIN, i.e. it expects libmps_parser.so to live right next -# to it in the installed wheel. cuopt::mps_parser (an IMPORTED target -- -# see the parent CMakeLists.txt) was never actually copied there, which +# to it in the installed cuopt wheel. cuopt::mps_parser (an IMPORTED target -- +# see python/cuopt/CMakeLists.txt) was never actually copied there, which # made `from cuopt.linear_programming.data_model import data_model_wrapper` # (and therefore `import cuopt`) fail at runtime with # "libmps_parser.so: cannot open shared object file". -include(${CMAKE_SOURCE_DIR}/cmake/Modules/WheelHelpers.cmake) -install_aliased_imported_targets( - TARGETS cuopt::mps_parser - DESTINATION cuopt/linear_programming/data_model -) +# +# This directory is also add_subdirectory()'d by the standalone +# mpsparser-python project (rocopt_mps_parser). That project's +# CMAKE_SOURCE_DIR is python/cuopt/cuopt/linear_programming, which has no +# cmake/Modules/WheelHelpers.cmake, so a CMAKE_SOURCE_DIR-relative include +# fails the wheel build. WheelHelpers.cmake lives in the cuopt Python +# project; the mps-parser project already installs libmps_parser.so beside +# its own extensions and must not install into the cuopt wheel layout. +if(PROJECT_NAME STREQUAL "cuopt-python") + include(${CMAKE_CURRENT_LIST_DIR}/../../../cmake/Modules/WheelHelpers.cmake) + install_aliased_imported_targets( + TARGETS cuopt::mps_parser + DESTINATION cuopt/linear_programming/data_model + ) +endif()