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

update CMake #2

Merged
merged 5 commits into from
Feb 9, 2024
Merged
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: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
[submodule "extern/3DObjectTracking"]
path = extern/3DObjectTracking
url = git@github.com:DLR-RM/3DObjectTracking.git
branch = master
50 changes: 29 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 $<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${m3t_SOURCE_DIR}/include>)
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_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>)

install(TARGETS _pym3t_mod DESTINATION pym3t)
install(TARGETS _pym3t_mod DESTINATION pym3t)
1 change: 0 additions & 1 deletion extern/3DObjectTracking
Submodule 3DObjectTracking deleted from 35c26c
2 changes: 1 addition & 1 deletion include/pym3t/dummy_camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#ifndef M3t_INCLUDE_M3t_dummy_camera_H_
#define M3t_INCLUDE_M3t_dummy_camera_H_

#include <filesystem/filesystem.h>
#include <filesystem>
#include <m3t/camera.h>
#include <m3t/common.h>

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
Loading