Skip to content

Commit c170be6

Browse files
authored
Merge pull request #2 from nim65s/master
update CMake
2 parents 6ee2d2f + 7924f00 commit c170be6

File tree

5 files changed

+31
-28
lines changed

5 files changed

+31
-28
lines changed

.gitmodules

-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
[submodule "extern/3DObjectTracking"]
2-
path = extern/3DObjectTracking
3-
url = git@github.com:DLR-RM/3DObjectTracking.git
4-
branch = master

CMakeLists.txt

+29-21
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,41 @@
1-
cmake_minimum_required(VERSION 3.10)
1+
cmake_minimum_required(VERSION 3.11)
22
project(pym3t LANGUAGES CXX)
33

4-
find_package(pybind11 CONFIG REQUIRED)
4+
option(USE_AZURE_KINECT "Use Azure Kinect" OFF)
5+
option(USE_REALSENSE "Use RealSense D435" ON)
6+
option(USE_GTEST "Use gtest" OFF)
57

6-
# TODO: find a way to pass these options as command line arguments
7-
set(USE_AZURE_KINECT OFF CACHE BOOL "Use Azure Kinect")
8-
set(USE_REALSENSE ON CACHE BOOL "Use RealSense D435")
9-
set(USE_GTEST OFF CACHE BOOL "Use gtest")
8+
cmake_policy(SET CMP0148 OLD) # required for current pybind11
109

11-
set(CMAKE_BUILD_TYPE "RELEASE")
12-
# set(CMAKE_BUILD_TYPE "DEBUG")
10+
# set(CMAKE_BUILD_TYPE "RELEASE") set(CMAKE_BUILD_TYPE "DEBUG")
1311

14-
set(CMAKE_CXX_STANDARD 17)
15-
16-
# We need libraries to be generated with Position Independent Code
17-
# otherwise compilation error in the pybind11 code
18-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
19-
20-
add_subdirectory(extern/3DObjectTracking/M3T)
12+
include(FetchContent)
13+
FetchContent_Declare(
14+
pybind11
15+
GIT_REPOSITORY "https://github.com/pybind/pybind11"
16+
GIT_TAG "v2.11.1")
17+
FetchContent_Declare(
18+
m3t
19+
GIT_REPOSITORY "https://github.com/DLR-RM/3DObjectTracking.git"
20+
GIT_TAG "master"
21+
SOURCE_SUBDIR "M3T" CMAKE_ARGS "-DUSE_AZURE_KINECT=${USE_AZURE_KINECT}"
22+
"-DUSE_REALSENSE=${USE_REALSENSE}" "-DUSE_GTEST=${USE_GTEST}")
23+
FetchContent_MakeAvailable(pybind11 m3t)
2124

2225
# Create library for the extensions to m3t
23-
add_library(m3t_ext src/dummy_camera.cpp)
24-
target_include_directories(m3t_ext PUBLIC include)
26+
add_library(m3t_ext src/dummy_camera.cpp include/pym3t/dummy_camera.h)
27+
target_compile_features(m3t_ext PUBLIC cxx_std_17)
28+
target_include_directories(
29+
m3t_ext
30+
PUBLIC $<INSTALL_INTERFACE:include>
31+
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
32+
$<BUILD_INTERFACE:${m3t_SOURCE_DIR}/include>)
2533
target_link_libraries(m3t_ext PUBLIC m3t)
2634

2735
pybind11_add_module(_pym3t_mod MODULE src/pym3t.cpp)
28-
target_link_libraries(_pym3t_mod PUBLIC m3t)
2936
target_link_libraries(_pym3t_mod PUBLIC m3t_ext)
30-
target_compile_features(_pym3t_mod PUBLIC cxx_std_17)
31-
target_include_directories(_pym3t_mod PUBLIC include)
37+
target_include_directories(
38+
_pym3t_mod PUBLIC $<INSTALL_INTERFACE:include>
39+
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>)
3240

33-
install(TARGETS _pym3t_mod DESTINATION pym3t)
41+
install(TARGETS _pym3t_mod DESTINATION pym3t)

extern/3DObjectTracking

-1
This file was deleted.

include/pym3t/dummy_camera.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#ifndef M3t_INCLUDE_M3t_dummy_camera_H_
33
#define M3t_INCLUDE_M3t_dummy_camera_H_
44

5-
#include <filesystem/filesystem.h>
5+
#include <filesystem>
66
#include <m3t/camera.h>
77
#include <m3t/common.h>
88

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
22
# build time dependencies, installed in an isolated environment
3-
requires = ["scikit-build-core", "pybind11"]
3+
requires = ["scikit-build-core"]
44
# use scikit-build instead of setuptools
55
build-backend = "scikit_build_core.build"
66

0 commit comments

Comments
 (0)