From 7abfdf77e2b4071746b5f4278cc9f6e4bc0cfdab Mon Sep 17 00:00:00 2001 From: Michael Demoret <42954918+mdemoret-nv@users.noreply.github.com> Date: Wed, 23 Oct 2024 23:10:25 -0400 Subject: [PATCH] Fix CMake issue which installed headers incorrectly during conda build (#511) Fixes a few issues: - Headers were being installed incorrectly with new `HEADER_SET` - Fixed packages for pymrc component - Standardized the component naming Closes #509 Authors: - Michael Demoret (https://github.com/mdemoret-nv) Approvers: - Anuradha Karuppiah (https://github.com/AnuradhaKaruppiah) - Christopher Harris (https://github.com/cwharris) URL: https://github.com/nv-morpheus/MRC/pull/511 --- ci/conda/README.md | 8 ++++---- cpp/mrc/CMakeLists.txt | 5 +++-- external/utilities | 2 +- protos/CMakeLists.txt | 3 ++- python/CMakeLists.txt | 12 ++++-------- python/mrc/_pymrc/CMakeLists.txt | 25 ++++++++++++++++++++----- python/mrc/_pymrc/tests/CMakeLists.txt | 2 -- 7 files changed, 34 insertions(+), 23 deletions(-) diff --git a/ci/conda/README.md b/ci/conda/README.md index 56e6045fb..a471105df 100644 --- a/ci/conda/README.md +++ b/ci/conda/README.md @@ -4,7 +4,7 @@ To build the Conda packages, it's recommended to run the provided scripts from a ```bash cd ${MRC_ROOT} -docker buildx build --target developement -t mrc-conda-build . +docker buildx build --target development -t mrc-conda-build . ``` This will create the image `mrc-conda-build` that can be used to build MRC conda packages. When running this container, is recommended to set the environment variable `CONDA_PKGS_DIRS` to a path mounted on the host to speed up the build process. Without this variable set, the packages needed during the build will need to be re-downloaded each time the container is run. @@ -16,14 +16,14 @@ To build and save the MRC conda package, run the following: ```bash docker run --rm -ti -v $PWD:/work \ -e CONDA_PKGS_DIRS=/work/.cache/conda_pkgs \ - -e CONDA_ARGS="--output-folder=/work/.conda-bld" \ + -e CONDA_ARGS="--output-folder=/work/.tmp/.conda-bld" \ mrc-conda-build ./ci/conda/recipes/run_conda_build.sh ``` -This will save the conda packages to `${MRC_ROOT}/.conda-bld`. To install from this location, use the following: +This will save the conda packages to `${MRC_ROOT}/.tmp/.conda-bld`. To install from this location, use the following: ```bash -conda install -c file://${MRC_ROOT}/.conda-bld mrc +conda install -c file://${MRC_ROOT}/.tmp/.conda-bld mrc ``` ## Uploading the Conda Package diff --git a/cpp/mrc/CMakeLists.txt b/cpp/mrc/CMakeLists.txt index 10d57f9e3..1dfb37487 100644 --- a/cpp/mrc/CMakeLists.txt +++ b/cpp/mrc/CMakeLists.txt @@ -259,9 +259,10 @@ include(GNUInstallDirs) install( TARGETS libmrc - DESTINATION ${lib_dir} EXPORT ${PROJECT_NAME}-exports - COMPONENT Core + COMPONENT core + LIBRARY + DESTINATION ${lib_dir} FILE_SET public_headers ) diff --git a/external/utilities b/external/utilities index 6e10e2c9a..87b33dd0b 160000 --- a/external/utilities +++ b/external/utilities @@ -1 +1 @@ -Subproject commit 6e10e2c9a686041fdeb3d9e100874c6fa55f0856 +Subproject commit 87b33dd0b7fd3d7460742bc5ad13d77e0d722c3c diff --git a/protos/CMakeLists.txt b/protos/CMakeLists.txt index e9cd0e325..8fe421e19 100644 --- a/protos/CMakeLists.txt +++ b/protos/CMakeLists.txt @@ -94,8 +94,9 @@ add_dependencies(${PROJECT_NAME}_style_checks mrc_protos-headers-target) install( TARGETS mrc_protos mrc_architect_protos EXPORT ${PROJECT_NAME}-exports + COMPONENT core PUBLIC_HEADER - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/protos" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/protos" ) list(REMOVE_ITEM CMAKE_MODULE_PATH ${MRC_PROTO_MODULE_PATH_EXTENSIONS}) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index b9efadd17..542e16036 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,13 +15,9 @@ list(APPEND CMAKE_MESSAGE_CONTEXT "python") -find_package(CUDAToolkit REQUIRED) - - # Ensure python is configured morpheus_utils_python_configure() - morpheus_utils_print_python_info() # Create the mrc python package @@ -30,9 +26,9 @@ morpheus_utils_create_python_package(mrc) # Add a few additional files to be copied file(GLOB pymrc_test_files "${CMAKE_CURRENT_SOURCE_DIR}/tests/*.py") morpheus_utils_add_python_sources( - "pytest.ini" - "tests/string_reader_input.txt" - ${pymrc_test_files} + "pytest.ini" + "tests/string_reader_input.txt" + ${pymrc_test_files} ) # Build the pymrc library diff --git a/python/mrc/_pymrc/CMakeLists.txt b/python/mrc/_pymrc/CMakeLists.txt index 2fab9a4f6..ea26bf645 100644 --- a/python/mrc/_pymrc/CMakeLists.txt +++ b/python/mrc/_pymrc/CMakeLists.txt @@ -14,9 +14,23 @@ include(GenerateExportHeader) -find_package(Python 3.8 REQUIRED COMPONENTS Development Interpreter) -find_package(pybind11 REQUIRED) -find_package(prometheus-cpp REQUIRED) +rapids_find_package(Python 3.8 REQUIRED + COMPONENTS + Development + Interpreter + BUILD_EXPORT_SET ${PROJECT_NAME}-python-exports + INSTALL_EXPORT_SET ${PROJECT_NAME}-python-exports +) + +rapids_find_package(pybind11 REQUIRED + BUILD_EXPORT_SET ${PROJECT_NAME}-python-exports + INSTALL_EXPORT_SET ${PROJECT_NAME}-python-exports +) + +rapids_find_package(prometheus-cpp REQUIRED + BUILD_EXPORT_SET ${PROJECT_NAME}-python-exports + INSTALL_EXPORT_SET ${PROJECT_NAME}-python-exports +) # Keep all source files sorted!!! add_library(pymrc @@ -120,9 +134,10 @@ include(GNUInstallDirs) install( TARGETS pymrc - DESTINATION ${lib_dir} EXPORT ${PROJECT_NAME}-python-exports - COMPONENT Python + COMPONENT python + LIBRARY + DESTINATION ${lib_dir} FILE_SET public_headers ) diff --git a/python/mrc/_pymrc/tests/CMakeLists.txt b/python/mrc/_pymrc/tests/CMakeLists.txt index c056bb2cc..d7c87e89d 100644 --- a/python/mrc/_pymrc/tests/CMakeLists.txt +++ b/python/mrc/_pymrc/tests/CMakeLists.txt @@ -15,8 +15,6 @@ list(APPEND CMAKE_MESSAGE_CONTEXT "tests") -find_package(pybind11 REQUIRED) - add_subdirectory(coro) # Keep all source files sorted!!!