From 0662b429b1dbb4c5efa7748b379f7e40e248d4cf Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Fri, 15 Mar 2024 09:36:23 -0700 Subject: [PATCH] w --- cmake/dart_v7_defs.cmake | 23 ++++++++++++++++++++++- dart/v7/CMakeLists.txt | 1 + pixi.toml | 2 ++ python/dartpy/CMakeLists.txt | 9 ++++++--- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/cmake/dart_v7_defs.cmake b/cmake/dart_v7_defs.cmake index 1cdbc6757e205..ab6ac15f2f0a1 100644 --- a/cmake/dart_v7_defs.cmake +++ b/cmake/dart_v7_defs.cmake @@ -38,12 +38,21 @@ function(dart_library) set(multiValueArgs HEADERS SOURCES + PUBLIC_LINK_LIBRARIES + PRIVATE_LINK_LIBRARIES ) cmake_parse_arguments( "${prefix}" "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) - add_library(${_ARG_NAME} ${_ARG_HEADERS} ${_ARG_SOURCES}) + # Get the current directory relative to the root of the project + # assuming that dart/* is the root of the source tree + string(REPLACE "${CMAKE_SOURCE_DIR}/" "" relative_path ${CMAKE_CURRENT_SOURCE_DIR}) + + add_library(${_ARG_NAME} + ${_ARG_HEADERS} + ${_ARG_SOURCES} + ) target_include_directories(${_ARG_NAME} PUBLIC $ @@ -52,12 +61,24 @@ function(dart_library) target_compile_features(${_ARG_NAME} PUBLIC cxx_std_17) + target_link_libraries(${_ARG_NAME} + PUBLIC + ${_ARG_PUBLIC_LINK_LIBRARIES} + PRIVATE + ${_ARG_PRIVATE_LINK_LIBRARIES} + ) + set_target_properties(${_ARG_NAME} PROPERTIES OUTPUT_NAME dart-${_ARG_NAME} ) include(GNUInstallDirs) + install( + FILES ${_ARG_HEADERS} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${relative_path}/ + ) + install( TARGETS ${_ARG_NAME} EXPORT ${_ARG_NAME}Targets diff --git a/dart/v7/CMakeLists.txt b/dart/v7/CMakeLists.txt index e13d8b8a1b0db..8313a8f5934fd 100644 --- a/dart/v7/CMakeLists.txt +++ b/dart/v7/CMakeLists.txt @@ -32,5 +32,6 @@ include(dart_v7_defs) dart_library( NAME v7 + HEADERS empty.hpp SOURCES empty.cpp ) diff --git a/pixi.toml b/pixi.toml index 6c926a1a0935f..01ca675cdaaba 100644 --- a/pixi.toml +++ b/pixi.toml @@ -9,6 +9,8 @@ platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"] [tasks] clean = "rm -rf build" build-v7 = { cmd= "cmake --build build --target v7 --parallel", depends_on = ["configure"] } +configure_local = { cmd= "cmake -G Ninja -S . -B build -DDART_VERBOSE=ON -DDART_BUILD_V7=ON -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX" } +install_local = { cmd= "cmake --install build --prefix $CONDA_PREFIX", depends_on = ["configure_local", "build"] } [dependencies] assimp = ">=5.3.1,<5.4" diff --git a/python/dartpy/CMakeLists.txt b/python/dartpy/CMakeLists.txt index b6dbb23a09405..350b49df23042 100644 --- a/python/dartpy/CMakeLists.txt +++ b/python/dartpy/CMakeLists.txt @@ -91,10 +91,13 @@ if(BUILD_SHARED_LIBS) "Install the shared libraries to be able to import ${pybind_module}." ) endif() + # Install the pybind module to site-packages directory -install(TARGETS ${pybind_module} - LIBRARY DESTINATION "${PYTHON_SITE_PACKAGES}" -) +if(TARGET ${pybind_module}) + install(TARGETS ${pybind_module} + LIBRARY DESTINATION "${PYTHON_SITE_PACKAGES}" + ) +endif() list(REMOVE_ITEM dartpy_headers ${CMAKE_CURRENT_LIST_DIR}/eigen_geometry_pybind.h