Initialize libnextcloud project structure #25

Closed
opened 2026-01-28 12:08:51 +00:00 by maj · 0 comments
Owner

Set up the shared library project structure and build system for libnextcloud - the cross-platform C++17 library for Nextcloud connectivity.

Overview

Create the foundational structure for libnextcloud, including CMake build system, directory layout, version management, and common types. This is the scaffolding that all subsequent library components will build upon.

Tasks

  • Create shared/ directory structure:
    • include/nextcloud/ - Public API headers
    • src/ - Implementation files
    • tests/ - Unit tests
    • examples/ - Usage examples
    • docs/ - Documentation
  • Set up CMakeLists.txt for library:
    • Library target (static/shared)
    • C++17 standard required
    • Include directories (public/private)
    • Dependency linking (curl, mbedtls, tinyxml2)
    • Install rules
    • Export config for downstream projects
    • Testing support
  • Create include/nextcloud/version.hpp:
    • Semantic versioning (MAJOR.MINOR.PATCH)
    • Build metadata
    • Version query functions
  • Create include/nextcloud/types.hpp:
    • NextcloudError enum (success, network errors, auth errors, etc.)
    • UploadProgress struct (bytes uploaded, total, speed, time remaining)
    • FileInfo struct (name, path, size, mtime, isDirectory)
    • FolderInfo struct (path, displayName, lastUsed)
    • Common result types
  • Set up Google Test framework:
    • Add GTest dependency to CMake
    • Create tests/CMakeLists.txt
    • Add basic smoke test
  • Create shared/README.md:
    • Library overview
    • Build instructions
    • Dependency list
    • Usage examples
  • Add pkg-config file generation:
    • libnextcloud.pc.in template
    • Install to correct location
  • Verify library compiles standalone:
    • Test build on Linux
    • Test with 3DS container
    • Test linking from external project

Dependencies

Required:

  • libcurl 7.68+
  • mbedTLS 2.16+
  • tinyxml2 9.0+

Header-Only:

  • nlohmann/json 3.10+ (for future config work)

Testing:

  • Google Test 1.11+
  • Google Mock 1.11+

Build Tools:

  • CMake 3.15+
  • C++17 compiler (GCC 7+, Clang 5+)

Directory Structure

shared/
├── CMakeLists.txt
├── README.md
├── include/
│   └── nextcloud/
│       ├── version.hpp
│       └── types.hpp
├── src/
│   └── (empty for now, ready for components)
├── tests/
│   ├── CMakeLists.txt
│   └── smoke_test.cpp
├── examples/
│   └── (empty for now)
└── docs/
    └── (empty for now)

Example API (types.hpp)

namespace nextcloud {

enum class NextcloudError {
    Success = 0,
    NetworkError,
    AuthenticationFailed,
    ServerError,
    FileNotFound,
    InvalidPath,
    // ... more error codes
};

struct UploadProgress {
    std::string filename;
    size_t bytesUploaded;
    size_t totalBytes;
    float percentComplete;
    float bytesPerSecond;
    int secondsRemaining;
};

struct FileInfo {
    std::string name;
    std::string path;
    bool isDirectory;
    size_t size;
    time_t modifiedTime;
    std::string contentType;
};

} // namespace nextcloud

Acceptance Criteria

  • CMake configures and builds library successfully
  • Can link against library from external test project
  • Version info accessible at compile-time and runtime
  • Common types defined and documented
  • Google Test runs basic smoke test
  • README documents build process
  • pkg-config file installed correctly
  • Ready for component implementation (WebDAV, auth, etc.)

Platform Support

  • Linux (development)
  • Nintendo 3DS (via devkitARM container)
  • 🔜 Nintendo Switch
  • 🔜 Wii U
  • 🔜 PlayStation Vita

Timeline

Estimated: 4-6 hours

Blocks

This issue blocks:

  • #8 - Design and implement WebDAV client
  • #9 - Implement authentication system
  • #10 - Implement file upload functionality
  • #11 - Implement folder management
  • #12 - Implement favorites and recent folders
  • #13 - Write unit tests for shared library
  • Milestone: #2 (Shared Library Development)
  • Plan: .plans/CreateLibNextcloud.md

Note: This scaffolding work is critical - all library components depend on this foundation. Take time to get the build system right.

Set up the shared library project structure and build system for libnextcloud - the cross-platform C++17 library for Nextcloud connectivity. ## Overview Create the foundational structure for `libnextcloud`, including CMake build system, directory layout, version management, and common types. This is the scaffolding that all subsequent library components will build upon. ## Tasks - [ ] Create `shared/` directory structure: - `include/nextcloud/` - Public API headers - `src/` - Implementation files - `tests/` - Unit tests - `examples/` - Usage examples - `docs/` - Documentation - [ ] Set up `CMakeLists.txt` for library: - Library target (static/shared) - C++17 standard required - Include directories (public/private) - Dependency linking (curl, mbedtls, tinyxml2) - Install rules - Export config for downstream projects - Testing support - [ ] Create `include/nextcloud/version.hpp`: - Semantic versioning (MAJOR.MINOR.PATCH) - Build metadata - Version query functions - [ ] Create `include/nextcloud/types.hpp`: - `NextcloudError` enum (success, network errors, auth errors, etc.) - `UploadProgress` struct (bytes uploaded, total, speed, time remaining) - `FileInfo` struct (name, path, size, mtime, isDirectory) - `FolderInfo` struct (path, displayName, lastUsed) - Common result types - [ ] Set up Google Test framework: - Add GTest dependency to CMake - Create `tests/CMakeLists.txt` - Add basic smoke test - [ ] Create `shared/README.md`: - Library overview - Build instructions - Dependency list - Usage examples - [ ] Add pkg-config file generation: - `libnextcloud.pc.in` template - Install to correct location - [ ] Verify library compiles standalone: - Test build on Linux - Test with 3DS container - Test linking from external project ## Dependencies **Required**: - libcurl 7.68+ - mbedTLS 2.16+ - tinyxml2 9.0+ **Header-Only**: - nlohmann/json 3.10+ (for future config work) **Testing**: - Google Test 1.11+ - Google Mock 1.11+ **Build Tools**: - CMake 3.15+ - C++17 compiler (GCC 7+, Clang 5+) ## Directory Structure ``` shared/ ├── CMakeLists.txt ├── README.md ├── include/ │ └── nextcloud/ │ ├── version.hpp │ └── types.hpp ├── src/ │ └── (empty for now, ready for components) ├── tests/ │ ├── CMakeLists.txt │ └── smoke_test.cpp ├── examples/ │ └── (empty for now) └── docs/ └── (empty for now) ``` ## Example API (types.hpp) ```cpp namespace nextcloud { enum class NextcloudError { Success = 0, NetworkError, AuthenticationFailed, ServerError, FileNotFound, InvalidPath, // ... more error codes }; struct UploadProgress { std::string filename; size_t bytesUploaded; size_t totalBytes; float percentComplete; float bytesPerSecond; int secondsRemaining; }; struct FileInfo { std::string name; std::string path; bool isDirectory; size_t size; time_t modifiedTime; std::string contentType; }; } // namespace nextcloud ``` ## Acceptance Criteria - [ ] CMake configures and builds library successfully - [ ] Can link against library from external test project - [ ] Version info accessible at compile-time and runtime - [ ] Common types defined and documented - [ ] Google Test runs basic smoke test - [ ] README documents build process - [ ] pkg-config file installed correctly - [ ] Ready for component implementation (WebDAV, auth, etc.) ## Platform Support - ✅ Linux (development) - ✅ Nintendo 3DS (via devkitARM container) - 🔜 Nintendo Switch - 🔜 Wii U - 🔜 PlayStation Vita ## Timeline **Estimated**: 4-6 hours ## Blocks This issue blocks: - #8 - Design and implement WebDAV client - #9 - Implement authentication system - #10 - Implement file upload functionality - #11 - Implement folder management - #12 - Implement favorites and recent folders - #13 - Write unit tests for shared library ## Related - Milestone: #2 (Shared Library Development) - Plan: `.plans/CreateLibNextcloud.md` --- **Note**: This scaffolding work is critical - all library components depend on this foundation. Take time to get the build system right.
maj added the featuretaskdocumentation labels 2026-01-28 12:08:51 +00:00
maj added librarysetuppriority:high and removed featuretaskdocumentation labels 2026-01-28 15:57:22 +00:00
maj closed this issue 2026-01-28 18:34:12 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: maj/nextcloud-share#25