diff --git a/CMakeLists.txt b/CMakeLists.txt index d1346834d1..f71489e4f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.10) project(Desbordante) option(COMPILE_PYBIND "Build the python bindings" OFF) +option(COPY_PYTHON_EXAMPLES "Copy Python examples" OFF) option(COMPILE_TESTS "Build tests" ON) option(UNPACK_DATASETS "Unpack datasets" ON) option(ASAN "Enable sanitizer" ON) @@ -81,3 +82,6 @@ add_subdirectory("cfg") if (COMPILE_PYBIND) add_subdirectory("src/python_bindings") endif() +if (COPY_PYTHON_EXAMPLES) + add_subdirectory("examples") +endif() diff --git a/build.sh b/build.sh index b4c204a9b8..9710749760 100755 --- a/build.sh +++ b/build.sh @@ -66,7 +66,7 @@ if [[ $PYBIND == true ]]; then if [[ ! -d "pybind11" ]] ; then git clone https://github.com/pybind/pybind11.git --branch v2.10 --depth 1 fi - PREFIX="$PREFIX -D COMPILE_PYBIND=ON" + PREFIX="$PREFIX -D COMPILE_PYBIND=ON -D COPY_PYTHON_EXAMPLES=ON" fi if [[ $DEBUG_MODE != true ]]; then diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000000..6d5672ade3 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,18 @@ +add_custom_target(copy-python-examples ALL) +add_custom_command(TARGET copy-python-examples + COMMAND ${CMAKE_COMMAND} -E + make_directory ${CMAKE_BINARY_DIR}/examples + ${CMAKE_BINARY_DIR}/examples/datasets + COMMAND ${CMAKE_COMMAND} -E + copy ${CMAKE_SOURCE_DIR}/examples/dedupe.py + ${CMAKE_SOURCE_DIR}/examples/mine_typos.py + ${CMAKE_SOURCE_DIR}/examples/anomaly_detection.py + ${CMAKE_BINARY_DIR}/examples + COMMAND ${CMAKE_COMMAND} -E + copy ${CMAKE_SOURCE_DIR}/examples/datasets/duplicates.csv + ${CMAKE_SOURCE_DIR}/examples/datasets/Workshop.csv + ${CMAKE_SOURCE_DIR}/examples/datasets/cargo_data_1.csv + ${CMAKE_SOURCE_DIR}/examples/datasets/cargo_data_2.csv + ${CMAKE_SOURCE_DIR}/examples/datasets/cargo_data_3.csv + ${CMAKE_BINARY_DIR}/examples/datasets +) diff --git a/src/python_bindings/examples/anomaly_detection.py b/examples/anomaly_detection.py similarity index 100% rename from src/python_bindings/examples/anomaly_detection.py rename to examples/anomaly_detection.py diff --git a/test_input_data/Workshop.csv b/examples/datasets/Workshop.csv similarity index 100% rename from test_input_data/Workshop.csv rename to examples/datasets/Workshop.csv diff --git a/src/python_bindings/examples/datasets/cargo_data_1.csv b/examples/datasets/cargo_data_1.csv similarity index 100% rename from src/python_bindings/examples/datasets/cargo_data_1.csv rename to examples/datasets/cargo_data_1.csv diff --git a/src/python_bindings/examples/datasets/cargo_data_2.csv b/examples/datasets/cargo_data_2.csv similarity index 100% rename from src/python_bindings/examples/datasets/cargo_data_2.csv rename to examples/datasets/cargo_data_2.csv diff --git a/src/python_bindings/examples/datasets/cargo_data_3.csv b/examples/datasets/cargo_data_3.csv similarity index 100% rename from src/python_bindings/examples/datasets/cargo_data_3.csv rename to examples/datasets/cargo_data_3.csv diff --git a/src/python_bindings/examples/datasets/duplicates.csv b/examples/datasets/duplicates.csv similarity index 100% rename from src/python_bindings/examples/datasets/duplicates.csv rename to examples/datasets/duplicates.csv diff --git a/src/python_bindings/examples/dedupe.py b/examples/dedupe.py similarity index 100% rename from src/python_bindings/examples/dedupe.py rename to examples/dedupe.py diff --git a/src/python_bindings/examples/mine_typos.py b/examples/mine_typos.py similarity index 100% rename from src/python_bindings/examples/mine_typos.py rename to examples/mine_typos.py diff --git a/src/python_bindings/CMakeLists.txt b/src/python_bindings/CMakeLists.txt index a57cd89794..d4dab2dc5b 100644 --- a/src/python_bindings/CMakeLists.txt +++ b/src/python_bindings/CMakeLists.txt @@ -11,18 +11,3 @@ add_custom_command(TARGET ${BINDINGS_NAME} ${CMAKE_SOURCE_DIR}/test_input_data/WDC_satellites.csv ${CMAKE_BINARY_DIR}/src/python_bindings/ ) - -add_custom_target(copy-python-examples ALL) -add_custom_command(TARGET copy-python-examples - COMMAND ${CMAKE_COMMAND} -E - make_directory ${CMAKE_BINARY_DIR}/src/python_bindings/examples - ${CMAKE_BINARY_DIR}/src/python_bindings/examples/datasets - COMMAND ${CMAKE_COMMAND} -E - copy ${CMAKE_SOURCE_DIR}/src/python_bindings/examples/dedupe.py - ${CMAKE_SOURCE_DIR}/src/python_bindings/examples/mine_typos.py - ${CMAKE_BINARY_DIR}/src/python_bindings/examples - COMMAND ${CMAKE_COMMAND} -E - copy ${CMAKE_SOURCE_DIR}/src/python_bindings/examples/datasets/duplicates.csv - ${CMAKE_SOURCE_DIR}/test_input_data/Workshop.csv - ${CMAKE_BINARY_DIR}/src/python_bindings/examples/datasets -)