diff --git a/CMakeLists.txt b/CMakeLists.txt index 257a3c0..95819c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,4 +77,4 @@ endif() add_subdirectory(src/ml_flashpoint/checkpoint_object_manager/buffer_object) add_subdirectory(src/ml_flashpoint/checkpoint_object_manager/object_manager) add_subdirectory(src/ml_flashpoint/replication/transfer_service) -add_subdirectory(src/ml_flashpoint/example_cpp) + diff --git a/src/ml_flashpoint/example_cpp/CMakeLists.txt b/src/ml_flashpoint/example_cpp/CMakeLists.txt deleted file mode 100644 index 421b7d6..0000000 --- a/src/ml_flashpoint/example_cpp/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -cmake_minimum_required(VERSION 3.18) -project(example_cpp LANGUAGES CXX) - -# Place the .so file directly in the source directory, to directly resolve the ext created below. -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - -add_library(example_cpp_lib STATIC - example_cpp.cpp -) - -target_include_directories(example_cpp_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) - -find_package(Python COMPONENTS Interpreter Development.Module REQUIRED) -#set(PYBIND11_FINDPYTHON ON) -find_package(pybind11 CONFIG REQUIRED) -pybind11_add_module(example_cpp_ext bindings.cpp) - -# Link the module against the static library AND the Python::Python target. -# Linking to pybind11::module automatically adds the necessary -# include directories, compiler flags, and libraries. -target_link_libraries(example_cpp_ext PUBLIC - example_cpp_lib - pybind11::module -) - -# --- Test Target --- -if(BUILD_TESTING) - add_executable(example_cpp_test - example_cpp_test.cpp - ) - target_link_libraries(example_cpp_test PRIVATE - example_cpp_lib - gtest - gtest_main - ) - - include(GoogleTest) - gtest_discover_tests(example_cpp_test) -endif() diff --git a/src/ml_flashpoint/example_cpp/bindings.cpp b/src/ml_flashpoint/example_cpp/bindings.cpp deleted file mode 100644 index d967840..0000000 --- a/src/ml_flashpoint/example_cpp/bindings.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include - -#include "example_cpp.h" - -namespace py = pybind11; - -PYBIND11_MODULE(example_cpp_ext, m) { - m.doc() = "Example C++ Bindings"; - m.def("add3", &example_cpp::add3, "Adds three integers", py::arg("a"), - py::arg("b"), py::arg("c")); -} diff --git a/src/ml_flashpoint/example_cpp/example_cpp.cpp b/src/ml_flashpoint/example_cpp/example_cpp.cpp deleted file mode 100644 index 92f2c5f..0000000 --- a/src/ml_flashpoint/example_cpp/example_cpp.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "example_cpp.h" - -namespace example_cpp { -int add3(int a, int b, int c) { return a + b + c; } -} // namespace example_cpp diff --git a/src/ml_flashpoint/example_cpp/example_cpp.h b/src/ml_flashpoint/example_cpp/example_cpp.h deleted file mode 100644 index 46ed0d2..0000000 --- a/src/ml_flashpoint/example_cpp/example_cpp.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2025 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef EXAMPLE_CPP_H -#define EXAMPLE_CPP_H - -namespace example_cpp { -int add3(int a, int b, int c); -} - -#endif // EXAMPLE_CPP_H diff --git a/src/ml_flashpoint/example_cpp/example_cpp_test.cpp b/src/ml_flashpoint/example_cpp/example_cpp_test.cpp deleted file mode 100644 index 36bcfe1..0000000 --- a/src/ml_flashpoint/example_cpp/example_cpp_test.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "example_cpp.h" - -#include "gtest/gtest.h" - -namespace { - -TEST(ExampleCppTest, Add3ReturnsCorrectResult) { - EXPECT_EQ(example_cpp::add3(1, 2, 3), 6); -} - -} // namespace \ No newline at end of file diff --git a/tests/example_cpp/test_example_cpp.py b/tests/example_cpp/test_example_cpp.py deleted file mode 100644 index 4f7d414..0000000 --- a/tests/example_cpp/test_example_cpp.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from ml_flashpoint.example_cpp import example_cpp_ext - - -def test_add3(): - assert example_cpp_ext.add3(1, 2, 3) == 6 - assert example_cpp_ext.add3(10, -2, 5) == 13