Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/cicd_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,16 @@ jobs:
run: |
mkdir -p build
cd build
cmake -G"Unix Makefiles" -DCONDA_PREFIX=$MAMBA_ROOT_PREFIX -DCMAKE_BUILD_TYPE=Release ../
cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$MAMBA_ROOT_PREFIX/envs/pdal_ign_plugin/ ../
make install

- name: Show PDAL drivers with PDAL_DRIVER_PATH
shell: micromamba-shell {0}
run: |
echo PDAL_DRIVER_PATH: $PDAL_DRIVER_PATH
pdal --drivers

- name: run tests
shell: micromamba-shell {0}
run: |
export PDAL_DRIVER_PATH=./install/lib
echo $PDAL_DRIVER_PATH
python -m pytest -s
47 changes: 47 additions & 0 deletions .github/workflows/cicd_test_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: cicd_test_windows

on:
# Run each time some code is pushed on any branch
push:
branches:
- '**'
paths-ignore:
- 'doc/**'

jobs:

build_and_run_tests:
runs-on: windows-latest

steps:
- name: Checkout branch
uses: actions/checkout@v4


# See https://github.com/marketplace/actions/setup-micromamba
- name: setup-micromamba
uses: mamba-org/setup-micromamba@v2.0.4
with:
environment-file: environment.yml
environment-name: pdal_ign_plugin # activate the environment
cache-environment: false
cache-downloads: true
generate-run-shell: true
shell: cmd


- name: compile_plugins
run: |
micromamba run -n pdal_ign_plugin mkdir build
micromamba run -n pdal_ign_plugin cmd /c "cd build && cmake -DCONDA_PREFIX=%MAMBA_ROOT_PREFIX% -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%MAMBA_ROOT_PREFIX%\\envs\pdal_ign_plugin\Library\ ../"
micromamba run -n pdal_ign_plugin cmd /c "cd build && cmake --build . --config Release --target install"


- name: Show PDAL drivers with PDAL_DRIVER_PATH
run: |
micromamba run -n pdal_ign_plugin cmd /c "echo PDAL_DRIVER_PATH: %PDAL_DRIVER_PATH% && pdal --drivers"


- name: run tests
run: |
micromamba run -n pdal_ign_plugin cmd /c "echo PDAL_DRIVER_PATH: %PDAL_DRIVER_PATH% && python -m pytest -s"
14 changes: 11 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
cmake_minimum_required( VERSION 3.5 )

cmake_minimum_required( VERSION 3.5 )

set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")

project(MY_READER LANGUAGES CXX)

set(CMAKE_PREFIX_PATH ${CONDA_PREFIX})
set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "-o linker-signed")

# Set library prefix to "lib"
set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")

find_package(PDAL REQUIRED)

set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install)
if(NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install)
endif()
set(CMAKE_DEBUG_POSTFIX d)

## add plugin
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y cmake make buil

COPY src src
COPY CMakeLists.txt CMakeLists.txt
RUN cmake -G"Unix Makefiles" -DCONDA_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release
RUN cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/install/
RUN make -j4 install

FROM debian:bullseye-slim
Expand All @@ -18,6 +18,8 @@ COPY --from=build /opt/conda/envs/pdal_ign_plugin /opt/conda/envs/pdal_ign_plugi
RUN mkdir -p /pdal_ign_plugin
COPY --from=build /tmp/install/lib /pdal_ign_plugin/install/lib

RUN ls -la /pdal_ign_plugin/install/lib

ENV PATH=$PATH:/opt/conda/envs/pdal_ign_plugin/bin/
ENV PROJ_LIB=/opt/conda/envs/pdal_ign_plugin/share/proj/
ENV PDAL_DRIVER_PATH=/pdal_ign_plugin/install/lib
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.pdal
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ RUN mkdir -p build && \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_LIBRARY_PATH:FILEPATH="$CONDA_PREFIX/lib" \
-DCMAKE_INCLUDE_PATH:FILEPATH="$CONDA_PREFIX/include" \
-DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX/envs/pdal_ign_plugin" \
..

RUN cd build && ninja
Expand Down
74 changes: 74 additions & 0 deletions ci/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

@echo off
setlocal enabledelayedexpansion

REM Check if conda is available
where conda >nul 2>&1
if %errorlevel% neq 0 (
echo ERROR: conda command not found. Please ensure conda is installed and in your PATH.
exit /b 1
)

REM Initialize conda for batch scripts
call conda init cmd.exe >nul 2>&1

REM Activate the conda environment
echo Activating conda environment: pdal_ign_plugin
call conda activate pdal_ign_plugin
if %errorlevel% neq 0 (
echo ERROR: Failed to activate conda environment 'pdal_ign_plugin'.
echo Please ensure the environment exists. You can create it with:
echo conda env create -f environment.yml
exit /b 1
)

REM Set CONDA_PREFIX
set CONDA_PREFIX=%CONDA_PREFIX%
echo conda is %CONDA_PREFIX%

REM Create build directory (remove if exists)
if exist build (
echo Removing existing build directory...
RMDIR /S /Q build
)
mkdir build
if %errorlevel% neq 0 (
echo ERROR: Failed to create build directory
exit /b 1
)

cd build
if %errorlevel% neq 0 (
echo ERROR: Failed to change to build directory
exit /b 1
)

REM Run cmake
echo Running cmake...
cmake -G"NMake Makefiles" -DCONDA_PREFIX=%CONDA_PREFIX% -DCMAKE_BUILD_TYPE=Release ../
if %errorlevel% neq 0 (
echo ERROR: cmake failed
call conda deactivate
cd ..
exit /b 1
)

REM Run nmake
echo Running nmake install...
nmake install
if %errorlevel% neq 0 (
echo ERROR: nmake install failed
call conda deactivate
cd ..
exit /b 1
)

echo Build completed successfully!

REM Deactivate conda
call conda deactivate

cd ..
RMDIR /S /Q build

echo Build directory cleaned up.
2 changes: 1 addition & 1 deletion pdal_ign_macro/main_preprocessing_mnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def preprocess_mnx(
# If no GeoJSON input is provided, we cannot add or mark points

with tempfile.NamedTemporaryFile(
prefix=Path(input_las).stem, suffix="_intermediate.laz", dir="."
prefix=Path(input_las).stem, suffix="_intermediate.laz", dir=".", delete_on_close=False
) as tmp_las:
if input_geometry:
mark_points_input_path = tmp_las.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,10 @@ def mark_points_to_use_for_digital_models_with_new_dimension(
output_dtm,
keep_temporary_dimensions=False,
):
with tempfile.NamedTemporaryFile(suffix="_with_temporary_dims.las", dir=".") as tmp_las:

with tempfile.NamedTemporaryFile(
suffix="_with_temporary_dims.las", dir=".", delete_on_close=False
) as tmp_las:
pipeline, temporary_dimensions = define_marking_pipeline(
input_las,
tmp_las.name,
Expand Down
2 changes: 1 addition & 1 deletion src/filter_grid_decimation/GridDecimationFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace pdal
{

// keep selected points on a grid
class PDAL_DLL GridDecimationFilter : public Filter
class GridDecimationFilter : public Filter
{
public:
GridDecimationFilter();
Expand Down
2 changes: 1 addition & 1 deletion src/filter_radius_assign/RadiusAssignFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern "C" PF_ExitFunc RadiusAssignFilter_InitPlugin();
namespace pdal
{

class PDAL_DLL RadiusAssignFilter : public Filter
class RadiusAssignFilter : public Filter
{
public:
RadiusAssignFilter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def test_mark_points_to_use_for_digital_models_with_new_dimension():
ini_las = "test/data/4_6.las"
dsm_dimension = "dsm_marker"
dtm_dimension = "dtm_marker"
with tempfile.NamedTemporaryFile(suffix="_mark_points_output.las") as las_output:
with tempfile.NamedTemporaryFile(
suffix="_mark_points_output.las", delete_on_close=False
) as las_output:
mark_points_to_use_for_digital_models_with_new_dimension(
ini_las, las_output.name, dsm_dimension, dtm_dimension, "", ""
)
Expand All @@ -38,7 +40,9 @@ def test_mark_points_to_use_for_digital_models_with_new_dimension_keep_dimension
ini_las = "test/data/4_6.las"
dsm_dimension = "dsm_marker"
dtm_dimension = "dtm_marker"
with tempfile.NamedTemporaryFile(suffix="_mark_points_output.las") as las_output:
with tempfile.NamedTemporaryFile(
suffix="_mark_points_output.las", delete_on_close=False
) as las_output:
mark_points_to_use_for_digital_models_with_new_dimension(
ini_las,
las_output.name,
Expand Down Expand Up @@ -75,7 +79,9 @@ def test_main_no_buffer():
ini_las = "test/data/4_6.las"
dsm_dimension = "dsm_marker"
dtm_dimension = "dtm_marker"
with tempfile.NamedTemporaryFile(suffix="_mark_points_output.las") as las_output:
with tempfile.NamedTemporaryFile(
suffix="_mark_points_output.las", delete_on_close=False
) as las_output:
main(
ini_las,
las_output.name,
Expand Down Expand Up @@ -103,7 +109,9 @@ def test_main_with_buffer():
ini_las = "test/data/buffer/test_data_77055_627755_LA93_IGN69.laz"
dsm_dimension = "dsm_marker"
dtm_dimension = "dtm_marker"
with tempfile.NamedTemporaryFile(suffix="_mark_points_output.las") as las_output:
with tempfile.NamedTemporaryFile(
suffix="_mark_points_output.las", delete_on_close=False
) as las_output:
main(
ini_las,
las_output.name,
Expand Down Expand Up @@ -156,7 +164,7 @@ def test_algo_mark_points_for_dm_with_reference(crop):
ini_las = "test/data/mnx/input/" + crop
dsm_dimension = "dsm_marker"
dtm_dimension = "dtm_marker"
with tempfile.NamedTemporaryFile(suffix="_after.las") as las_output:
with tempfile.NamedTemporaryFile(suffix="_after.las", delete_on_close=False) as las_output:

main(
ini_las,
Expand Down
9 changes: 7 additions & 2 deletions test/pdal_ign_macro/test_preprocessing_mnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ def test_preprocess_mnx(
metadata_input = las_info_metadata(ini_las)
input_dimensions = metadata_input["dimensions"]

with tempfile.NamedTemporaryFile(suffix="_preprocessed_output.laz") as las_output:
with tempfile.NamedTemporaryFile(
suffix="_preprocessed_output.laz", delete_on_close=False
) as las_output:
print(las_output.name)

preprocess_mnx(
input_las=ini_las,
Expand Down Expand Up @@ -156,7 +159,9 @@ def test_preprocess_mnx_fail(ini_las, ini_geojson, skip_buffer, error_type):
dtm_dimension = "dtm_marker"

with pytest.raises(error_type):
with tempfile.NamedTemporaryFile(suffix="_preprocessed_output.laz") as las_output:
with tempfile.NamedTemporaryFile(
suffix="_preprocessed_output.laz", delete_on_close=False
) as las_output:
preprocess_mnx(
input_las=ini_las,
input_geometry=ini_geojson,
Expand Down
4 changes: 3 additions & 1 deletion test/test_grid_decimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ def run_filter(output_type, resolution):

ini_las = "test/data/4_6.las"

tmp_out_wkt = tempfile.NamedTemporaryFile(suffix=f"_{resolution}.wkt").name
tmp_out_wkt = tempfile.NamedTemporaryFile(
suffix=f"_{resolution}.wkt", delete_on_close=False
).name

filter_name = "filters.grid_decimation_deprecated"
utils.pdal_has_plugin(filter_name)
Expand Down
2 changes: 1 addition & 1 deletion test/test_radius_assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def run_filter(arrays_las, distance_radius, search_3d, limit_z_above=-1, limit_w
filter = "filters.radius_assign"
utils.pdal_has_plugin(filter)

with tempfile.NamedTemporaryFile(suffix="_las_tmp.las") as las:
with tempfile.NamedTemporaryFile(suffix="_las_tmp.las", delete_on_close=False) as las:
pipeline = pdal.Writer.las(filename=las.name).pipeline(arrays_las)
pipeline.execute()

Expand Down
Loading