Building and installing w/ `python3 -m pip install .` does not install slam headers and libraries.
Describe the bug
After installing symforce with python3 -m pip install ., my C++ program has an error using #include <symforce/slam/imu_preintegration/imu_factor.h> because the slam subdirectory is not installed. Libraries are also missing.
To Reproduce
Clone the symforce repository, cd into it, and run python3 -m pip install . to install.
On my computer this installs headers into /Library/Frameworks/Python.framework/Versions/3.9/include and libraries into /Library/Frameworks/Python.framework/Versions/3.9/lib/.
Make a file test.cc
#include <symforce/slam/imu_preintegration/imu_factor.h>
int main() {
return 0;
}
Try building the test program with the flags that have otherwise worked for me.
clang test.cc -std=c++17 -DSPDLOG_FMT_EXTERNAL=1 -I/usr/local/include/eigen3 -I/Library/Frameworks/Python.framework/Versions/3.9/include
test.cc:1:10: fatal error: 'symforce/slam/imu_preintegration/imu_factor.h' file not found
I was able to fix this issue by adding the following lines to symforce/slam/CMakeLists.txt:
# ------------------------------------------------------------------------------
# install
install(TARGETS symforce_slam DESTINATION lib)
install(DIRECTORY ./ DESTINATION include/symforce/slam FILES_MATCHING PATTERN "*.h" PATTERN "*.tcc")
Expected behavior All standard Symforce libraries and headers should be installed when running a build/install command.
Environment (please complete the following information):
- OS and version: MacOS Ventura 13.3.1
- Python version: Python 3.9.13
- SymForce Version: 0.8.0
Additional context cmake version 3.26.3
This is also fixed in the current master. We might put out a new release that addresses all these issues.