From 28ac627b34bfd3dfe939198b508c08e0ceb785b0 Mon Sep 17 00:00:00 2001
From: Hyungtae Lim <shapelim@mit.edu>
Date: Thu, 5 Dec 2024 19:02:54 -0500
Subject: [PATCH 1/4] Support out-of-source build

---
 python/CMakeLists.txt | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 832f935..29c1054 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -21,8 +21,11 @@ else()
   cmake_minimum_required(VERSION 3.18)
   message(STATUS "Performing out-of-tree build, fetching Patchwork++ v${CMAKE_PROJECT_VERSION} Release from Github")
   include(FetchContent)
-  # Currently, out-of-source build is not supported.
-  # But, it will be updated soon!
+  FetchContent_Declare(
+    ext_ground_seg_cores PREFIX ${PARENT_PROJECT_NAME}
+    URL https://github.com/url-kaist/patchwork-plusplus/archive/refs/tags/v1.0.tar.gz SOURCE_SUBDIR
+        cpp/patchworkpp)
+  FetchContent_MakeAvailable(ext_ground_seg_cores)
 endif()
 
 pybind11_add_module(pypatchworkpp patchworkpp/pybinding.cpp)

From 3e4473a36f455b4d9509d4d5bbf3586f85d0dcc2 Mon Sep 17 00:00:00 2001
From: Hyungtae Lim <shapelim@mit.edu>
Date: Thu, 5 Dec 2024 19:03:56 -0500
Subject: [PATCH 2/4] (minor) update CMakeLists.txt files

---
 cpp/CMakeLists.txt    | 5 +++--
 python/CMakeLists.txt | 5 +++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 0c9ea6e..2cf8552 100755
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -1,9 +1,10 @@
 cmake_minimum_required(VERSION 3.11)
-project(patchworkpp VERSION 1.0.0)
+project(patchworkpp VERSION 1.0.1)
 
 set(CMAKE_CXX_STANDARD 20)
 set(PYTHON_EXECUTABLE python3)
 set(CMAKE_BUILD_TYPE Release)
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
 
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${Open3D_C_FLAGS}")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Open3D_CXX_FLAGS}")
@@ -59,4 +60,4 @@ if (INCLUDE_CPP_EXAMPLES)
   target_include_directories(demo_sequential PUBLIC ${Open3D_INCLUDE_DIRS})
   set_target_properties(demo_sequential PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples")
 
-endif()
\ No newline at end of file
+endif()
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 29c1054..97e1f8d 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -15,6 +15,11 @@ set(TARGET_NAME ground_seg_cores)
 find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
 find_package(pybind11 CONFIG REQUIRED)
 
+# See our `pyproject.toml` file. We use `scikit_build_core`, which turns on `SKBUILD`
+if (DEFINED SKBUILD)
+    message(STATUS "Building with Scikit-Build")
+endif ()
+
 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../cpp/)
   add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../cpp ${CMAKE_CURRENT_BINARY_DIR}/patchworkpp_cpp)
 else()

From adf1eb97082c6cf653539e8230377655a3aee19a Mon Sep 17 00:00:00 2001
From: Hyungtae Lim <shapelim@mit.edu>
Date: Thu, 5 Dec 2024 20:33:58 -0500
Subject: [PATCH 3/4] Generalize version of tar.gz target

---
 python/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 97e1f8d..5cb7f57 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -28,7 +28,7 @@ else()
   include(FetchContent)
   FetchContent_Declare(
     ext_ground_seg_cores PREFIX ${PARENT_PROJECT_NAME}
-    URL https://github.com/url-kaist/patchwork-plusplus/archive/refs/tags/v1.0.tar.gz SOURCE_SUBDIR
+    URL https://github.com/url-kaist/patchwork-plusplus/archive/refs/tags/v${CMAKE_PROJECT_VERSION}.tar.gz SOURCE_SUBDIR
         cpp/patchworkpp)
   FetchContent_MakeAvailable(ext_ground_seg_cores)
 endif()

From 22e9c77414e2424ab1d0c8bae6e1db602ee115f9 Mon Sep 17 00:00:00 2001
From: Hyungtae Lim <shapelim@mit.edu>
Date: Thu, 5 Dec 2024 20:34:20 -0500
Subject: [PATCH 4/4] (minor) remove line and bump up the python version

---
 cpp/CMakeLists.txt    | 1 -
 python/pyproject.toml | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 2cf8552..2063851 100755
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -59,5 +59,4 @@ if (INCLUDE_CPP_EXAMPLES)
   target_link_libraries(demo_sequential PRIVATE ${PARENT_PROJECT_NAME}::${TARGET_NAME} ${Open3D_LIBRARIES} "stdc++fs")
   target_include_directories(demo_sequential PUBLIC ${Open3D_INCLUDE_DIRS})
   set_target_properties(demo_sequential PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples")
-
 endif()
diff --git a/python/pyproject.toml b/python/pyproject.toml
index 064ecc6..17395ec 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
 
 [project]
 name = "pypatchworkpp"
-version = "0.1.0"
+version = "1.0.1"
 requires-python = ">=3.8"
 description = "ground segmentation"
 dependencies = [