Skip to content

Commit

Permalink
Added drivers as static dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Jegp committed Jan 6, 2025
1 parent 30ae8ea commit b301234
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
23 changes: 11 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,29 @@ endif()
#find_package(OpenCV REQUIRED)
#find_package(MetavisionSDK COMPONENTS core stream REQUIRED)
find_package(libcaer REQUIRED)
set(BUILD_SHARED_LIBS OFF)

# Initialize lists for sources and libraries
set(input_libraries "")
set(driver_input_libraries "")

# Add Metavision if found
if (${MetavisionSDK_FOUND})
message(STATUS "Prophesee dependencies (Metavision) found at ${MetavisionSDK_DIR}")
add_library(prophesee INTERFACE)
target_sources(prophesee INTERFACE src/cpp/prophesee.hpp)
target_link_libraries(prophesee INTERFACE MetavisionSDK::core MetavisionSDK::stream)
target_include_directories(prophesee INTERFACE ${MetavisionSDK_INCLUDE_DIRS})
add_library(prophesee STATIC src/cpp/prophesee.hpp)
target_link_libraries(prophesee PRIVATE MetavisionSDK::core MetavisionSDK::stream)
target_include_directories(prophesee PRIVATE ${MetavisionSDK_INCLUDE_DIRS})
set_property(TARGET prophesee PROPERTY LINKER_LANGUAGE CXX)
list(APPEND input_libraries prophesee)
list(APPEND driver_input_libraries prophesee)
endif()

# Add libcaer if found
if (${libcaer_FOUND})
message(STATUS "Inivation dependencies (libcaer) found at ${libcaer_DIR}")
add_library(inivation INTERFACE)
target_sources(inivation INTERFACE src/cpp/inivation.hpp)
target_link_libraries(inivation INTERFACE libcaer::caer)
target_include_directories(inivation INTERFACE ${libcaer_INCLUDE_DIRS})
add_library(inivation STATIC src/cpp/inivation.hpp)
target_link_libraries(inivation PRIVATE libcaer::caer)
target_include_directories(inivation PRIVATE ${libcaer_INCLUDE_DIRS})
set_property(TARGET inivation PROPERTY LINKER_LANGUAGE CXX)
list(APPEND input_libraries inivation)
list(APPEND driver_input_libraries inivation)
endif()

# Find Python and nanobind
Expand All @@ -64,7 +63,7 @@ nanobind_add_module(_event_camera_drivers
src/cpp/bindings.cpp
)
target_link_libraries(_event_camera_drivers PRIVATE
${input_libraries} # link the C++ libraries
${driver_input_libraries} # link the C++ libraries
)
target_include_directories(_event_camera_drivers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/event_camera_drivers.cpp)

Expand Down
4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
pythonEnv = pkgs.python311;
pyPkgs = pkgs.python311Packages;
pythonEnv = pkgs.python312;
pyPkgs = pkgs.python312Packages;

openebPackage = pkgs.stdenv.mkDerivation {
pname = "openeb";
Expand Down
1 change: 0 additions & 1 deletion src/cpp/inivation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ class InivationCamera {
handle = std::get<0>(found_device.value());
resolution_x = std::get<1>(found_device.value());
resolution_y = std::get<2>(found_device.value());
std::cout << "InivationCamera: Found device" << std::endl;
} else {
throw std::invalid_argument("No inivation device found.");
}
Expand Down

0 comments on commit b301234

Please sign in to comment.