From b60500987bf68a0ff1c940d9c7483a49b394c114 Mon Sep 17 00:00:00 2001 From: Andrew Bell Date: Wed, 18 Sep 2024 13:17:45 -0400 Subject: [PATCH 1/2] Enable an easy local build. --- CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e22cd1a1..8f7fd84d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,4 +39,20 @@ pybind11_add_module(${extension} MODULE ) target_include_directories(${extension} PRIVATE ${Python3_NumPy_INCLUDE_DIRS}) target_link_libraries(${extension} PRIVATE ${PDAL_LIBRARIES}) + +# +# This places the necessary files into the binary directory to allow running +# without installation as long as PYTHONPATH is set to the binary (build) directory. +# Note that if you add ".py" source files, you'll have to re-run cmake to get the +# new file copied to the binary directory. +# +set_target_properties(${extension} + PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/pdal +) +file(GLOB PDAL_PYTHON_SOURCES src/pdal/*.py) +foreach(PDAL_PYTHON_FILE ${PDAL_PYTHON_SOURCES}) + configure_file(${PDAL_PYTHON_FILE} pdal COPYONLY) +endforeach() + install(TARGETS ${extension} LIBRARY DESTINATION "pdal") From 982085142e391b7ab7ee08542c276abb592d4f55 Mon Sep 17 00:00:00 2001 From: Andrew Bell Date: Wed, 18 Sep 2024 13:38:55 -0400 Subject: [PATCH 2/2] Add to REAMDE file. --- README.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.rst b/README.rst index 0132ec84..d9d5046e 100644 --- a/README.rst +++ b/README.rst @@ -6,6 +6,25 @@ PDAL Python support allows you to process data with PDAL into `Numpy`_ arrays. It provides a PDAL extension module to control Python interaction with PDAL. Additionally, you can use it to fetch `schema`_ and `metadata`_ from PDAL operations. +Build +-------------------------------------------------------------------------------- +You can build the extension with cmake in the standard way: create a build directory +at the top level of the source tree, run cmake from that build directory and then +run the build tool. If you're a developer, you can then include the build +directory in your PYTHONPATH and then execute Python programs using PDAL without +installation of the extension. This is an example of commands to be executed from +the directory containing this README file for a linux-like system using the Ninja +build tool: + +.. code-block:: + + mkdir build + cd build + cmake -G Ninja .. + ninja + EXPORT PYTHONPATH=. + + Installation --------------------------------------------------------------------------------