diff --git a/.gitmodules b/.gitmodules index 5cb0502..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +0,0 @@ -[submodule "extern/3DObjectTracking"] - path = extern/3DObjectTracking - url = git@github.com:DLR-RM/3DObjectTracking.git - branch = master diff --git a/CMakeLists.txt b/CMakeLists.txt index f0e65ee..9dd93c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,33 +1,41 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.11) project(pym3t LANGUAGES CXX) -find_package(pybind11 CONFIG REQUIRED) +option(USE_AZURE_KINECT "Use Azure Kinect" OFF) +option(USE_REALSENSE "Use RealSense D435" ON) +option(USE_GTEST "Use gtest" OFF) -# TODO: find a way to pass these options as command line arguments -set(USE_AZURE_KINECT OFF CACHE BOOL "Use Azure Kinect") -set(USE_REALSENSE ON CACHE BOOL "Use RealSense D435") -set(USE_GTEST OFF CACHE BOOL "Use gtest") +cmake_policy(SET CMP0148 OLD) # required for current pybind11 -set(CMAKE_BUILD_TYPE "RELEASE") -# set(CMAKE_BUILD_TYPE "DEBUG") +# set(CMAKE_BUILD_TYPE "RELEASE") set(CMAKE_BUILD_TYPE "DEBUG") -set(CMAKE_CXX_STANDARD 17) - -# We need libraries to be generated with Position Independent Code -# otherwise compilation error in the pybind11 code -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") - -add_subdirectory(extern/3DObjectTracking/M3T) +include(FetchContent) +FetchContent_Declare( + pybind11 + GIT_REPOSITORY "https://github.com/pybind/pybind11" + GIT_TAG "v2.11.1") +FetchContent_Declare( + m3t + GIT_REPOSITORY "https://github.com/DLR-RM/3DObjectTracking.git" + GIT_TAG "master" + SOURCE_SUBDIR "M3T" CMAKE_ARGS "-DUSE_AZURE_KINECT=${USE_AZURE_KINECT}" + "-DUSE_REALSENSE=${USE_REALSENSE}" "-DUSE_GTEST=${USE_GTEST}") +FetchContent_MakeAvailable(pybind11 m3t) # Create library for the extensions to m3t -add_library(m3t_ext src/dummy_camera.cpp) -target_include_directories(m3t_ext PUBLIC include) +add_library(m3t_ext src/dummy_camera.cpp include/pym3t/dummy_camera.h) +target_compile_features(m3t_ext PUBLIC cxx_std_17) +target_include_directories( + m3t_ext + PUBLIC $ + $ + $) target_link_libraries(m3t_ext PUBLIC m3t) pybind11_add_module(_pym3t_mod MODULE src/pym3t.cpp) -target_link_libraries(_pym3t_mod PUBLIC m3t) target_link_libraries(_pym3t_mod PUBLIC m3t_ext) -target_compile_features(_pym3t_mod PUBLIC cxx_std_17) -target_include_directories(_pym3t_mod PUBLIC include) +target_include_directories( + _pym3t_mod PUBLIC $ + $) -install(TARGETS _pym3t_mod DESTINATION pym3t) \ No newline at end of file +install(TARGETS _pym3t_mod DESTINATION pym3t) diff --git a/extern/3DObjectTracking b/extern/3DObjectTracking deleted file mode 160000 index 35c26c4..0000000 --- a/extern/3DObjectTracking +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 35c26c4c6582f4e9ea12b4ad285c7f760f64c588 diff --git a/include/pym3t/dummy_camera.h b/include/pym3t/dummy_camera.h index 27a6358..8ff0195 100644 --- a/include/pym3t/dummy_camera.h +++ b/include/pym3t/dummy_camera.h @@ -2,7 +2,7 @@ #ifndef M3t_INCLUDE_M3t_dummy_camera_H_ #define M3t_INCLUDE_M3t_dummy_camera_H_ -#include +#include #include #include diff --git a/pyproject.toml b/pyproject.toml index 33aafe2..d399b19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] # build time dependencies, installed in an isolated environment -requires = ["scikit-build-core", "pybind11"] +requires = ["scikit-build-core"] # use scikit-build instead of setuptools build-backend = "scikit_build_core.build"