From 311d283e0b48c12f1536dbfc720ee5345a4d0c6b Mon Sep 17 00:00:00 2001
From: Wolfgang Merkt <w.merkt@gmail.com>
Date: Mon, 18 Jul 2022 16:38:57 +0100
Subject: [PATCH] colcon integration: AMENT_PREFIX_PATH and prepend PYTHONPATH

---
 CMakeLists.txt | 4 ++++
 colcon.pkg     | 6 ++++++
 2 files changed, 10 insertions(+)
 create mode 100644 colcon.pkg

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 37cf640..92be7fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -239,6 +239,10 @@ install(FILES package.xml DESTINATION share/eigenpy)
 # Allows Colcon to find non-Ament packages when using workspace underlays
 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/ament_index/resource_index/packages/${PROJECT_NAME} "")
 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/ament_index/resource_index/packages/${PROJECT_NAME} DESTINATION share/ament_index/resource_index/packages)
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/ament_prefix_path.dsv "prepend-non-duplicate;AMENT_PREFIX_PATH;")
+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_SITELIB}")
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv DESTINATION share/${PROJECT_NAME}/hook)
 
 # ----------------------------------------------------
 # --- PYTHON LIBRARY ---------------------------------
diff --git a/colcon.pkg b/colcon.pkg
new file mode 100644
index 0000000..12b2ef7
--- /dev/null
+++ b/colcon.pkg
@@ -0,0 +1,6 @@
+{
+    "hooks": [
+        "share/eigenpy/hook/ament_prefix_path.dsv",
+        "share/eigenpy/hook/python_path.dsv"
+    ]
+}
\ No newline at end of file
-- 
GitLab