Skip to content

Commit

Permalink
Fix CMake issue which installed headers incorrectly during conda build (
Browse files Browse the repository at this point in the history
#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: #511
  • Loading branch information
mdemoret-nv authored Oct 24, 2024
1 parent a4b2ca1 commit 7abfdf7
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 23 deletions.
8 changes: 4 additions & 4 deletions ci/conda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions cpp/mrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
3 changes: 2 additions & 1 deletion protos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
12 changes: 4 additions & 8 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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
Expand All @@ -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
Expand Down
25 changes: 20 additions & 5 deletions python/mrc/_pymrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)

Expand Down
2 changes: 0 additions & 2 deletions python/mrc/_pymrc/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

list(APPEND CMAKE_MESSAGE_CONTEXT "tests")

find_package(pybind11 REQUIRED)

add_subdirectory(coro)

# Keep all source files sorted!!!
Expand Down

0 comments on commit 7abfdf7

Please sign in to comment.