diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..1ff8d3f --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,76 @@ +FROM ubuntu:latest + +# Avoid prompts from apt +ENV DEBIAN_FRONTEND=noninteractive + +# Set LC_ALL and unset LANGUAGE +ENV LC_ALL=C +ENV LANGUAGE= + +# Update, install dependencies and cleanup +RUN apt-get update && apt-get upgrade -y && \ + apt-get install -y \ + git \ + build-essential \ + gdb \ + cmake \ + cmake-curses-gui \ + clang-tidy \ + libeigen3-dev \ + libproj-dev \ + libgeotiff-dev \ + libboost-all-dev \ + wget \ + libnetcdf-dev \ + libnetcdf-c++4-dev \ + libgtest-dev && \ + rm -rf /var/lib/apt/lists/* + +# Clone, build and clean up LASzip +RUN git clone https://github.com/LASzip/LASzip.git && \ + cd LASzip && \ + git checkout tags/2.0.1 && \ + mkdir build && cd build && \ + cmake .. && \ + make -j$(nproc) && \ + make install && \ + cp bin/Release/liblas* /usr/lib/ && \ + cd ../.. && rm -rf LASzip + +# Clone, build and clean up libLAS +RUN git clone https://github.com/libLAS/libLAS.git && \ + cd libLAS && \ + mkdir build && cd build && \ + cmake .. -DWITH_LASZIP=ON -DWITH_GEOTIFF=OFF && \ + make -j$(nproc) && \ + make install && \ + cd ../.. && rm -rf libLAS + +# Clone, build and clean up Qhull +RUN git clone https://github.com/qhull/qhull.git && \ + cd qhull && \ + git checkout tags/v7.3.2 && \ + cd build && \ + cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true && \ + make -j$(nproc) && \ + make install && \ + cd ../.. && rm -rf qhull + +# Clone, build and clean up libnabo +RUN git clone https://github.com/ethz-asl/libnabo.git && \ + cd libnabo && \ + git checkout tags/1.0.7 && \ + mkdir build && cd build && \ + cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo && \ + make -j$(nproc) && \ + make install && \ + cd ../.. && rm -rf libnabo + +# Update ldconfig +RUN ldconfig /usr/local/lib + +# Set the working directory +WORKDIR /workspaces/raycloudtools + +# Set the default shell to bash +SHELL ["/bin/bash", "-c"] \ No newline at end of file diff --git a/.devcontainer/commands/compile_install.sh b/.devcontainer/commands/compile_install.sh new file mode 100644 index 0000000..f2ae4d6 --- /dev/null +++ b/.devcontainer/commands/compile_install.sh @@ -0,0 +1,44 @@ +#!/bin/bash +set -e + +# Build RayCloudTools +echo "Building RayCloudTools..." +cd /workspaces/raycloudtools +mkdir -p build +cd build + +# Construct the cmake command +cmake .. \ + -DGeoTIFF_INCLUDE_DIR=/usr/include/geotiff \ + -DGeoTIFF_LIBRARY=/usr/lib/x86_64-linux-gnu/libgeotiff.so \ + -DPROJ_INCLUDE_DIR=/usr/include/proj \ + -DPROJ_LIBRARY=/usr/lib/x86_64-linux-gnu/libproj.so \ + -DWITH_QHULL=ON \ + -DWITH_LAS=ON \ + -DDOUBLE_RAYS=ON \ + -DWITH_TIFF=ON \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DRAYCLOUD_BUILD_TESTS=ON + +make -j"$(nproc)" +make install +cd /workspaces/raycloudtools +ldconfig /usr/local/lib + +# Clone and build TreeTools +echo "Cloning and building TreeTools..." +rm -rf treetools && git clone https://github.com/csiro-robotics/treetools.git +cd treetools +mkdir -p build +cd build +cmake .. \ + -DPROJ_INCLUDE_DIR=/usr/include/proj \ + -DPROJ_LIBRARY=/usr/lib/x86_64-linux-gnu/libproj.so \ + -DWITH_TIFF=ON \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DTREE_BUILD_TESTS=ON +make -j"$(nproc)" +make install +ldconfig /usr/local/lib + +echo "Build process completed successfully." \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..abc42ae --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,20 @@ +{ + "name": "RayCloudTools Development", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cpptools", + "ms-vscode.cmake-tools", + "twxs.cmake", + "ms-vscode.cpptools-extension-pack" + ] + } + }, + "remoteUser": "root", + "forwardPorts": [], + "postCreateCommand": "chmod +x /workspaces/raycloudtools/.devcontainer/commands/compile_install.sh && /workspaces/raycloudtools/.devcontainer/commands/compile_install.sh" +} \ No newline at end of file diff --git a/README.md b/README.md index 0a8c83e..0abeee2 100644 --- a/README.md +++ b/README.md @@ -261,6 +261,19 @@ When directly invoking the unit tests, is important that the tests are run from * Change into the `bin/` directory * Run `./raytest` +## Development Container Setup (.devcontainer) + +This project provides a `.devcontainer` directory for consistent development environments. Using the devcontainer is optional, but recommended for a streamlined setup. Here's how to get started: + +1. **Install Docker:** You'll need Docker Desktop (or a similar Docker engine) installed on your machine. + +2. **Open in VS Code:** + * Open the project in VS Code. + * VS Code should automatically detect the `.devcontainer` folder and prompt you to "Reopen in Container". Click it. + * If you're not prompted, open the command palette (Ctrl+Shift+P or Cmd+Shift+P) and type "Remote-Containers: Reopen in Container". + +That's it! VS Code will handle building and running the development container for you. If you choose not to use the devcontainer, you will need to ensure your local environment matches the project's dependencies and requirements. + ## Acknowledgements This research was supported by funding from CSIRO's Data61, Land and Water, Wine Australia, and the Department of Agriculture's Rural R&D for Profit program. The authors gratefully acknowledge the support of these groups, which has helped in making this library possible. @@ -272,4 +285,3 @@ Citations: Lowe, Thomas, and Kazys Stepanas. "RayCloudTools: A Concise Interface for Analysis and Manipulation of Ray Clouds." IEEE Access (2021). Lowe, T, Moghadam, P, Edwards, E, Williams, J. Canopy density estimation in perennial horticulture crops using 3D spinning lidar SLAM. J Field Robotics. 2021; 1– 21. https://doi.org/10.1002/rob.22006 ``` -