Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPUNetIO Integration #879

Merged
merged 155 commits into from
May 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
3239a10
building and linking with doca, buut segfaults on test run
Oct 13, 2022
0651ff5
.
Oct 14, 2022
cda4e34
.
Oct 18, 2022
ba49ca9
doca source stage scaffolding
Oct 18, 2022
16de887
generating 1m rows from cpp to process in python
Oct 19, 2022
b5b24ed
.
Oct 19, 2022
953908e
ipp1-3403
Oct 20, 2022
d0d778c
wrap more doca c stuff
Oct 24, 2022
533c092
cuda 11.7
Oct 25, 2022
281b0d8
.
cwharris Oct 27, 2022
f04c68b
.
cwharris Oct 28, 2022
a125802
doca persistent, count, and gather kernels (not fully implemented)
cwharris Nov 1, 2022
b069e9c
batching multiplesemaphores in single count/gatheer passes
cwharris Nov 1, 2022
27aea77
count kernel timeout implemented
cwharris Nov 2, 2022
7b45877
stable receive/count/gatherkernel comms, no gather logic
cwharris Nov 3, 2022
bee7946
src/dst ip addresses from doca to morpheus dataframes
cwharris Nov 4, 2022
02c37f8
doca: output ip addresses as strings
cwharris Nov 5, 2022
15f9dbc
doca kernels: remove unused logic
cwharris Nov 5, 2022
fcf2db9
doca stable but packets dropping
cwharris Nov 6, 2022
55fb891
.
cwharris Nov 8, 2022
017c8da
doca source outputting src/dst mac address
cwharris Nov 9, 2022
dbdd771
add packet_length to doca source output
cwharris Nov 9, 2022
fe44742
doca source: fix src/dst mac mixup
cwharris Nov 9, 2022
394fc70
copy latest doca sample src
cwharris Nov 11, 2022
c501822
fix dpdk initialization
cwharris Nov 11, 2022
d67beb0
Updates
drobison00 Nov 11, 2022
98836f4
Typo fix
drobison00 Nov 11, 2022
7b392e4
add timestamp column
cwharris Nov 12, 2022
427b450
.
cwharris Nov 14, 2022
61c29df
doca packet payload gathering
cwharris Nov 15, 2022
06d1af4
.
cwharris Nov 16, 2022
f4f761b
Migrate doca libraries to new thirdparty package builder.
drobison00 Nov 16, 2022
cbc5184
Remove sneaky code
drobison00 Nov 16, 2022
1a8609f
Remove invalid options
drobison00 Nov 16, 2022
f06eae9
Tweak tini install
drobison00 Nov 16, 2022
792793b
Switch back to conda based TINI
drobison00 Nov 16, 2022
7a7041d
Remove old docker file
drobison00 Nov 16, 2022
908680a
Reorganize third party build structure for better extensibility going…
drobison00 Nov 17, 2022
0140913
Reorganize options
drobison00 Nov 17, 2022
87eba6a
Merge branch 'branch-22.11' into devin_issue_446
drobison00 Nov 17, 2022
9c2f63c
Make thirdparty libraries namespaced and globally available in their …
drobison00 Nov 17, 2022
c9a0739
.
cwharris Nov 21, 2022
a5c93df
.
cwharris Nov 21, 2022
e36f5b4
doca nic/gpu address python passthrough
cwharris Nov 21, 2022
c3fd612
add TCP optioonal timestamp parsing
cwharris Nov 22, 2022
6edd289
use new doca deb sources
cwharris Nov 28, 2022
6661ff6
Merge branch 'branch-22.11' into devin_issue_446
drobison00 Nov 28, 2022
bbd0c73
working deb files
cwharris Nov 28, 2022
20ce531
Merge branch 'branch-23.01' of github.com:nv-morpheus/Morpheus into d…
cwharris Nov 28, 2022
bbfa856
Merge branch 'branch-23.01' of github.com:nv-morpheus/Morpheus into d…
cwharris Nov 30, 2022
832c1c5
Merge remote-tracking branch 'drobison/devin_issue_446' into devin
cwharris Nov 30, 2022
d07f4d6
doca in it's own python module
cwharris Dec 1, 2022
e8b4e37
Merge branch 'devin' into doca-integration-refresh
cwharris Dec 1, 2022
08c13b0
.
cwharris Dec 1, 2022
3a52aaf
better doca/no-doca build support
cwharris Dec 2, 2022
67fcaf4
install libnuma1 in morpheus container build
cwharris Dec 2, 2022
9cdd708
Merge branch 'branch-23.01' of github.com:nv-morpheus/Morpheus into d…
cwharris Dec 2, 2022
3a4afe5
add from-doca to cli commands
cwharris Dec 2, 2022
5b385dd
unify payload size calculation
cwharris Jan 13, 2023
8aa17f0
fix payload-copy overshoot bug
cwharris Jan 13, 2023
fb26a62
Merge branch 'branch-23.01' of github.com:nv-morpheus/Morpheus into d…
cwharris Jan 17, 2023
d02417e
srf -> mrc rename
cwharris Jan 17, 2023
8d81634
filter GPUNetIO source based on HTTP GET/POST
cwharris Jan 17, 2023
bb0b15f
Merge branch 'branch-23.01' of github.com:nv-morpheus/Morpheus into d…
cwharris Jan 30, 2023
4cbe83a
rm filetypes
cwharris Feb 14, 2023
64da548
initial commit
mpenn Mar 15, 2023
b320cd4
deleting unnecessary files
mpenn Mar 15, 2023
4b4e84d
deleting unnecessary files
mpenn Mar 15, 2023
5e5c6a4
deleting unnecessary files
mpenn Mar 15, 2023
24eaddd
add error handling
cwharris Mar 15, 2023
b5d1a73
add extra CUDA_CHECK calls, fix a synchronization issue
cwharris Mar 16, 2023
f01d994
fix typo
cwharris Mar 16, 2023
3a331d1
Merge branch 'branch-23.03' of github.com:nv-morpheus/Morpheus into d…
cwharris Mar 16, 2023
f2ea853
Merge branch 'branch-23.03' of github.com:nv-morpheus/Morpheus into d…
cwharris Mar 16, 2023
6c11265
.
cwharris Mar 16, 2023
d40eec9
.
cwharris Mar 16, 2023
3c3adda
Merge branch 'branch-23.03' of github.com:nv-morpheus/Morpheus into d…
cwharris Mar 17, 2023
c940ba5
.
cwharris Mar 17, 2023
bf81f01
fix missing preallocator mixin, triton inference memory leak
cwharris Mar 20, 2023
5f596de
gpunetio kernel bug repro
cwharris Mar 28, 2023
9e996a0
doca2 updates failing
cwharris Apr 6, 2023
99cec26
update base container image to 22.04
cwharris Apr 6, 2023
340f90f
doca2 compiling not linking
cwharris Apr 7, 2023
73ca30d
doca2 compiles, does not link
cwharris Apr 12, 2023
5dcbb01
.
cwharris Apr 12, 2023
bc61baf
error logging, removing unncessary static lib links
cwharris Apr 13, 2023
36e2e75
copyright
cwharris Apr 13, 2023
180e821
Merge branch 'doca2' of github.com:cwharris/Morpheus into doca2
cwharris Apr 13, 2023
92c4941
Merge branch 'branch-23.07' of github.com:nv-morpheus/Morpheus into d…
cwharris Apr 13, 2023
4ef94b5
Merge branch 'doca2' of github.com:cwharris/Morpheus into doca2
cwharris Apr 13, 2023
58ff4a7
.
cwharris Apr 13, 2023
b7850bb
fix Dockerfile
cwharris Apr 25, 2023
67ae574
.
cwharris Apr 26, 2023
9772033
doca 2 fixes
cwharris Apr 27, 2023
5859fdc
clean up doca_context
cwharris Apr 29, 2023
5c7ecea
organize code and adjust naming conventions
cwharris Apr 30, 2023
244b43d
Merge branch 'branch-23.07' of github.com:nv-morpheus/Morpheus into d…
cwharris May 1, 2023
fb74d4c
remove models from bad merge
cwharris May 1, 2023
5556339
remove unnecessary library links
cwharris May 2, 2023
860e7d6
add Finddoca.cmake
cwharris May 2, 2023
7811567
gpunetio packet capture working with heavy logging
cwharris May 3, 2023
ed50327
.
cwharris May 3, 2023
7e6ceda
atomicAdd and BlockReduce work together and produce the same value
cwharris May 4, 2023
0c71502
clean up uncessary printfs and unnused variables
cwharris May 4, 2023
3877fc7
use doca _warp receive instead of _block receive
cwharris May 5, 2023
cf36b59
discovered GPUNetIO is receiving more packets than asked for.
cwharris May 5, 2023
4ec009b
work around subword_tokenize lack of only-whitespace support
cwharris May 5, 2023
cc0cfdb
repro payload overwrite bug
cwharris May 8, 2023
e3e58d0
Try copying packet buffer to fix illegal memory access
cwharris May 9, 2023
db963d1
refactor packet receive/gather kernels
cwharris May 9, 2023
7308a01
gpunetio integration stable
cwharris May 10, 2023
2fc85bc
Merge branch 'branch-23.07' of github.com:nv-morpheus/Morpheus into d…
cwharris May 10, 2023
42e34db
cleanup
cwharris May 10, 2023
0789b75
adjust preprocessing nlp stage for readability
cwharris May 11, 2023
be416b0
copyright headers
cwharris May 11, 2023
fe256aa
fix styles
cwharris May 15, 2023
7315dc6
add newlines to end of files
cwharris May 15, 2023
829da43
delete unused test_doca.cpp
cwharris May 15, 2023
61e0ad1
delete disabled source_ip_filter option from DocaSourceStage
cwharris May 15, 2023
6410108
cleanup
cwharris May 15, 2023
07b888d
remove elastic-search related files
cwharris May 15, 2023
cf16938
addressing comments
cwharris May 16, 2023
5e4973f
addressing comments
cwharris May 16, 2023
7ecb525
addressing review comments
cwharris May 16, 2023
819e054
addressing review comments
cwharris May 16, 2023
59b0376
addressing review comments
cwharris May 16, 2023
92166c5
address review comments
cwharris May 16, 2023
aa9eebe
address review comments
cwharris May 16, 2023
74788bc
address review comments
cwharris May 16, 2023
36d97c7
adding doc comments to doca-related classes
cwharris May 17, 2023
25d5255
adding doc comments to doca-related classes
cwharris May 17, 2023
6f534e0
removing ip filtering -related code from gpunetio integration
cwharris May 17, 2023
594e850
addressing review comments
cwharris May 16, 2023
649eab9
addressing review comments
cwharris May 16, 2023
77d462c
addressing review comments
cwharris May 17, 2023
5603f84
fix styles
cwharris May 17, 2023
aaeddb5
remove unused imports
cwharris May 18, 2023
f3af145
Merge branch 'branch-23.07' into doca2-rebase
cwharris May 18, 2023
3674693
Making separate compilation unit for doca
mdemoret-nv May 19, 2023
724da60
More cleanup
mdemoret-nv May 19, 2023
2c5c216
Adding error message if DOCA is not built
mdemoret-nv May 19, 2023
91564f9
IWYU fixes
mdemoret-nv May 19, 2023
56f912d
Fixing build
mdemoret-nv May 19, 2023
ac4eeb4
Improving error message
mdemoret-nv May 19, 2023
1b4fbc1
Style fixes
mdemoret-nv May 19, 2023
8bd3cc3
More style fixes
mdemoret-nv May 19, 2023
a1230ba
actually configure gdrcopy
cwharris May 19, 2023
9f2e584
Merge pull request #2 from mdemoret-nv/mdd_doca2
cwharris May 19, 2023
c7f39b9
Merge branch 'mdd_doca2' into doca2
cwharris May 19, 2023
6409d91
Updating copyright
mdemoret-nv May 19, 2023
b5b98d7
Installing gdrcopy in the docker container first
mdemoret-nv May 19, 2023
acf0a5d
remove Configure_gdrcopy.cmake
cwharris May 19, 2023
4a7a320
add -e to doca.sh install script
cwharris May 19, 2023
6d67804
remove references to Configure_gdrcopy.cmake
cwharris May 19, 2023
e157177
Improving the IWYU checks
mdemoret-nv May 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ CheckOptions:
- key: readability-identifier-naming.GetConfigPerFile
value: 'true'
- key: readability-identifier-naming.GlobalConstantCase
value: CamelCase
value: UPPER_CASE
- key: readability-identifier-naming.GlobalConstantIgnoredRegexp
value: ''
- key: readability-identifier-naming.GlobalConstantPrefix
Expand Down
6 changes: 3 additions & 3 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ services:
container_name: morpheus-triton
runtime: nvidia
image: nvcr.io/nvidia/tritonserver:22.10-py3
command: tritonserver --model-repository=/models --exit-on-error=false ${TRITON_MODEL_ARGS}
command: tritonserver --model-repository=/models/triton-model-repo --exit-on-error=false ${TRITON_MODEL_ARGS}
ports:
- 8000:8000
- 8001:8001
- 8002:8002
volumes:
- ${HOST_MORPHEUS_ROOT}/models/triton-model-repo:/models
- ${HOST_MORPHEUS_ROOT}/examples/abp_pcap_detection/abp-pcap-xgb:/models/abp-pcap-xgb
- ${HOST_MORPHEUS_ROOT}/models:/models
- ${HOST_MORPHEUS_ROOT}/examples/abp_pcap_detection/abp-pcap-xgb:/models/triton-model-repo/abp-pcap-xgb

zookeeper:
image: bitnami/zookeeper:latest
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/opt/morpheus/bin/post-attach-command.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/opt/morpheus/bin/update-content-command.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
31 changes: 19 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ option(MORPHEUS_PYTHON_BUILD_STUBS "Whether or not to generated .pyi stub files
option(MORPHEUS_PYTHON_BUILD_WHEEL "Whether or not to build the morpheus .whl file" OFF)
option(MORPHEUS_PYTHON_INPLACE_BUILD "Whether or not to copy built python modules back to the source tree for debug purposes." OFF)
option(MORPHEUS_PYTHON_PERFORM_INSTALL "Whether or not to automatically `pip install` any built python library. WARNING: This may overwrite any existing installation of the same name." OFF)
option(MORPHEUS_SUPPORT_DOCA "Whether or not to build doca-related elements of morpheus" OFF)
option(MORPHEUS_USE_CCACHE "Enable caching compilation results with ccache" OFF)
option(MORPHEUS_USE_CLANG_TIDY "Enable running clang-tidy as part of the build process" OFF)
option(MORPHEUS_USE_CONDA "Enables finding dependencies via conda instead of vcpkg. Note: This will disable vcpkg. All dependencies must be installed first in the conda environment" OFF)
Expand All @@ -44,11 +45,13 @@ mark_as_advanced(MORPHEUS_CACHE_DIR)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_RPATH "$ORIGIN")

# Disable compile commands until after dependencies
set(CMAKE_EXPORT_COMPILE_COMMANDS OFF)

enable_testing()

if (MORPHEUS_USE_IWYU AND MORPHEUS_USE_CCACHE)
Expand All @@ -57,14 +60,15 @@ endif()

# MRC CMake path and module extensions
set(MORPHEUS_CMAKE_MODULE_PATH_EXTENSIONS
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/external/utilities/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/external/utilities/cmake/morpheus_utils/package_search"
)
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/package_search"
"${CMAKE_CURRENT_SOURCE_DIR}/external/utilities/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/external/utilities/cmake/morpheus_utils/package_search"
)

set(MORPHEUS_CMAKE_PREFIX_PATH_EXTENSIONS
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
)
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
)

# Prepend path and prefix updates so they take priority in this scope.
list(PREPEND CMAKE_MODULE_PATH "${MORPHEUS_CMAKE_MODULE_PATH_EXTENSIONS}")
Expand Down Expand Up @@ -127,6 +131,9 @@ add_custom_target(${PROJECT_NAME}_style_checks
##### Morpheus Python Setup ######
##################################

# Re-enable compile commands
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

morpheus_utils_python_configure()

# Include the main morpheus code
Expand Down Expand Up @@ -167,14 +174,14 @@ if(MORPHEUS_ENABLE_DEBUG_INFO)
morpheus_utils_print_all_targets()

morpheus_utils_print_target_properties(
TARGETS
morpheus
morpheus_utils
WRITE_TO_FILE
TARGETS
morpheus
morpheus_utils
WRITE_TO_FILE
)

morpheus_utils_print_global_properties(
WRITE_TO_FILE
WRITE_TO_FILE
)
endif()

Expand Down
15 changes: 13 additions & 2 deletions ci/scripts/cpp_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,20 @@ if [[ -n "${MORPHEUS_MODIFIED_FILES}" ]]; then

# Include What You Use
if [[ "${SKIP_IWYU}" == "" ]]; then
IWYU_DIRS="morpheus"
# Remove .h, .hpp, and .cu files from the modified list
shopt -s extglob
IWYU_MODIFIED_FILES=( "${MORPHEUS_MODIFIED_FILES[@]/*.@(h|hpp|cu)/}" )

# Get the list of compiled files relative to this directory
WORKING_PREFIX="${PWD}/"
COMPILED_FILES=( $(jq -r .[].file ${BUILD_DIR}/compile_commands.json | sort -u ) )
COMPILED_FILES=( "${COMPILED_FILES[@]/#$WORKING_PREFIX/}" )

# Find the intersection between compiled files and modified files
IWYU_MODIFIED_FILES=( $(printf '%s\0' "${COMPILED_FILES[@]} ${IWYU_MODIFIED_FILES[@]}" | sort -z | uniq -d -z | xargs -0n1) )

NUM_PROC=$(get_num_proc)
IWYU_OUTPUT=`${IWYU_TOOL} -p ${BUILD_DIR} -j ${NUM_PROC} ${IWYU_DIRS} 2>&1`
IWYU_OUTPUT=`${IWYU_TOOL} -p ${BUILD_DIR} -j ${NUM_PROC} ${IWYU_MODIFIED_FILES[@]} 2>&1`
IWYU_RETVAL=$?
fi
else
Expand Down
3 changes: 3 additions & 0 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ if (VERBOSE)
morpheus_utils_print_config()
endif()

# First, load the package_config functions
include(${CMAKE_CURRENT_LIST_DIR}/package_config/register_api.cmake)

# Load direct physical package dependencies first, so we fail early. Add all dependencies to our export set
rapids_find_package(Protobuf
REQUIRED
Expand Down
53 changes: 0 additions & 53 deletions cmake/environment/init_compiler.cmake

This file was deleted.

66 changes: 0 additions & 66 deletions cmake/environment/init_coverage.cmake

This file was deleted.

117 changes: 117 additions & 0 deletions cmake/package_config/bsd/Configure_bsd.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

include_guard()

function(morpheus_configure_libbsd)
list(APPEND CMAKE_MESSAGE_CONTEXT "libbsd")

set(MORPHEUS_LIBBSD_VERSION "0.11.7" CACHE STRING "Version of libbsd to build")

# Check if bsd is available -- download if not
rapids_cpm_find(bsd ${MORPHEUS_LIBBSD_VERSION}
GLOBAL_TARGETS bsd
CPM_ARGS
GIT_REPOSITORY https://gitlab.freedesktop.org/libbsd/libbsd
GIT_TAG ${MORPHEUS_LIBBSD_VERSION}
DOWNLOAD_ONLY TRUE
)

if (bsd_ADDED)
message(STATUS "libbsd was not installed and will be built from source")

find_package(bsd REQUIRED)

set(bsd_INSTALL_DIR ${bsd_BINARY_DIR}/install)
file(MAKE_DIRECTORY ${bsd_INSTALL_DIR}/include)
include(ExternalProject)

string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE_UC)

# Get libmd components
get_target_property(MD_INCLUDE_DIRS md::md INTERFACE_INCLUDE_DIRECTORIES) # Add '-I' to CPPFLAGS
get_target_property(MD_LIBRARY md::md IMPORTED_LOCATION) # Add '-L' to LDFLAGS

cmake_path(GET MD_LIBRARY PARENT_PATH MD_LINK_DIRECTORY)

message(STATUS "MD_LIBRARY: ${MD_LINK_DIRECTORY}")

# Get the Compiler settings to forward onto autoconf
set(COMPILER_SETTINGS
"CXX=${CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_CXX_COMPILER}"
"CPP=${CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER} -E"
"CC=${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER}"
"AR=${CMAKE_C_COMPILER_AR}"
"RANLIB=${CMAKE_C_COMPILER_RANLIB}"
"NM=${CMAKE_NM}"
"STRIP=${CMAKE_STRIP}"
"CFLAGS=${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BUILD_TYPE_UC}}"
"CPPFLAGS=${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BUILD_TYPE_UC}} -I${MD_INCLUDE_DIRS}"
"CXXFLAGS=${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BUILD_TYPE_UC}}"
"LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${BUILD_TYPE_UC}} -L${MD_LINK_DIRECTORY}"
)

ExternalProject_Add(bsd
PREFIX ${bsd_BINARY_DIR} # Root directory for bsd
SOURCE_DIR ${bsd_BINARY_DIR} # Move source over from cpm dir and build in binary dir
INSTALL_DIR ${bsd_INSTALL_DIR}

DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy_directory ${bsd_SOURCE_DIR} ${bsd_BINARY_DIR}
# Note, we set SED and GREP here since they can be hard coded in the conda libtoolize
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env SED=sed GREP=grep <SOURCE_DIR>/autogen
COMMAND <SOURCE_DIR>/configure ${COMPILER_SETTINGS} --prefix=${CMAKE_INSTALL_PREFIX} --enable-static

BUILD_COMMAND make -j
BUILD_IN_SOURCE TRUE
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libbsd.a
INSTALL_COMMAND make install prefix=<INSTALL_DIR>
LOG_CONFIGURE TRUE
LOG_BUILD TRUE
LOG_INSTALL TRUE
# Add a target for configuring to allow for style checks on source code
STEP_TARGETS install
DEPENDS md::md
)

# Install only the headers
install(
DIRECTORY ${md_INSTALL_DIR}/include
TYPE INCLUDE
)

add_library(bsd::bsd STATIC IMPORTED GLOBAL)
set_target_properties(bsd::bsd
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES
"$<BUILD_INTERFACE:${bsd_INSTALL_DIR}/include>;$<INSTALL_INTERFACE:include>"
INTERFACE_LINK_LIBRARIES
"md::md"
INTERFACE_POSITION_INDEPENDENT_CODE
"ON"
IMPORTED_LOCATION
"${bsd_INSTALL_DIR}/lib/libbsd.a"
IMPORTED_SONAME
"libbsd.a"
)

add_dependencies(bsd::bsd bsd)

message(STATUS "bsd_INSTALL_DIR: ${bsd_INSTALL_DIR}")

endif()

LIST(POP_BACK CMAKE_MESSAGE_CONTEXT)

endfunction()
Loading