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

Fix issues with building using CMake #7

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion com_nvidia_gxf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ if(NOT TARGET CUDA::nvtx3)
endif()

find_package(yaml-cpp REQUIRED)
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
if(NOT TARGET yaml-cpp::yaml-cpp)
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
endif()
find_package(nlohmann_json REQUIRED)
find_package(breakpad REQUIRED)
find_package(gflags REQUIRED)
Expand Down
5 changes: 5 additions & 0 deletions com_nvidia_gxf/cmake/modules/Findbreakpad.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@ find_file(
PATHS
"${breakpad_ROOT}/client/linux/handler"
"${breakpad_ROOT}/include/client/linux/handler"
"${breakpad_ROOT}/include/breakpad/client/linux/handler"
REQUIRED
)

cmake_path(GET breakpad_exception_handler_header PARENT_PATH breakpad_exception_handler_include_dir)
cmake_path(APPEND breakpad_exception_handler_include_dir ../../..)
cmake_path(ABSOLUTE_PATH breakpad_exception_handler_include_dir NORMALIZE OUTPUT_VARIABLE breakpad_INCLUDE_DIR)

add_library(breakpad STATIC IMPORTED)
set_target_properties(breakpad
PROPERTIES IMPORTED_LOCATION ${breakpad_STATIC_LIB}
Expand Down
10 changes: 9 additions & 1 deletion com_nvidia_gxf/gxf/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,16 @@ target_link_libraries(core
)
add_library(GXF::core ALIAS core)

#######################################################################################
# Pybind11 extensions
#######################################################################################

pybind11_add_module(core_pybind SHARED "bindings/core.cpp")
target_link_libraries(core_pybind PUBLIC GXF::core)


install(
TARGETS core_c_api;core_internal;core
TARGETS core_c_api;core_internal;core;core_pybind
EXPORT gxfCoreTargets
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/core
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
#include "gxf/core/entity_item.hpp"
#include "gxf/core/gxf.h"

TEST(Create_Entity, NULL_Value) {
TEST(Create_Entity, GetItem_NULL_Value) {
gxf_uid_t eid = kNullUid;
const GxfEntityCreateInfo entity_create_info = {0};
void* item_ptr = nullptr;
Expand All @@ -22,7 +22,7 @@ TEST(Create_Entity, NULL_Value) {
ASSERT_EQ(GxfContextDestroy(NULL), GXF_CONTEXT_INVALID);
}

TEST(Create_Entity, valid_context) {
TEST(Create_Entity, GetItem_valid_context) {
gxf_context_t context = kNullContext;
ASSERT_EQ(GxfContextCreate(&context), GXF_SUCCESS);
gxf_uid_t eid = kNullUid;
Expand All @@ -34,7 +34,7 @@ TEST(Create_Entity, valid_context) {
ASSERT_EQ(GxfContextDestroy(context), GXF_SUCCESS);
}

TEST(Create_Entity, NULL_GxfEntityCreateInfo) {
TEST(Create_Entity, GetItem_NULL_GxfEntityCreateInfo) {
gxf_context_t context = kNullContext;
GXF_ASSERT_SUCCESS(GxfContextCreate(&context));
gxf_uid_t eid = kNullUid;
Expand All @@ -43,7 +43,7 @@ TEST(Create_Entity, NULL_GxfEntityCreateInfo) {
ASSERT_EQ(item_ptr, nullptr);
}

TEST(Create_Entity, Invalid_GxfEntityCreateInfo) {
TEST(Create_Entity, GetItem_Invalid_GxfEntityCreateInfo) {
gxf_context_t context = kNullContext;
const char* InValid_Entity_Name = "__Entity1";
const GxfEntityCreateInfo entity_create_info{InValid_Entity_Name};
Expand All @@ -57,7 +57,7 @@ TEST(Create_Entity, Invalid_GxfEntityCreateInfo) {
ASSERT_EQ(GxfContextDestroy(context), GXF_SUCCESS);
}

TEST(Create_Entity, Multiple_Entity_with_same_name) {
TEST(Create_Entity, GetItem_Multiple_Entity_with_same_name) {
gxf_context_t context = kNullContext;
gxf_uid_t eid = kNullUid;
gxf_uid_t eid1 = kNullUid;
Expand All @@ -77,7 +77,7 @@ TEST(Create_Entity, Multiple_Entity_with_same_name) {
ASSERT_EQ(GxfContextDestroy(context), GXF_SUCCESS);
}

TEST(Create_Entity, NULL_eid) {
TEST(Create_Entity, GetItem_NULL_eid) {
gxf_context_t context = kNullContext;
const char* Valid_Entity_Name = "Entity";
GXF_ASSERT_SUCCESS(GxfContextCreate(&context));
Expand Down
22 changes: 21 additions & 1 deletion com_nvidia_gxf/gxf/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@ gxf_core_add_extension_library(
CUDA::cudart
)

#######################################################################################
# Pybind11 extensions
#######################################################################################

pybind11_add_module(cuda_pybind SHARED "bindings/cuda.cpp")
target_link_libraries(cuda_pybind PUBLIC GXF::common GXF::core GXF::std CUDA::cudart)


install(
TARGETS cuda_pybind
EXPORT gxfCoreTargets
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/cuda
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/cuda
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/cuda
COMPONENT Core
)

if(BUILD_TESTING)
add_subdirectory(tests)
endif()
endif()
4 changes: 2 additions & 2 deletions com_nvidia_gxf/gxf/cuda/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ gxf_core_add_extension_library(
PUBLIC_HEADERS test_cuda_helper.hpp
PUBLIC_DEPENDS
CUDA::cublas
GXF::cuda
GXF::common
GXF::core
GXF::cuda
GXF::std
GTest::gtest_main
NO_INSTALL
Expand All @@ -35,9 +35,9 @@ gxf_add_gtests(
test_cuda_stream_dotproduct.yaml
test_cuda_unit.yaml
DEPENDS
GXF::cuda
GXF::common
GXF::core
GXF::cuda
GXF::std
GTest::gtest_main
)
22 changes: 11 additions & 11 deletions com_nvidia_gxf/gxf/ipc/grpc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
###################################################################################################

find_package(gRPC CONFIG REQUIRED)
include(FetchContent)
set(grpc_health_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/grpc_health_proto-src")
set(grpc_health_BUILD_DIR "${CMAKE_BINARY_DIR}/_deps/grpc_health_proto-build")
FetchContent_Declare(
grpc_health_proto
URM_HASH "MD5=93c62f9d6b1925cf3e8822d590484589"
DOWNLOAD_NO_EXTRACT TRUE
SOURCE_DIR ${grpc_health_SOURCE_DIR}
URL "https://raw.githubusercontent.com/grpc/grpc/v${gRPC_VERSION}/src/proto/grpc/health/v1/health.proto"
)
FetchContent_MakeAvailable(grpc_health_proto)
include(FetchContent)
set(grpc_health_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/grpc_health_proto-src")
set(grpc_health_BUILD_DIR "${CMAKE_BINARY_DIR}/_deps/grpc_health_proto-build")
FetchContent_Declare(
grpc_health_proto
URM_HASH "MD5=93c62f9d6b1925cf3e8822d590484589"
DOWNLOAD_NO_EXTRACT TRUE
SOURCE_DIR ${grpc_health_SOURCE_DIR}
URL "https://raw.githubusercontent.com/grpc/grpc/v${gRPC_VERSION}/src/proto/grpc/health/v1/health.proto"
)
FetchContent_MakeAvailable(grpc_health_proto)

set(grpc_health_proto_SOURCES ${grpc_health_SOURCE_DIR}/health.proto)
set(grpc_health_GEN_SOURCES
Expand Down
23 changes: 23 additions & 0 deletions com_nvidia_gxf/gxf/multimedia/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,29 @@ gxf_core_add_extension_library(
GXF::std
)


#######################################################################################
# Pybind11 extensions
#######################################################################################

pybind11_add_module(video_pybind SHARED "bindings/video.cpp")
target_link_libraries(video_pybind PUBLIC GXF::core GXF::std)

pybind11_add_module(camera_pybind SHARED "bindings/camera.cpp")
target_link_libraries(camera_pybind PUBLIC GXF::core GXF::std)

install(
TARGETS video_pybind;camera_pybind
EXPORT gxfCoreTargets
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/multimedia
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/multimedia
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/multimedia
COMPONENT Core
)

if(BUILD_TESTING)
add_subdirectory(tests)
endif()
24 changes: 23 additions & 1 deletion com_nvidia_gxf/gxf/python_codelet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,34 @@ gxf_core_add_extension_library(
SOURCES
py_codelet.cpp
python_codelet.cpp
pydata.hpp
PUBLIC_HEADERS
pydata.hpp
py_codelet.hpp
PUBLIC_DEPENDS
GXF::core
GXF::std
pybind11::pybind11
Python3::Python
)

#######################################################################################
# Pybind11 extensions
#######################################################################################

pybind11_add_module(pycodelet SHARED "bindings/pycodelet.cpp")
target_link_libraries(pycodelet PUBLIC GXF::core GXF::std GXF::python_codelet)

pybind11_add_module(pydata_pybind SHARED "bindings/pydata.cpp")
target_link_libraries(pydata_pybind PUBLIC GXF::core GXF::std)

install(
TARGETS pycodelet;pydata_pybind
EXPORT gxfCoreTargets
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/multimedia
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/multimedia
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/multimedia
COMPONENT Core
)
2 changes: 1 addition & 1 deletion com_nvidia_gxf/gxf/python_codelet/py_codelet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace gxf {

/// C++ side bridge of python codelet. This is the type which all python codelets register.
/// Mandatory params - codelet_name_, codelet_filepath_
class __attribute__((visibility("hidden"))) PyCodeletV0 : public Codelet {
class PyCodeletV0 : public Codelet {
public:
gxf_result_t registerInterface(Registrar* registrar) override;
gxf_result_t start() override;
Expand Down
36 changes: 35 additions & 1 deletion com_nvidia_gxf/gxf/std/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,42 @@ target_link_libraries(std
add_library(GXF::std ALIAS std)
set(GXF_EXTENSION_LIBRARY_TARGETS "std;${GXF_EXTENSION_LIBRARY_TARGETS}" PARENT_SCOPE)

#######################################################################################
# Pybind11 extensions
#######################################################################################

pybind11_add_module(vault_pybind SHARED "bindings/vault.cpp")
target_link_libraries(vault_pybind PUBLIC GXF::core GXF::std)

pybind11_add_module(allocator_pybind SHARED "bindings/allocator.cpp")
target_link_libraries(allocator_pybind PUBLIC GXF::core GXF::std)

pybind11_add_module(clock_pybind SHARED "bindings/clock.cpp")
target_link_libraries(clock_pybind PUBLIC GXF::core GXF::std)

pybind11_add_module(receiver_pybind SHARED "bindings/receiver.cpp")
target_link_libraries(receiver_pybind PUBLIC GXF::core GXF::std)

pybind11_add_module(tensor_pybind SHARED "bindings/tensor.cpp")
target_link_libraries(tensor_pybind PUBLIC GXF::core GXF::std)

pybind11_add_module(scheduling_terms_pybind SHARED "bindings/scheduling_terms.cpp")
target_link_libraries(scheduling_terms_pybind PUBLIC GXF::core GXF::std)

pybind11_add_module(timestamp_pybind SHARED "bindings/timestamp.cpp")
target_link_libraries(timestamp_pybind PUBLIC GXF::core GXF::std)

pybind11_add_module(eos_pybind SHARED "bindings/eos.cpp")
target_link_libraries(eos_pybind PUBLIC GXF::core GXF::std)

pybind11_add_module(transmitter_pybind SHARED "bindings/transmitter.cpp")
target_link_libraries(transmitter_pybind PUBLIC GXF::core GXF::std)

pybind11_add_module(scheduling_condition_pybind SHARED "bindings/scheduling_condition.cpp")
target_link_libraries(scheduling_condition_pybind PUBLIC GXF::core GXF::std)

install(
TARGETS std_internal;std
TARGETS std_internal;std;vault_pybind;allocator_pybind;clock_pybind;receiver_pybind;tensor_pybind;scheduling_terms_pybind;timestamp_pybind;eos_pybind;transmitter_pybind;scheduling_condition_pybind
EXPORT gxfCoreTargets
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/std
Expand Down
3 changes: 2 additions & 1 deletion com_nvidia_gxf/gxf/std/gems/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(STD_GEMS_UTILS_SOURCES time.cpp)
set(STD_GEMS_UTILS_SOURCES time.cpp storage_size.cpp)
set(STD_GEMS_UTILS_HEADERS
exponential_moving_average.hpp
fast_running_median.hpp
time.hpp
storage_size.hpp
)

add_library(std_gems_utils_internal OBJECT ${STD_GEMS_UTILS_SOURCES})
Expand Down