Skip to content

Commit aba8ef7

Browse files
committed
Fix install paths
Previously we were installing all our headers into `include`, instead of preserving the directory structure in there. This breaks lots of things, for instance we create an `assert.h` that'll break things attempting to include the stdlib `assert.h`. This preserves directory structure correctly when running `cmake --build --target install` (and therefore also `pip install .`, which calls cmake). Tested locally in a conda environment.
1 parent ad2a796 commit aba8ef7

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ if(SYMFORCE_USE_EXTERNAL_LCM)
162162
add_library(symforce_lcmtypes_cpp INTERFACE)
163163
target_link_libraries(symforce_lcmtypes_cpp ${SYMFORCE_LCMTYPES_TARGET})
164164
else()
165+
add_subdirectory(third_party/skymarshal)
165166
include(third_party/skymarshal/cmake/skymarshal.cmake)
166167

167168
add_skymarshal_bindings(symforce_lcmtypes
@@ -224,7 +225,7 @@ target_include_directories(
224225
)
225226

226227
install(TARGETS symforce_gen DESTINATION lib)
227-
install(FILES ${SYMFORCE_GEN_HEADERS} DESTINATION include)
228+
install(DIRECTORY gen/cpp/ DESTINATION include FILES_MATCHING PATTERN "*.h" PATTERN "*.tcc")
228229

229230
if(SYMFORCE_BUILD_OPT)
230231
add_subdirectory(symforce/opt)

symforce/opt/CMakeLists.txt

+8-6
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,6 @@ add_library(
129129
target_link_libraries(symforce_cholesky metis ${SYMFORCE_EIGEN_TARGET})
130130
target_include_directories(symforce_cholesky PUBLIC ../..)
131131

132-
install(TARGETS symforce_cholesky DESTINATION lib)
133-
install(FILES ${SYMFORCE_CHOLESKY_HEADERS} DESTINATION include)
134-
135132
# ------------------------------------------------------------------------------
136133
# symforce_opt
137134

@@ -152,13 +149,18 @@ target_link_libraries(symforce_opt
152149
${SYMFORCE_EIGEN_TARGET}
153150
)
154151

155-
install(TARGETS symforce_opt DESTINATION lib)
156-
install(FILES ${SYMFORCE_OPT_HEADERS} DESTINATION include)
157-
158152
if(SYMFORCE_CUSTOM_TIC_TOCS)
159153
target_link_libraries(symforce_opt ${SYMFORCE_TIC_TOC_TARGET})
160154
target_compile_definitions(symforce_opt
161155
PUBLIC SYMFORCE_TIC_TOC_HEADER=${SYMFORCE_TIC_TOC_HEADER}
162156
PUBLIC SYM_TIME_SCOPE=${SYMFORCE_TIC_TOC_MACRO}
163157
)
164158
endif(SYMFORCE_CUSTOM_TIC_TOCS)
159+
160+
161+
# ------------------------------------------------------------------------------
162+
# install
163+
164+
install(TARGETS symforce_cholesky DESTINATION lib)
165+
install(TARGETS symforce_opt DESTINATION lib)
166+
install(DIRECTORY ./ DESTINATION include/symforce/opt FILES_MATCHING PATTERN "*.h" PATTERN "*.tcc")

third_party/skymarshal/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ project(skymarshal)
33

44
add_library(skymarshal_core INTERFACE include/lcm/lcm_coretypes.h)
55
target_include_directories(skymarshal_core INTERFACE include)
6+
install(DIRECTORY include/ DESTINATION include)

third_party/skymarshal/cmake/skymarshal.cmake

+5-4
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,16 @@ function(add_cpp_bindings
5353

5454
foreach(package_and_type ${types_to_generate})
5555
get_package_and_type(${package_and_type} package type)
56-
list(APPEND generated_files ${bindings_dir}/cpp/lcmtypes/${package}/${type}.hpp)
56+
set(generated_file ${bindings_dir}/cpp/lcmtypes/${package}/${type}.hpp)
57+
list(APPEND generated_files ${generated_file})
58+
59+
install(FILES ${generated_file} DESTINATION include/lcmtypes/${package})
5760
endforeach()
5861

5962
add_library(${target_name}_cpp INTERFACE ${generated_files})
60-
target_include_directories(${target_name}_cpp INTERFACE ${bindings_dir}/cpp ${CMAKE_CURRENT_SOURCE_DIR}/third_party/lcm)
63+
target_include_directories(${target_name}_cpp INTERFACE ${bindings_dir}/cpp)
6164
target_link_libraries(${target_name}_cpp INTERFACE skymarshal_core)
6265

63-
install(FILES ${generated_files} DESTINATION include)
64-
6566
set(${generated_files_outvar} ${generated_files} PARENT_SCOPE)
6667

6768
list(APPEND skymarshal_args

0 commit comments

Comments
 (0)