Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
20ef609
update cmakelist
DuinoDu Jun 17, 2025
76d2f50
recover cmake version
DuinoDu Jun 17, 2025
18f8dfa
fix conflicts with main branch
DuinoDu Jun 17, 2025
9b4e73e
fix conflicts
DuinoDu Jul 1, 2025
e12a2c2
turn BUILD_PYTHON ON
DuinoDu Jul 1, 2025
56bb3a2
Merge branch 'main' into feat/add_python_bindings
DuinoDu Jul 1, 2025
073a7b7
add spatialmp4_to_colmap script
DuinoDu Jul 1, 2025
bf52626
add pixi, fix building bug
DuinoDu Jul 3, 2025
2781e28
fix bug in macos
DuinoDu Jul 3, 2025
de6700f
update pyproject.toml
DuinoDu Jul 3, 2025
8957948
fix bug
DuinoDu Jul 3, 2025
7e2402a
update
DuinoDu Jul 3, 2025
dadba5d
update
DuinoDu Jul 3, 2025
1ed8bd1
update
DuinoDu Jul 3, 2025
8805286
update github workflow
DuinoDu Jul 3, 2025
1313e22
update github workflow
DuinoDu Jul 3, 2025
df8606f
update github workflow
DuinoDu Jul 3, 2025
ac8e732
update github workflow
DuinoDu Jul 3, 2025
b7b3bbf
update github workflow
DuinoDu Jul 3, 2025
769a250
update github workflow
DuinoDu Jul 3, 2025
9bc3817
update github workflow
DuinoDu Jul 3, 2025
42e8d51
update github workflow
DuinoDu Jul 3, 2025
44be821
update github workflow
DuinoDu Jul 3, 2025
9dd1cd6
update github workflow
DuinoDu Jul 3, 2025
276a678
update github workflow
DuinoDu Jul 3, 2025
cec2261
update workflows
DuinoDu Jul 4, 2025
c616819
update github workflow
DuinoDu Jul 4, 2025
0556768
add 01_generate_pcd.py
DuinoDu Jul 4, 2025
1e4d308
TODO: visualize by rerun and open3d
DuinoDu Jul 4, 2025
fab72d9
add open3d and rerun visualize script
DuinoDu Jul 7, 2025
b2f679c
update docs
DuinoDu Jul 15, 2025
e67637f
update doc
DuinoDu Jul 15, 2025
8092e8a
update doc
DuinoDu Jul 15, 2025
c191bc9
update doc
DuinoDu Jul 15, 2025
2f10911
update doc
DuinoDu Jul 15, 2025
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
77 changes: 77 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Build Wheels

permissions:
contents: "write"
id-token: "write"

on:
push:
tags:
- 'v*'
pull_request:
branches: [ main ]

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install cmeel[build]
pip install build

- name: Build wheels
env:
CIBW_BEFORE_BUILD: |
bash scripts/install_deps.sh
bash scripts/build_ffmpeg.sh
CIBW_BUILD: "cp3*-*"
CIBW_SKIP: "pp* *-win32 *-win_amd64"
run: |
cmake --version
bash scripts/install_deps.sh
bash scripts/build_ffmpeg.sh
python -m build --wheel

release:
needs: build_wheels
runs-on: ubuntu-latest
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- First release
draft: true
prerelease: false
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/spatialmp4-*.whl
asset_name: spatialmp4-*.whl
asset_content_type: application/zip
20 changes: 18 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,29 @@

tmp*
build/*
build-editable/*

# ffmpeg build
scripts/build_ffmpeg

# python
# python venv
.venv
pyc
*.pyc

# cibuildwheel
wheelhouse

# mac
.DS_Store

# python build
dist/*

# cache files
*.png
*.pkl
*.ply
*.json

# examples
examples/python/view_control.pkl
97 changes: 90 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,41 +1,65 @@
cmake_minimum_required(VERSION 3.24.1 FATAL_ERROR)

project(spatialmp4)
project(spatialmp4 VERSION 0.1.0)

# Configure version header
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/spatialmp4/version.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/spatialmp4/version.h
@ONLY
)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic-functions")

set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
option(BUILD_ANDROID "whether build for android" OFF)
option(BUILD_TESTING "whether build unit test" ON)
option(BUILD_PYTHON "whether build python bindings" ON)

if(BUILD_ANDROID)
message(FATAL_ERROR "Don't support android building.")
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fPIC -DEIGEN_MPL2_ONLY")
set(WITH_OPENGL OFF CACHE BOOL "disable opengl" FORCE)

include(cmake/ffmpeg_local.cmake)
include(cmake/opencv_host.cmake)
include(cmake/spdlog.cmake)
include(cmake/fmt.cmake)
include(cmake/eigen.cmake)
include(cmake/sophus.cmake)

if(BUILD_PYTHON)
include(cmake/pybind11.cmake)
endif()

set(SRC
./src/spatialmp4/utilities/RgbdUtils.cc
./src/spatialmp4/utilities/OpencvUtils.cc
./src/spatialmp4/utils.cc
./src/spatialmp4/reader.cc
)

add_library(${CMAKE_PROJECT_NAME}_static STATIC ${SRC})
target_include_directories(${CMAKE_PROJECT_NAME}_static PUBLIC
add_library(${CMAKE_PROJECT_NAME}_lib STATIC ${SRC})

target_include_directories(${CMAKE_PROJECT_NAME}_lib PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}/include
)
target_link_libraries(${CMAKE_PROJECT_NAME}_static PUBLIC


if(EXISTS $ENV{CONDA_PREFIX}/lib)
link_directories($ENV{CONDA_PREFIX}/lib)
endif()

target_link_libraries(${CMAKE_PROJECT_NAME}_lib PUBLIC
PkgConfig::LIBAV
lib_opencv
PkgConfig::OpenCV
spdlog
fmt::fmt
Eigen3::Eigen
Expand All @@ -44,10 +68,58 @@ target_link_libraries(${CMAKE_PROJECT_NAME}_static PUBLIC
# On newer versions of macOS (>=10.15) and with newer compilers,
# filesystem is part of the standard library and doesn't need explicit linking
if(UNIX AND NOT APPLE)
target_link_libraries(${CMAKE_PROJECT_NAME}_static PRIVATE stdc++fs)
target_link_libraries(${CMAKE_PROJECT_NAME}_lib PRIVATE stdc++fs)
endif()


# Add macOS framework linking
if(APPLE)
set_target_properties(${CMAKE_PROJECT_NAME}_lib PROPERTIES
INSTALL_RPATH "@loader_path"
BUILD_WITH_INSTALL_RPATH TRUE
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/python
)

# Find macOS frameworks
find_library(FOUNDATION_FRAMEWORK Foundation)
find_library(AUDIOTOOLBOX_FRAMEWORK AudioToolbox)
find_library(COREAUDIO_FRAMEWORK CoreAudio)
find_library(AVFOUNDATION_FRAMEWORK AVFoundation)
find_library(COREVIDEO_FRAMEWORK CoreVideo)
find_library(COREMEDIA_FRAMEWORK CoreMedia)
find_library(COREGRAPHICS_FRAMEWORK CoreGraphics)
find_library(OPENGL_FRAMEWORK OpenGL)
find_library(APPLICATIONSERVICES_FRAMEWORK ApplicationServices)
find_library(COREFOUNDATION_FRAMEWORK CoreFoundation)
find_library(APPKIT_FRAMEWORK AppKit)
find_library(CARBON_FRAMEWORK Carbon)
find_library(METAL_FRAMEWORK Metal)
find_library(VIDEOTOOLBOX_FRAMEWORK VideoToolbox)
find_library(COREIMAGE_FRAMEWORK CoreImage)
find_library(CORESERVICES_FRAMEWORK CoreServices)
find_library(SECURITY_FRAMEWORK Security)

target_link_libraries(${CMAKE_PROJECT_NAME}_lib PUBLIC
${FOUNDATION_FRAMEWORK}
${AUDIOTOOLBOX_FRAMEWORK}
${COREAUDIO_FRAMEWORK}
${AVFOUNDATION_FRAMEWORK}
${COREVIDEO_FRAMEWORK}
${COREMEDIA_FRAMEWORK}
${COREGRAPHICS_FRAMEWORK}
${OPENGL_FRAMEWORK}
${APPLICATIONSERVICES_FRAMEWORK}
${COREFOUNDATION_FRAMEWORK}
${APPKIT_FRAMEWORK}
${CARBON_FRAMEWORK}
${METAL_FRAMEWORK}
${VIDEOTOOLBOX_FRAMEWORK}
${COREIMAGE_FRAMEWORK}
${CORESERVICES_FRAMEWORK}
${SECURITY_FRAMEWORK}
)
endif()

if(BUILD_TESTING)
include(cmake/gtest.cmake)
add_executable(test_reader
Expand All @@ -57,7 +129,7 @@ if(BUILD_TESTING)
./src/spatialmp4/reader_test.cc
)
target_link_libraries(test_reader PRIVATE
${CMAKE_PROJECT_NAME}_static
${CMAKE_PROJECT_NAME}_lib
gtest
gtest_main
)
Expand All @@ -68,3 +140,14 @@ if(BUILD_TESTING)
target_link_libraries(test_reader PRIVATE stdc++fs)
endif()
endif()

if(BUILD_PYTHON)
add_subdirectory(bindings)
endif()

if (APPLE)
set_target_properties(${CMAKE_PROJECT_NAME}_lib PROPERTIES INSTALL_RPATH "@loader_path")
else()
set_target_properties(${CMAKE_PROJECT_NAME}_lib PROPERTIES INSTALL_RPATH "\$ORIGIN")
endif()
install(TARGETS ${CMAKE_PROJECT_NAME}_lib DESTINATION lib)
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
recursive-include spatialmp4 *.so *.dylib
include pyproject.toml
Loading
Loading