diff --git a/com_nvidia_gxf/CMakeLists.txt b/com_nvidia_gxf/CMakeLists.txt index bef89cb..d5b5523 100644 --- a/com_nvidia_gxf/CMakeLists.txt +++ b/com_nvidia_gxf/CMakeLists.txt @@ -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) @@ -115,17 +117,27 @@ find_package(rmm 24.04 REQUIRED) # https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html unset(PACKAGE_VERSION) -find_package(Python3 - COMPONENTS Interpreter Development - REQUIRED -) +# Need to find Python early to ensure consistent lookup between sub-projects and +# functions +find_package(Python REQUIRED COMPONENTS Interpreter Development) + +# Ensure that even other packages that use find_package(Python3 ...) will find +# the same Python +set(Python3_EXECUTABLE + "${Python_EXECUTABLE}" + CACHE FILEPATH "Path to the Python interpreter" FORCE) +set(PYTHON_EXECUTABLE + "${Python_EXECUTABLE}" + CACHE FILEPATH "Path to the Python interpreter" FORCE) +mark_as_advanced(Python3_EXECUTABLE PYTHON_EXECUTABLE) +find_package(Python3 REQUIRED COMPONENTS Interpreter Development) find_package(pybind11 REQUIRED) find_package(GTest REQUIRED) find_package(gRPC CONFIG REQUIRED) if(BUILD_TESTING OR GXF_BUILD_TESTING) - enable_testing() + enable_testing() endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") diff --git a/com_nvidia_gxf/CMakePresets.json b/com_nvidia_gxf/CMakePresets.json index 3151568..a3efde0 100644 --- a/com_nvidia_gxf/CMakePresets.json +++ b/com_nvidia_gxf/CMakePresets.json @@ -11,6 +11,7 @@ "hidden": true, "generator": "Ninja", "cacheVariables": { + "CMAKE_POLICY_DEFAULT_CMP0167": "OLD", "CMAKE_BUILD_TYPE": "Release", "BUILD_TESTING": { "type": "BOOL", diff --git a/com_nvidia_gxf/cmake/modules/Findbreakpad.cmake b/com_nvidia_gxf/cmake/modules/Findbreakpad.cmake index d8ce100..1278417 100644 --- a/com_nvidia_gxf/cmake/modules/Findbreakpad.cmake +++ b/com_nvidia_gxf/cmake/modules/Findbreakpad.cmake @@ -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} diff --git a/com_nvidia_gxf/gxf/core/CMakeLists.txt b/com_nvidia_gxf/gxf/core/CMakeLists.txt index dabc8a1..7929e59 100644 --- a/com_nvidia_gxf/gxf/core/CMakeLists.txt +++ b/com_nvidia_gxf/gxf/core/CMakeLists.txt @@ -125,8 +125,17 @@ target_link_libraries(core ) add_library(GXF::core ALIAS core) +####################################################################################### +# Pybind11 extensions +####################################################################################### + +pybind11_add_module(core_pybind SHARED WITHOUT_SOABI "bindings/core.cpp") +set_target_properties(core_pybind PROPERTIES OUTPUT_NAME "core_pybind" PREFIX "") +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 diff --git a/com_nvidia_gxf/gxf/core/tests/test_gxf_core_GxfCreateEntityAndGetItem.cpp b/com_nvidia_gxf/gxf/core/tests/test_gxf_core_GxfCreateEntityAndGetItem.cpp index 0e86c3a..135ea34 100644 --- a/com_nvidia_gxf/gxf/core/tests/test_gxf_core_GxfCreateEntityAndGetItem.cpp +++ b/com_nvidia_gxf/gxf/core/tests/test_gxf_core_GxfCreateEntityAndGetItem.cpp @@ -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; @@ -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; @@ -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; @@ -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}; @@ -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; @@ -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)); diff --git a/com_nvidia_gxf/gxf/cuda/CMakeLists.txt b/com_nvidia_gxf/gxf/cuda/CMakeLists.txt index aa03936..432b4ea 100644 --- a/com_nvidia_gxf/gxf/cuda/CMakeLists.txt +++ b/com_nvidia_gxf/gxf/cuda/CMakeLists.txt @@ -5,43 +5,80 @@ # 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 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software +# 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. -gxf_core_add_extension_library( - NAME cuda - SOURCES - cuda.cpp - cuda_allocator.cpp - cuda_event.cpp - cuda_scheduling_terms.cpp - cuda_stream.cpp - cuda_stream_pool.cpp - cuda_stream_sync.cpp - stream_ordered_allocator.cpp - PUBLIC_HEADERS - cuda_allocator.hpp - cuda_buffer.hpp - cuda_common.hpp - cuda_event.hpp - cuda_scheduling_terms.hpp - cuda_stream.hpp - cuda_stream_id.hpp - cuda_stream_pool.hpp - cuda_stream_sync.hpp - stream_ordered_allocator.hpp - PUBLIC_DEPENDS - GXF::common - GXF::core - GXF::std - CUDA::cudart +set(GXF_CUDA_SOURCES + cuda.cpp + cuda_allocator.cpp + cuda_event.cpp + cuda_scheduling_terms.cpp + cuda_stream.cpp + cuda_stream_pool.cpp + cuda_stream_sync.cpp + stream_ordered_allocator.cpp) +set(GXF_CUDA_HEADERS + cuda_allocator.hpp + cuda_buffer.hpp + cuda_common.hpp + cuda_event.hpp + cuda_scheduling_terms.hpp + cuda_stream.hpp + cuda_stream_id.hpp + cuda_stream_pool.hpp + cuda_stream_sync.hpp + stream_ordered_allocator.hpp) +add_library(cuda SHARED ${GXF_CUDA_SOURCES}) +set_target_properties(cuda + PROPERTIES + OUTPUT_NAME "gxf_cuda" + PUBLIC_HEADER "${GXF_CUDA_HEADERS}" + INSTALL_RPATH "$ORIGIN:$ORIGIN/../core:$ORIGIN/../std" +) + +target_compile_features(cuda PUBLIC cuda_std_20) +target_compile_options(cuda PUBLIC $<$:--expt-relaxed-constexpr>) +target_include_directories(cuda PUBLIC $ + $) +target_link_libraries(cuda PUBLIC GXF::common GXF::core GXF::std CUDA::cudart) +add_library(GXF::cuda ALIAS cuda) + +include(GNUInstallDirs) +install( + TARGETS cuda + 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 cuda) +set(GXF_EXTENSION_LIBRARY_TARGETS "cuda;${GXF_EXTENSION_LIBRARY_TARGETS}" PARENT_SCOPE) + +####################################################################################### +# Pybind11 extensions +####################################################################################### + +pybind11_add_module(cuda_pybind SHARED WITHOUT_SOABI "bindings/cuda.cpp") +set_target_properties(cuda_pybind PROPERTIES OUTPUT_NAME "cuda_pybind" PREFIX "") +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() \ No newline at end of file + add_subdirectory(tests) +endif() diff --git a/com_nvidia_gxf/gxf/cuda/tests/CMakeLists.txt b/com_nvidia_gxf/gxf/cuda/tests/CMakeLists.txt index c8c90fd..b0507b2 100644 --- a/com_nvidia_gxf/gxf/cuda/tests/CMakeLists.txt +++ b/com_nvidia_gxf/gxf/cuda/tests/CMakeLists.txt @@ -17,17 +17,29 @@ gxf_core_add_extension_library( NAME test_cuda SOURCES test_cuda_ext.cpp - PUBLIC_HEADERS test_cuda_helper.hpp + PUBLIC_HEADERS test_cuda_helper.hpp convolution.h PUBLIC_DEPENDS CUDA::cublas + GXF::cuda GXF::common GXF::core - GXF::cuda GXF::std GTest::gtest_main NO_INSTALL ) +install( + TARGETS test_cuda + PUBLIC_HEADER + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/cuda/tests + ARCHIVE + DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/cuda/tests + LIBRARY + DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/cuda/tests + COMPONENT test + COMPONENT test +) + gxf_add_gtests( EXT_NAME CUDA SOURCES test_cuda_unit.cpp @@ -35,9 +47,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 ) diff --git a/com_nvidia_gxf/gxf/ipc/grpc/CMakeLists.txt b/com_nvidia_gxf/gxf/ipc/grpc/CMakeLists.txt index 72019af..c9a3d2b 100644 --- a/com_nvidia_gxf/gxf/ipc/grpc/CMakeLists.txt +++ b/com_nvidia_gxf/gxf/ipc/grpc/CMakeLists.txt @@ -30,17 +30,17 @@ set(_GRPC_CPP_PLUGIN_EXECUTABLE $) ################################################################################################### 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 diff --git a/com_nvidia_gxf/gxf/ipc/http/CMakeLists.txt b/com_nvidia_gxf/gxf/ipc/http/CMakeLists.txt index 984c10a..467f892 100644 --- a/com_nvidia_gxf/gxf/ipc/http/CMakeLists.txt +++ b/com_nvidia_gxf/gxf/ipc/http/CMakeLists.txt @@ -31,6 +31,17 @@ gxf_core_add_extension_library( GXF::std ) +install( + TARGETS http + PUBLIC_HEADER + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/ipc/http + ARCHIVE + DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/ipc/http + LIBRARY + DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/ipc/http + COMPONENT http +) + if(BUILD_TESTING) add_subdirectory(tests) endif() diff --git a/com_nvidia_gxf/gxf/multimedia/CMakeLists.txt b/com_nvidia_gxf/gxf/multimedia/CMakeLists.txt index f9e9cfa..d36de85 100644 --- a/com_nvidia_gxf/gxf/multimedia/CMakeLists.txt +++ b/com_nvidia_gxf/gxf/multimedia/CMakeLists.txt @@ -13,19 +13,59 @@ # See the License for the specific language governing permissions and # limitations under the License. -gxf_core_add_extension_library( - NAME multimedia - SOURCES +set(GXF_MULTIMEDIA_SOURCES audio.cpp multimedia.cpp - video.cpp - PUBLIC_HEADERS + video.cpp) +set(GXF_MULTIMEDIA_HEADERS audio.hpp camera.hpp - video.hpp - PUBLIC_DEPENDS - GXF::core - GXF::std + video.hpp) +add_library(multimedia SHARED ${GXF_MULTIMEDIA_SOURCES}) +set_target_properties(multimedia + PROPERTIES + OUTPUT_NAME "gxf_multimedia" + PUBLIC_HEADER "${GXF_MULTIMEDIA_HEADERS}" + INSTALL_RPATH "$ORIGIN:$ORIGIN/../core:$ORIGIN/../std" +) + +target_include_directories(multimedia PUBLIC $ + $) +target_link_libraries(multimedia PUBLIC GXF::core GXF::std) +add_library(GXF::multimedia ALIAS multimedia) + +include(GNUInstallDirs) +install( + TARGETS multimedia + 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 multimedia) +set(GXF_EXTENSION_LIBRARY_TARGETS "multimedia;${GXF_EXTENSION_LIBRARY_TARGETS}" PARENT_SCOPE) + +####################################################################################### +# Pybind11 extensions +####################################################################################### + +pybind11_add_module(video_pybind SHARED WITHOUT_SOABI "bindings/video.cpp") +set_target_properties(video_pybind PROPERTIES OUTPUT_NAME "video_pybind" PREFIX "") +target_link_libraries(video_pybind PUBLIC GXF::core GXF::std) + +pybind11_add_module(camera_pybind SHARED WITHOUT_SOABI "bindings/camera.cpp") +set_target_properties(camera_pybind PROPERTIES OUTPUT_NAME "camera_pybind" PREFIX "") +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 multimedia ) if(BUILD_TESTING) diff --git a/com_nvidia_gxf/gxf/python_codelet/CMakeLists.txt b/com_nvidia_gxf/gxf/python_codelet/CMakeLists.txt index 4c65187..4fbff15 100644 --- a/com_nvidia_gxf/gxf/python_codelet/CMakeLists.txt +++ b/com_nvidia_gxf/gxf/python_codelet/CMakeLists.txt @@ -13,17 +13,80 @@ # See the License for the specific language governing permissions and # limitations under the License. -gxf_core_add_extension_library( - NAME python_codelet - SOURCES - py_codelet.cpp - python_codelet.cpp +set(GXF_PYTHON_CODELET_SOURCES py_codelet.cpp python_codelet.cpp) +set(GXF_PYTHON_CODELET_HEADERS pydata.hpp - PUBLIC_HEADERS py_codelet.hpp - PUBLIC_DEPENDS +) +add_library(python_codelet SHARED + ${GXF_PYTHON_CODELET_SOURCES} +) +set_target_properties(python_codelet + PROPERTIES + OUTPUT_NAME "gxf_python_codelet" + PUBLIC_HEADER "${GXF_PYTHON_CODELET_HEADERS}" + INSTALL_RPATH "$ORIGIN:$ORIGIN/../core:$ORIGIN/../std" +) +target_include_directories(python_codelet + PUBLIC + $ + $ +) +target_link_libraries(python_codelet + PUBLIC GXF::core GXF::std pybind11::pybind11 Python3::Python ) +add_library(GXF::python_codelet ALIAS python_codelet) + +include(GNUInstallDirs) +install( + TARGETS python_codelet + EXPORT gxfCoreTargets + PUBLIC_HEADER + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/python_codelet + ARCHIVE + DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/python_codelet + LIBRARY + DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/python_codelet + COMPONENT python_codelet +) +set(GXF_EXTENSION_LIBRARY_TARGETS "python_codelet;${GXF_EXTENSION_LIBRARY_TARGETS}" PARENT_SCOPE) + +####################################################################################### +# Pybind11 extensions +####################################################################################### + +pybind11_add_module(pycodelet SHARED WITHOUT_SOABI "bindings/pycodelet.cpp") +set_target_properties(pycodelet PROPERTIES OUTPUT_NAME "pycodelet" PREFIX "") +target_link_libraries(pycodelet PUBLIC GXF::core GXF::std GXF::python_codelet) + +pybind11_add_module(pydata_pybind SHARED WITHOUT_SOABI "bindings/pydata.cpp") +set_target_properties(pydata_pybind PROPERTIES OUTPUT_NAME "pydata_pybind" PREFIX "") +target_link_libraries(pydata_pybind PUBLIC GXF::core GXF::std) + +install( + TARGETS 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 +) + +install( + TARGETS pycodelet + EXPORT gxfCoreTargets + PUBLIC_HEADER + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/python_codelet + ARCHIVE + DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/python_codelet + LIBRARY + DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/python_codelet + COMPONENT Core +) diff --git a/com_nvidia_gxf/gxf/python_codelet/py_codelet.hpp b/com_nvidia_gxf/gxf/python_codelet/py_codelet.hpp index 6cda7fa..2606072 100644 --- a/com_nvidia_gxf/gxf/python_codelet/py_codelet.hpp +++ b/com_nvidia_gxf/gxf/python_codelet/py_codelet.hpp @@ -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; diff --git a/com_nvidia_gxf/gxf/serialization/tests/CMakeLists.txt b/com_nvidia_gxf/gxf/serialization/tests/CMakeLists.txt index 88dd6e7..71a4f50 100644 --- a/com_nvidia_gxf/gxf/serialization/tests/CMakeLists.txt +++ b/com_nvidia_gxf/gxf/serialization/tests/CMakeLists.txt @@ -27,6 +27,13 @@ gxf_core_add_extension_library( GXF::std ) +install( + TARGETS serialization_test_extension + PUBLIC_HEADER + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/serialization/tests + COMPONENT test +) + gxf_add_gtests( EXT_NAME Serialization SOURCES diff --git a/com_nvidia_gxf/gxf/std/CMakeLists.txt b/com_nvidia_gxf/gxf/std/CMakeLists.txt index ebefa14..a1b4b08 100644 --- a/com_nvidia_gxf/gxf/std/CMakeLists.txt +++ b/com_nvidia_gxf/gxf/std/CMakeLists.txt @@ -111,6 +111,7 @@ set(GXF_STD_INTERNAL_PUBLIC_HEADERS graph_driver.hpp graph_driver_worker_common.hpp graph_worker.hpp + ipc_client.hpp ipc_server.hpp job_statistics.hpp memory_buffer.hpp @@ -220,12 +221,57 @@ target_link_libraries(std GXF::common GXF::core GXF::std_internal + dlpack::dlpack ) 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 WITHOUT_SOABI "bindings/vault.cpp") +set_target_properties(vault_pybind PROPERTIES OUTPUT_NAME "vault_pybind" PREFIX "") +target_link_libraries(vault_pybind PUBLIC GXF::core GXF::std) + +pybind11_add_module(allocator_pybind SHARED WITHOUT_SOABI "bindings/allocator.cpp") +set_target_properties(allocator_pybind PROPERTIES OUTPUT_NAME "allocator_pybind" PREFIX "") +target_link_libraries(allocator_pybind PUBLIC GXF::core GXF::std) + +pybind11_add_module(clock_pybind SHARED WITHOUT_SOABI "bindings/clock.cpp") +set_target_properties(clock_pybind PROPERTIES OUTPUT_NAME "clock_pybind" PREFIX "") +target_link_libraries(clock_pybind PUBLIC GXF::core GXF::std) + +pybind11_add_module(receiver_pybind SHARED WITHOUT_SOABI "bindings/receiver.cpp") +set_target_properties(receiver_pybind PROPERTIES OUTPUT_NAME "receiver_pybind" PREFIX "") +target_link_libraries(receiver_pybind PUBLIC GXF::core GXF::std) + +pybind11_add_module(tensor_pybind SHARED WITHOUT_SOABI "bindings/tensor.cpp") +set_target_properties(tensor_pybind PROPERTIES OUTPUT_NAME "tensor_pybind" PREFIX "") +target_link_libraries(tensor_pybind PUBLIC GXF::core GXF::std) + +pybind11_add_module(scheduling_terms_pybind SHARED WITHOUT_SOABI "bindings/scheduling_terms.cpp") +set_target_properties(scheduling_terms_pybind PROPERTIES OUTPUT_NAME "scheduling_terms_pybind" PREFIX "") +target_link_libraries(scheduling_terms_pybind PUBLIC GXF::core GXF::std) + +pybind11_add_module(timestamp_pybind SHARED WITHOUT_SOABI "bindings/timestamp.cpp") +set_target_properties(timestamp_pybind PROPERTIES OUTPUT_NAME "timestamp_pybind" PREFIX "") +target_link_libraries(timestamp_pybind PUBLIC GXF::core GXF::std) + +pybind11_add_module(eos_pybind SHARED WITHOUT_SOABI "bindings/eos.cpp") +set_target_properties(eos_pybind PROPERTIES OUTPUT_NAME "eos_pybind" PREFIX "") +target_link_libraries(eos_pybind PUBLIC GXF::core GXF::std) + +pybind11_add_module(transmitter_pybind SHARED WITHOUT_SOABI "bindings/transmitter.cpp") +set_target_properties(transmitter_pybind PROPERTIES OUTPUT_NAME "transmitter_pybind" PREFIX "") +target_link_libraries(transmitter_pybind PUBLIC GXF::core GXF::std) + +pybind11_add_module(scheduling_condition_pybind SHARED WITHOUT_SOABI "bindings/scheduling_condition.cpp") +set_target_properties(scheduling_condition_pybind PROPERTIES OUTPUT_NAME "scheduling_condition_pybind" PREFIX "") +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 diff --git a/com_nvidia_gxf/gxf/std/gems/CMakeLists.txt b/com_nvidia_gxf/gxf/std/gems/CMakeLists.txt index 04b11a7..7a94d80 100644 --- a/com_nvidia_gxf/gxf/std/gems/CMakeLists.txt +++ b/com_nvidia_gxf/gxf/std/gems/CMakeLists.txt @@ -5,9 +5,9 @@ # 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 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software +# 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 @@ -15,6 +15,9 @@ add_subdirectory(event_list) add_subdirectory(pool) +add_subdirectory(queue_thread) add_subdirectory(staging_queue) +add_subdirectory(suballocators) add_subdirectory(timed_job_list) add_subdirectory(utils) +add_subdirectory(video_buffer) diff --git a/com_nvidia_gxf/gxf/std/gems/queue_thread/CMakeLists.txt b/com_nvidia_gxf/gxf/std/gems/queue_thread/CMakeLists.txt new file mode 100644 index 0000000..edc57b4 --- /dev/null +++ b/com_nvidia_gxf/gxf/std/gems/queue_thread/CMakeLists.txt @@ -0,0 +1,34 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 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. + +add_library(std_gems_queue_thread_queue_thread INTERFACE) +set_target_properties(std_gems_queue_thread_queue_thread + PROPERTIES PUBLIC_HEADER "queue_thread.hpp") +target_link_libraries(std_gems_queue_thread_queue_thread INTERFACE GXF::common) +add_library(GXF::std::gems::queue_thread::queue_thread ALIAS + std_gems_queue_thread_queue_thread) + +# Convenience aliases +add_library(std_gems_queue_thread INTERFACE) +target_link_libraries(std_gems_queue_thread + INTERFACE std_gems_queue_thread_queue_thread) +add_library(GXF::std::gems::queue_thread ALIAS std_gems_queue_thread) + +install( + TARGETS std_gems_queue_thread_queue_thread std_gems_queue_thread + EXPORT gxfCoreTargets + PUBLIC_HEADER + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/std/gems/queue_thread + COMPONENT Core) diff --git a/com_nvidia_gxf/gxf/std/gems/suballocators/CMakeLists.txt b/com_nvidia_gxf/gxf/std/gems/suballocators/CMakeLists.txt new file mode 100644 index 0000000..5c3f324 --- /dev/null +++ b/com_nvidia_gxf/gxf/std/gems/suballocators/CMakeLists.txt @@ -0,0 +1,58 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 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. + +set(STD_GEMS_SUBALLOCATORS_SUFFIXES first_fit_allocator_base + first_fit_allocator) + +add_library(std_gems_suballocators_first_fit_allocator_base OBJECT + first_fit_allocator_base.cpp) +target_include_directories( + std_gems_suballocators_first_fit_allocator_base + PUBLIC $ + $) +set_target_properties(std_gems_suballocators_first_fit_allocator_base + PROPERTIES PUBLIC_HEADER "first_fit_allocator_base.hpp") + +add_library(std_gems_suballocators_first_fit_allocator INTERFACE) +set_target_properties(std_gems_suballocators_first_fit_allocator + PROPERTIES PUBLIC_HEADER "first_fit_allocator.hpp") +target_link_libraries( + std_gems_suballocators_first_fit_allocator + INTERFACE std_gems_suballocators_first_fit_allocator_base GXF::common) + +# Export/install + +set(STD_GEMS_SUBALLOCATORS_TARGET_NAMES "") +foreach(_suffix ${STD_GEMS_SUBALLOCATORS_SUFFIXES}) + set(_target_name std_gems_suballocators_${_suffix}) + list(APPEND STD_GEMS_SUBALLOCATORS_TARGET_NAMES "${_target_name}") + add_library(GXF::std::gems::suballocators::${_suffix} ALIAS ${_target_name}) +endforeach() + +# Convenience aliases + +add_library(std_gems_suballocators INTERFACE) +target_link_libraries(std_gems_suballocators + INTERFACE ${STD_GEMS_SUBALLOCATORS_TARGET_NAMES}) +add_library(GXF::std::gems::suballocators ALIAS std_gems_suballocators) + +# Export/install + +install( + TARGETS ${STD_GEMS_SUBALLOCATORS_TARGET_NAMES};std_gems_suballocators + EXPORT gxfCoreTargets + PUBLIC_HEADER + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/std/gems/suballocators + COMPONENT Core) diff --git a/com_nvidia_gxf/gxf/std/gems/utils/CMakeLists.txt b/com_nvidia_gxf/gxf/std/gems/utils/CMakeLists.txt index 40fa46c..c80d646 100644 --- a/com_nvidia_gxf/gxf/std/gems/utils/CMakeLists.txt +++ b/com_nvidia_gxf/gxf/std/gems/utils/CMakeLists.txt @@ -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}) diff --git a/com_nvidia_gxf/gxf/std/gems/video_buffer/CMakeLists.txt b/com_nvidia_gxf/gxf/std/gems/video_buffer/CMakeLists.txt new file mode 100644 index 0000000..ab02ad4 --- /dev/null +++ b/com_nvidia_gxf/gxf/std/gems/video_buffer/CMakeLists.txt @@ -0,0 +1,54 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 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. + +set(STD_GEMS_VIDEO_BUFFER_SUFFIXES video_buffer allocator) + +add_library(std_gems_video_buffer_allocator INTERFACE) +target_include_directories( + std_gems_video_buffer_allocator + INTERFACE $ + $) +set_target_properties(std_gems_video_buffer_allocator + PROPERTIES PUBLIC_HEADER "allocator.hpp") +target_link_libraries(std_gems_video_buffer_allocator INTERFACE GXF::multimedia) + +add_library(std_gems_video_buffer_video_buffer INTERFACE) +target_link_libraries(std_gems_video_buffer_video_buffer + INTERFACE std_gems_video_buffer_allocator) + +# Export/install + +set(STD_GEMS_VIDEO_BUFFER_TARGET_NAMES "") +foreach(_suffix ${STD_GEMS_VIDEO_BUFFER_SUFFIXES}) + set(_target_name std_gems_video_buffer_${_suffix}) + list(APPEND STD_GEMS_VIDEO_BUFFER_TARGET_NAMES "${_target_name}") + add_library(GXF::std::gems::video_buffer::${_suffix} ALIAS ${_target_name}) +endforeach() + +# Convenience aliases + +add_library(std_gems_video_buffer INTERFACE) +target_link_libraries(std_gems_video_buffer + INTERFACE ${STD_GEMS_VIDEO_BUFFER_TARGET_NAMES}) +add_library(GXF::std::gems::video_buffer ALIAS std_gems_video_buffer) + +# Export/install + +install( + TARGETS ${STD_GEMS_VIDEO_BUFFER_TARGET_NAMES};std_gems_video_buffer + EXPORT gxfCoreTargets + PUBLIC_HEADER + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/std/gems/video_buffer + COMPONENT Core) diff --git a/com_nvidia_gxf/gxf/stream/tests/CMakeLists.txt b/com_nvidia_gxf/gxf/stream/tests/CMakeLists.txt index 8921f61..7e48248 100644 --- a/com_nvidia_gxf/gxf/stream/tests/CMakeLists.txt +++ b/com_nvidia_gxf/gxf/stream/tests/CMakeLists.txt @@ -27,6 +27,13 @@ gxf_core_add_extension_library( GXF::stream ) +install( + TARGETS test_stream_sync_cuda + PUBLIC_HEADER + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gxf/stream/tests + COMPONENT test +) + gxf_add_gtests( EXT_NAME Stream SOURCES diff --git a/com_nvidia_gxf/gxf/test/extensions/CMakeLists.txt b/com_nvidia_gxf/gxf/test/extensions/CMakeLists.txt index d6c8c31..6e13e03 100644 --- a/com_nvidia_gxf/gxf/test/extensions/CMakeLists.txt +++ b/com_nvidia_gxf/gxf/test/extensions/CMakeLists.txt @@ -14,18 +14,28 @@ # limitations under the License. gxf_core_add_extension_library( - NAME test_extension - SOURCES - test.cpp - PUBLIC_HEADERS - test_helpers.hpp - test_metric.hpp - test_parameters.hpp - PUBLIC_DEPENDS - GTest::gtest_main - GXF::common - GXF::core - GXF::std - PRIVATE_DEPENDS - GXF::test::components + NAME test_extension + SOURCES + test.cpp + PUBLIC_HEADERS + test_helpers.hpp + test_metric.hpp + test_parameters.hpp + PUBLIC_DEPENDS + GTest::gtest_main + GXF::common + GXF::core + GXF::std + PRIVATE_DEPENDS + GXF::test::components +) +set_target_properties(test_extension PROPERTIES OUTPUT_NAME "gxf_test") + +install( + TARGETS test_extension + ARCHIVE + DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/test/extensions + LIBRARY + DESTINATION ${CMAKE_INSTALL_LIBDIR}/gxf/test/extensions + COMPONENT test )