Skip to content

Commit

Permalink
Fix installation directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Kanma committed Dec 13, 2024
1 parent 23927f4 commit d11d1eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
18 changes: 5 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# SPDX-License-Identifier: GPL-3.0-only
#

cmake_minimum_required(VERSION 3.11)
cmake_minimum_required(VERSION 3.15)

project(pygafro)

Expand All @@ -25,18 +25,10 @@ find_package(Python3 REQUIRED COMPONENTS Interpreter Development ${_pybind11_qui
set(PACKAGE_NAME "pygafro")
set(LIBRARY_NAME "_${PACKAGE_NAME}")
SET(PYTHON_MODULE_EXTENSION ".so")
set(PYTHON_SITE_PACKAGES_INSTALL_DIR "${Python_SITEARCH}")
set(PYTHON_SITE_PACKAGES_INSTALL_DIR "${Python3_SITEARCH}")


if(DEFINED ENV{VIRTUAL_ENV})
message(STATUS "VIRTUAL ENV INSTALLATION DETECTED")
set(PYTHON_SITE_PACKAGES_INSTALL_DIR "$ENV{VIRTUAL_ENV}/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages")

elseif(DEFINED ENV{CONDA_PREFIX})
message(STATUS "CONDA INSTALLATION DETECTED")
set(PYTHON_SITE_PACKAGES_INSTALL_DIR "$ENV{CONDA_PREFIX}/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages")

elseif(DEFINED ENV{USE_COLCON})
if(DEFINED ENV{USE_COLCON})
message(STATUS "ROS2 INSTALLATION DETECTED")
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)
Expand All @@ -49,10 +41,10 @@ elseif(DEFINED ENV{USE_COLCON})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/ament_prefix_path.dsv DESTINATION share/${PROJECT_NAME}/hook)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv "prepend-non-duplicate;PYTHONPATH;${PYTHON_SITE_PACKAGES_REL_INSTALL_DIR}")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv DESTINATION share/${PROJECT_NAME}/hook)
else()
message(STATUS "Python package will be installed in: ${PYTHON_SITE_PACKAGES_INSTALL_DIR}")
endif()

message(STATUS "Python package will be installed in: ${PYTHON_SITE_PACKAGES_INSTALL_DIR}")


include(cmake/dependencies.cmake)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies = [

[tool.scikit-build]
wheel.expand-macos-universal-tags = true
cmake.targets = ["_pygafro"]
build.targets = ["_pygafro"]
sdist.exclude = [
".gitignore",
".github",
Expand Down

0 comments on commit d11d1eb

Please sign in to comment.