From a48a22f2fbd84e616f3d69b26867caac49a7b0f2 Mon Sep 17 00:00:00 2001 From: konard Date: Thu, 11 Sep 2025 10:08:45 +0300 Subject: [PATCH 1/3] Initial commit with task details for issue #394 Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: https://github.com/linksplatform/Data.Doublets/issues/394 --- CLAUDE.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 000000000..e6455b7bb --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,5 @@ +Issue to solve: https://github.com/linksplatform/Data.Doublets/issues/394 +Your prepared branch: issue-394-309114ec +Your prepared working directory: /tmp/gh-issue-solver-1757574470718 + +Proceed. \ No newline at end of file From 6a95c87452dc78542c8b8e78d593a60cedcd75ce Mon Sep 17 00:00:00 2001 From: konard Date: Thu, 11 Sep 2025 10:09:01 +0300 Subject: [PATCH 2/3] Remove CLAUDE.md - PR created successfully --- CLAUDE.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index e6455b7bb..000000000 --- a/CLAUDE.md +++ /dev/null @@ -1,5 +0,0 @@ -Issue to solve: https://github.com/linksplatform/Data.Doublets/issues/394 -Your prepared branch: issue-394-309114ec -Your prepared working directory: /tmp/gh-issue-solver-1757574470718 - -Proceed. \ No newline at end of file From 8b29f381972ad5babea72e8d01cec4c6b34a221b Mon Sep 17 00:00:00 2001 From: konard Date: Thu, 11 Sep 2025 10:13:00 +0300 Subject: [PATCH 3/3] Add Conan package support for Platform.Data.Doublets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add conanfile.py with proper dependencies and configuration - Update CMakeLists.txt with install targets for Conan packaging - Add missing platform.setters dependency to conanfile.txt - Create validation script for testing package structure - Add CONAN_README.md with usage documentation This enables Platform.Data.Doublets to be published as a Conan package as requested in issue #394. šŸ¤– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- cpp/CMakeLists.txt | 19 +++++ cpp/CONAN_README.md | 74 +++++++++++++++++ cpp/conanfile.py | 89 +++++++++++++++++++++ cpp/conanfile.txt | 1 + examples/validate_conan_package.py | 123 +++++++++++++++++++++++++++++ 5 files changed, 306 insertions(+) create mode 100644 cpp/CONAN_README.md create mode 100644 cpp/conanfile.py create mode 100644 examples/validate_conan_package.py diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 012b18fad..568dbba42 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -57,3 +57,22 @@ if(${LINKS_PLATFORM_BENCHMARKS}) target_link_libraries(${PROJECT_NAME}.Benchmarks PRIVATE benchmark::benchmark) target_link_libraries(${PROJECT_NAME}.Benchmarks PRIVATE ${PROJECT_NAME}.Library) endif() + +# Install targets for Conan packaging +install(TARGETS ${PROJECT_NAME}.Library + EXPORT ${PROJECT_NAME}Targets + INCLUDES DESTINATION include +) + +# Install headers +install(DIRECTORY ${PROJECT_NAME}/ + DESTINATION include/${PROJECT_NAME} + FILES_MATCHING PATTERN "*.h" +) + +# Install export +install(EXPORT ${PROJECT_NAME}Targets + FILE ${PROJECT_NAME}Targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME} +) diff --git a/cpp/CONAN_README.md b/cpp/CONAN_README.md new file mode 100644 index 000000000..a35da3799 --- /dev/null +++ b/cpp/CONAN_README.md @@ -0,0 +1,74 @@ +# Platform.Data.Doublets Conan Package + +This directory contains the Conan package configuration for Platform.Data.Doublets. + +## Package Information + +- **Name**: `platform.data.doublets` +- **Version**: `0.1.0` +- **Type**: Header-only C++ library + +## Dependencies + +The package depends on the following Platform libraries: +- platform.interfaces (0.3.41) +- platform.collections.methods (0.3.0) +- platform.collections (0.2.1) +- platform.numbers (0.1.0) +- platform.memory (0.1.0) +- platform.exceptions (0.3.2) +- platform.data (0.1.1) +- platform.setters (0.1.0) +- platform.ranges (0.2.0) +- mio (cci.20201220) + +## Building the Package + +### Prerequisites +1. Install Conan: `pip install conan` +2. Set up a Conan profile for your compiler + +### Creating the Package +```bash +# From the cpp directory +conan create . platform.data.doublets/0.1.0@ +``` + +### Using the Package + +Add to your `conanfile.txt`: +```ini +[requires] +platform.data.doublets/0.1.0 + +[generators] +CMakeDeps +CMakeToolchain +``` + +Or in `conanfile.py`: +```python +requires = "platform.data.doublets/0.1.0" +``` + +### CMake Integration + +```cmake +find_package(Platform.Data.Doublets REQUIRED) +target_link_libraries(your_target Platform.Data.Doublets::Platform.Data.Doublets.Library) +``` + +## Package Options + +- `tests`: Build tests (default: False) +- `benchmarks`: Build benchmarks (default: False) +- `shared`: Build shared library (default: False) +- `fPIC`: Position independent code (default: True) + +## Files Structure + +- `conanfile.py`: Main Conan recipe +- `CMakeLists.txt`: CMake build configuration +- `Platform.Data.Doublets/`: Header files +- `Platform.Data.Doublets.Tests/`: Test files +- `Platform.Data.Doublets.Benchmarks/`: Benchmark files \ No newline at end of file diff --git a/cpp/conanfile.py b/cpp/conanfile.py new file mode 100644 index 000000000..88dcb0b34 --- /dev/null +++ b/cpp/conanfile.py @@ -0,0 +1,89 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout, CMakeDeps, CMakeToolchain +from conan.tools.files import copy +import os + +class PlatformDataDoubletsConan(ConanFile): + name = "platform.data.doublets" + version = "0.1.0" # Will be updated from git tag or version file + + # Binary configuration + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "tests": [True, False], + "benchmarks": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "tests": False, + "benchmarks": False + } + + # Sources are located in the same place as this recipe, copy them to the recipe + exports_sources = "CMakeLists.txt", "Platform.Data.Doublets/*", "Platform.Data.Doublets.Tests/*", "Platform.Data.Doublets.Benchmarks/*" + + # Dependencies + requires = ( + "platform.interfaces/0.3.41", + "platform.collections.methods/0.3.0", + "platform.collections/0.2.1", + "platform.numbers/0.1.0", + "platform.memory/0.1.0", + "platform.exceptions/0.3.2", + "platform.data/0.1.1", + "platform.setters/0.1.0", + "platform.ranges/0.2.0", + "mio/cci.20201220" + ) + + def build_requirements(self): + if self.options.tests: + self.test_requires("gtest/cci.20210126") + if self.options.benchmarks: + self.test_requires("benchmark/1.6.0") + + def configure(self): + if self.settings.compiler.cppstd: + self.settings.compiler.cppstd = "20" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + cmake_layout(self) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.variables["LINKS_PLATFORM_TESTS"] = self.options.tests + tc.variables["LINKS_PLATFORM_BENCHMARKS"] = self.options.benchmarks + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + if self.options.tests: + cmake.test() + + def package(self): + copy(self, "*.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + copy(self, "*.hpp", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = [] # Header-only library + self.cpp_info.includedirs = ["include"] + + # Set the target name to match CMake target + self.cpp_info.set_property("cmake_target_name", "Platform.Data.Doublets::Platform.Data.Doublets.Library") + + # Add system libs if needed + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("dl") \ No newline at end of file diff --git a/cpp/conanfile.txt b/cpp/conanfile.txt index 6eb783055..3425183d9 100644 --- a/cpp/conanfile.txt +++ b/cpp/conanfile.txt @@ -10,6 +10,7 @@ platform.random/0.2.0 platform.interfaces/0.3.41 platform.ranges/0.2.0 platform.numbers/0.1.0 +platform.setters/0.1.0 mio/cci.20201220 [generators] diff --git a/examples/validate_conan_package.py b/examples/validate_conan_package.py new file mode 100644 index 000000000..72d05a5ab --- /dev/null +++ b/examples/validate_conan_package.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python3 +""" +Validation script for Platform.Data.Doublets Conan package +This script validates the structure without requiring Conan to be installed +""" + +import os +import sys + +def validate_conanfile(): + """Validate conanfile.py structure""" + conanfile_path = "cpp/conanfile.py" + + if not os.path.exists(conanfile_path): + print("āŒ conanfile.py not found") + return False + + with open(conanfile_path, 'r') as f: + content = f.read() + + required_elements = [ + "class PlatformDataDoubletsConan", + "name = \"platform.data.doublets\"", + "def build(", + "def package(", + "def package_info(", + "platform.interfaces", + "platform.collections", + "platform.memory", + "platform.data", + "platform.exceptions", + "platform.setters", + "platform.ranges" + ] + + missing = [] + for element in required_elements: + if element not in content: + missing.append(element) + + if missing: + print(f"āŒ Missing required elements: {missing}") + return False + + print("āœ… conanfile.py structure is valid") + return True + +def validate_cmake(): + """Validate CMakeLists.txt has required elements for Conan""" + cmake_path = "cpp/CMakeLists.txt" + + if not os.path.exists(cmake_path): + print("āŒ CMakeLists.txt not found") + return False + + with open(cmake_path, 'r') as f: + content = f.read() + + required_elements = [ + "find_package(Platform.Interfaces)", + "find_package(Platform.Setters)", + "install(TARGETS", + "install(DIRECTORY", + "install(EXPORT" + ] + + missing = [] + for element in required_elements: + if element not in content: + missing.append(element) + + if missing: + print(f"āŒ CMakeLists.txt missing required elements: {missing}") + return False + + print("āœ… CMakeLists.txt has required Conan elements") + return True + +def validate_headers(): + """Validate that header files exist""" + headers_dir = "cpp/Platform.Data.Doublets" + + if not os.path.exists(headers_dir): + print("āŒ Platform.Data.Doublets directory not found") + return False + + header_files = [] + for root, dirs, files in os.walk(headers_dir): + for file in files: + if file.endswith('.h'): + header_files.append(os.path.join(root, file)) + + if not header_files: + print("āŒ No header files found") + return False + + print(f"āœ… Found {len(header_files)} header files") + return True + +def main(): + print("šŸ” Validating Platform.Data.Doublets Conan package...") + + # Change to repository root + script_dir = os.path.dirname(os.path.abspath(__file__)) + repo_root = os.path.dirname(script_dir) + os.chdir(repo_root) + + print(f"šŸ“ Working directory: {os.getcwd()}") + + all_valid = True + all_valid &= validate_conanfile() + all_valid &= validate_cmake() + all_valid &= validate_headers() + + if all_valid: + print("\nšŸŽ‰ All validations passed! Conan package structure is ready.") + return 0 + else: + print("\nāŒ Some validations failed. Please fix the issues above.") + return 1 + +if __name__ == "__main__": + sys.exit(main()) \ No newline at end of file