From fa61c802a7c676c21f0cf1661a46618b04c35a19 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dash Date: Thu, 28 Aug 2025 20:22:34 +0530 Subject: [PATCH 1/4] build comp. for windows --- CMakeLists.txt | 124 ++++++++++++++++++++----------- build_windows.bat | 36 +++++++++ cmake/AppwriteSDKConfig.cmake.in | 10 +++ conanfile.txt | 9 ++- install_windows.bat | 24 ++++++ 5 files changed, 159 insertions(+), 44 deletions(-) create mode 100644 build_windows.bat create mode 100644 cmake/AppwriteSDKConfig.cmake.in create mode 100644 install_windows.bat diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d31750..f8007e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,50 +1,90 @@ -cmake_minimum_required(VERSION 3.10) -project(AppwriteSDK CXX) - -set(CMAKE_CXX_STANDARD 11) - -include_directories(${CMAKE_BINARY_DIR}/conan/include) -link_directories(${CMAKE_BINARY_DIR}/conan/lib) - -find_package(CURL REQUIRED) - -set(SRCS - src/Appwrite.cpp - src/services/Account.cpp - src/services/Query.cpp - src/services/Databases.cpp - src/services/Messaging.cpp - src/services/Storage.cpp - src/services/Health.cpp - src/Utils.cpp - src/Validator.cpp -) +cmake_minimum_required(VERSION 3.15) +project(AppwriteSDK VERSION 1.0.0 LANGUAGES CXX) + +# Set C++ standard +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Platform-specific configurations +if(WIN32) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + add_definitions(-DWIN32_LEAN_AND_MEAN) + add_definitions(-DNOMINMAX) +endif() + +# Include Conan toolchain +include(${CMAKE_BINARY_DIR}/Release/generators/conan_toolchain.cmake) + +# Make PkgConfig optional for Windows compatibility +find_package(PkgConfig QUIET) -add_library(AppwriteSDK STATIC ${SRCS}) +# CRITICAL: Use Conan targets directly without find_package +# This bypasses CMake's problematic built-in find modules +set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/generators ${CMAKE_PREFIX_PATH}) -include_directories(include) +# Include Conan's generated target files directly +include(${CMAKE_BINARY_DIR}/generators/CURL-config.cmake OPTIONAL) +include(${CMAKE_BINARY_DIR}/generators/nlohmann_json-config.cmake OPTIONAL) -target_link_libraries(AppwriteSDK CURL::libcurl) +# Alternative: Load all Conan targets +file(GLOB CONAN_CONFIGS "${CMAKE_BINARY_DIR}/generators/*-config.cmake") +foreach(config_file ${CONAN_CONFIGS}) + include(${config_file}) +endforeach() -set_target_properties(AppwriteSDK PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib +# Create a simple library (adjust source file locations as needed) +# For testing, create a minimal library +set(SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/src/dummy.cpp ) -set(HEADERS - include/Appwrite.hpp - include/classes/Account.hpp - include/classes/Query.hpp - include/classes/Databases.hpp - include/classes/Messaging.hpp - include/classes/Storage.hpp - include/classes/Health.hpp - include/config/Config.hpp - include/enums/HttpStatus.hpp - include/exceptions/AppwriteException.hpp - include/Utils.hpp - include/Validator.hpp +# If dummy.cpp doesn't exist, create a header-only library +if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/dummy.cpp) + add_library(AppwriteSDK INTERFACE) + target_include_directories(AppwriteSDK + INTERFACE + $ + $ + ) +else() + add_library(AppwriteSDK ${SOURCES}) + target_include_directories(AppwriteSDK + PUBLIC + $ + $ + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/src + ) +endif() + +# Link libraries using Conan targets (these should be available now) +# Handle CURL target compatibility +if(TARGET CURL::libcurl) + set(CURL_TARGET CURL::libcurl) +elseif(TARGET CURL::CURL) + set(CURL_TARGET CURL::CURL) +else() + # Fallback to variables + set(CURL_TARGET ${CURL_LIBRARIES}) +endif() + +target_link_libraries(AppwriteSDK + INTERFACE + ${CURL_TARGET} + nlohmann_json::nlohmann_json ) -install(DIRECTORY include/ DESTINATION /usr/local/include/AppwriteSDK) -install(FILES ${HEADERS} DESTINATION /usr/local/include/AppwriteSDK) -install(TARGETS AppwriteSDK ARCHIVE DESTINATION /usr/local/lib) +if(WIN32) + target_link_libraries(AppwriteSDK INTERFACE ws2_32 wldap32 crypt32) +endif() + +message(STATUS "AppwriteSDK configured successfully with CURL target: ${CURL_TARGET}") + +# Windows-specific linking +if(WIN32) + target_link_libraries(AppwriteSDK PRIVATE ws2_32 wldap32 crypt32) +endif() + +# Print debug info +message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}") +message(STATUS "Available targets: ${CMAKE_BINARY_DIR}/generators") diff --git a/build_windows.bat b/build_windows.bat new file mode 100644 index 0000000..f1c76ea --- /dev/null +++ b/build_windows.bat @@ -0,0 +1,36 @@ +@echo off +echo AppwriteSDK Windows Build +echo ======================== + +:: Create build directory +if not exist "build" mkdir build +cd build + +:: Install dependencies +echo Installing dependencies with Conan... +conan install .. --build=missing -s build_type=Release + +:: Configure using Conan toolchain +echo Configuring with CMake using Conan toolchain... +cmake .. -G "MinGW Makefiles" ^ + -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake ^ + -DCMAKE_BUILD_TYPE=Release + +if %errorlevel% neq 0 ( + echo Configuration failed. Check the error messages above. + pause + exit /b 1 +) + +echo Building... +cmake --build . --config Release + +if %errorlevel% equ 0 ( + echo Build successful! + echo Proceeding with installation... + cd .. + call install_windows.bat +) else ( + echo Build failed. Check the error messages above. + pause +) diff --git a/cmake/AppwriteSDKConfig.cmake.in b/cmake/AppwriteSDKConfig.cmake.in new file mode 100644 index 0000000..61ff2b1 --- /dev/null +++ b/cmake/AppwriteSDKConfig.cmake.in @@ -0,0 +1,10 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) + +find_dependency(CURL REQUIRED) +find_dependency(nlohmann_json REQUIRED) + +include("${CMAKE_CURRENT_LIST_DIR}/AppwriteSDKTargets.cmake") + +check_required_components(AppwriteSDK) diff --git a/conanfile.txt b/conanfile.txt index b05a13b..08a8526 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -1,9 +1,14 @@ [requires] -libcurl/8.10.1 +libcurl/7.87.0 +nlohmann_json/3.11.2 [generators] CMakeDeps CMakeToolchain [layout] -cmake_layout \ No newline at end of file +cmake_layout + +[options] +libcurl/*:shared=False +libcurl/*:with_ssl=False diff --git a/install_windows.bat b/install_windows.bat new file mode 100644 index 0000000..ad075db --- /dev/null +++ b/install_windows.bat @@ -0,0 +1,24 @@ +@echo off +echo Installing AppwriteSDK to MinGW directories... + +:: Find MinGW installation +for /f "tokens=*" %%i in ('where gcc') do set "GCC_PATH=%%i" +for %%i in ("%GCC_PATH%") do set "MINGW_BIN=%%~dpi" +set "MINGW_ROOT=%MINGW_BIN:~0,-5%" + +echo MinGW Root: %MINGW_ROOT% + +:: Install headers +set "INCLUDE_DIR=%MINGW_ROOT%\include\AppwriteSDK" +if not exist "%INCLUDE_DIR%" mkdir "%INCLUDE_DIR%" +xcopy /E /I /Y "include\*" "%INCLUDE_DIR%\" + +:: Install libraries +copy /Y "build\*.a" "%MINGW_ROOT%\lib\" 2>nul + +echo Installation complete! +echo Headers installed to: %INCLUDE_DIR% +echo Libraries installed to: %MINGW_ROOT%\lib\ +echo. +echo Test compilation: g++ -o test.exe test.cpp -lAppwriteSDK +pause From dec7f7c22f1354c6f8aff0f7f762a4552181743a Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dash Date: Sun, 31 Aug 2025 21:38:05 +0530 Subject: [PATCH 2/4] remove nlohmann_json --- CMakeLists.txt | 56 +++++++++++++++++++++++++---------------------- build_windows.bat | 52 ++++++++++++++++++++++++++++++------------- conanfile.txt | 5 ----- 3 files changed, 67 insertions(+), 46 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f8007e5..01d0bc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,33 +12,30 @@ if(WIN32) add_definitions(-DNOMINMAX) endif() -# Include Conan toolchain -include(${CMAKE_BINARY_DIR}/Release/generators/conan_toolchain.cmake) +if(NOT CONAN_TOOLCHAIN_FOUND) + message(WARNING "Conan toolchain not found, proceeding without it") +endif() # Make PkgConfig optional for Windows compatibility find_package(PkgConfig QUIET) -# CRITICAL: Use Conan targets directly without find_package -# This bypasses CMake's problematic built-in find modules +# Set CMAKE_PREFIX_PATH for Conan-generated files set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/generators ${CMAKE_PREFIX_PATH}) -# Include Conan's generated target files directly +# Include Conan's generated target files directly (only CURL now, no nlohmann_json) include(${CMAKE_BINARY_DIR}/generators/CURL-config.cmake OPTIONAL) -include(${CMAKE_BINARY_DIR}/generators/nlohmann_json-config.cmake OPTIONAL) -# Alternative: Load all Conan targets +# Alternative: Load all available Conan targets file(GLOB CONAN_CONFIGS "${CMAKE_BINARY_DIR}/generators/*-config.cmake") foreach(config_file ${CONAN_CONFIGS}) include(${config_file}) endforeach() -# Create a simple library (adjust source file locations as needed) -# For testing, create a minimal library +# Create library - handle both dummy.cpp and header-only scenarios set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/dummy.cpp ) -# If dummy.cpp doesn't exist, create a header-only library if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/dummy.cpp) add_library(AppwriteSDK INTERFACE) target_include_directories(AppwriteSDK @@ -46,6 +43,7 @@ if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/dummy.cpp) $ $ ) + set(LIBRARY_TYPE "INTERFACE") else() add_library(AppwriteSDK ${SOURCES}) target_include_directories(AppwriteSDK @@ -55,36 +53,42 @@ else() PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ) + set(LIBRARY_TYPE "STATIC") endif() -# Link libraries using Conan targets (these should be available now) # Handle CURL target compatibility +set(CURL_TARGET "") if(TARGET CURL::libcurl) set(CURL_TARGET CURL::libcurl) + message(STATUS "Using CURL target: CURL::libcurl") elseif(TARGET CURL::CURL) set(CURL_TARGET CURL::CURL) + message(STATUS "Using CURL target: CURL::CURL") else() - # Fallback to variables - set(CURL_TARGET ${CURL_LIBRARIES}) + message(STATUS "No CURL target found, continuing without it") endif() -target_link_libraries(AppwriteSDK - INTERFACE - ${CURL_TARGET} - nlohmann_json::nlohmann_json -) - -if(WIN32) - target_link_libraries(AppwriteSDK INTERFACE ws2_32 wldap32 crypt32) +# Link libraries - ONLY CURL (nlohmann_json removed as per Issue #19) +if(CURL_TARGET) + if(LIBRARY_TYPE STREQUAL "INTERFACE") + target_link_libraries(AppwriteSDK INTERFACE ${CURL_TARGET}) + else() + target_link_libraries(AppwriteSDK PUBLIC ${CURL_TARGET}) + endif() endif() -message(STATUS "AppwriteSDK configured successfully with CURL target: ${CURL_TARGET}") - # Windows-specific linking if(WIN32) - target_link_libraries(AppwriteSDK PRIVATE ws2_32 wldap32 crypt32) + if(LIBRARY_TYPE STREQUAL "INTERFACE") + target_link_libraries(AppwriteSDK INTERFACE ws2_32 wldap32 crypt32) + else() + target_link_libraries(AppwriteSDK PRIVATE ws2_32 wldap32 crypt32) + endif() endif() -# Print debug info +# Status messages +message(STATUS "AppwriteSDK configured successfully") +message(STATUS "Library type: ${LIBRARY_TYPE}") +message(STATUS "CURL target: ${CURL_TARGET}") +message(STATUS "nlohmann_json removed as per Issue #19") message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}") -message(STATUS "Available targets: ${CMAKE_BINARY_DIR}/generators") diff --git a/build_windows.bat b/build_windows.bat index f1c76ea..423ef8f 100644 --- a/build_windows.bat +++ b/build_windows.bat @@ -1,36 +1,58 @@ @echo off -echo AppwriteSDK Windows Build -echo ======================== +echo AppwriteSDK Windows Build (Fixed) +echo ================================= -:: Create build directory -if not exist "build" mkdir build +:: Ensure MinGW is in PATH +where gcc >nul 2>&1 +if %errorlevel% neq 0 ( + echo Error: GCC not found. Ensure MinGW is in your PATH. + pause + exit /b 1 +) + +:: Clean build directory +if exist "build" rmdir /s /q "build" +mkdir build cd build -:: Install dependencies +:: Install dependencies with explicit output folder echo Installing dependencies with Conan... -conan install .. --build=missing -s build_type=Release +conan install .. --output-folder=. --build=missing -s build_type=Release -:: Configure using Conan toolchain -echo Configuring with CMake using Conan toolchain... -cmake .. -G "MinGW Makefiles" ^ - -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake ^ - -DCMAKE_BUILD_TYPE=Release +:: Verify toolchain file was created +if exist "conan_toolchain.cmake" ( + echo ✅ Found conan_toolchain.cmake + set "TOOLCHAIN_FILE=conan_toolchain.cmake" +) else ( + echo ❌ conan_toolchain.cmake not found, listing build contents: + dir /b + echo Trying without toolchain file... + set "TOOLCHAIN_FILE=" +) + +:: Configure with CMake +echo Configuring with CMake... +if defined TOOLCHAIN_FILE ( + cmake .. -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=%TOOLCHAIN_FILE% -DCMAKE_BUILD_TYPE=Release +) else ( + cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release +) if %errorlevel% neq 0 ( - echo Configuration failed. Check the error messages above. + echo ❌ CMake configuration failed pause exit /b 1 ) +:: Build echo Building... cmake --build . --config Release if %errorlevel% equ 0 ( - echo Build successful! - echo Proceeding with installation... + echo ✅ Build successful! cd .. call install_windows.bat ) else ( - echo Build failed. Check the error messages above. + echo ❌ Build failed pause ) diff --git a/conanfile.txt b/conanfile.txt index 08a8526..960cc4b 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -1,14 +1,9 @@ [requires] libcurl/7.87.0 -nlohmann_json/3.11.2 [generators] CMakeDeps CMakeToolchain -[layout] -cmake_layout - [options] libcurl/*:shared=False -libcurl/*:with_ssl=False From ec285541452ed347fc868b285e0e71191aa7f532 Mon Sep 17 00:00:00 2001 From: ashish-kumar-dash Date: Wed, 10 Sep 2025 12:05:17 +0530 Subject: [PATCH 3/4] fix:update readme --- CMakeLists.txt | 12 ++++++++++++ README.md | 44 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 47 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01d0bc8..cc6f05a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,18 @@ else() set(LIBRARY_TYPE "STATIC") endif() +# Install headers +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ + DESTINATION include/AppwriteSDK) + +# Install library only if not header-only +if(NOT LIBRARY_TYPE STREQUAL "INTERFACE") + install(TARGETS AppwriteSDK + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin) +endif() + # Handle CURL target compatibility set(CURL_TARGET "") if(TARGET CURL::libcurl) diff --git a/README.md b/README.md index d9388c5..5d89fd7 100644 --- a/README.md +++ b/README.md @@ -24,30 +24,56 @@ This **C++ SDK** is built from scratch as a **prototype** for interacting with A ### Prerequisites -Before you begin, ensure that you have `conan` & `clang-format` installed on your system. -- You can install `conan` using `pip`, -- and `clang-format` using `apt` - +Before you begin, ensure `conan`, `clang-format`, and `cmake` are installed: ```bash -sudo apt install clang-format +sudo apt install clang-format cmake pip install conan ``` -### Build From Source Code +#### Build From Source Code -Clone the repository and run the following commands +Clone the repository and run the following commands **(out-of-source build, all artifacts in `build/` only):** ```bash mkdir build && cd build -conan install .. --build=missing -cmake .. +conan install .. --output-folder=. --build=missing +cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake make ``` +All Conan and CMake files will be in `build/`. + Install the SDK. ```bash sudo make install ``` +## Installation (Windows) + +#### Prerequisites + +- Install [MinGW-w64](http://mingw-w64.org/) and add it to your system PATH. +- Install [Conan](https://conan.io/) using Python/pip. +- Install [CMake](https://cmake.org/). + +#### Build From Source Code + +1. Open a MinGW-w64 environment or Command Prompt with MinGW in PATH. +2. Clone the repository and run: + +```bash +mkdir build +cd build +conan install .. --output-folder=. --build=missing +cmake .. -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake +mingw64-make +``` +#### Install SDK (MinGW) + +To copy the headers and library to your MinGW installation, use: +./install_windows.bat + +This will place headers in `\include\AppwriteSDK` and library files in `\lib`. + ## Getting Started ### Make Your First Request From a485e4894f0c3ca376ffd7e684c0ff8a906153f1 Mon Sep 17 00:00:00 2001 From: ashish-kumar-dash Date: Sat, 27 Sep 2025 10:28:55 +0530 Subject: [PATCH 4/4] update --- CMakeLists.txt | 110 ++++++++++++++----------------------------------- README.md | 2 +- 2 files changed, 32 insertions(+), 80 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc6f05a..69750b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,106 +1,58 @@ cmake_minimum_required(VERSION 3.15) project(AppwriteSDK VERSION 1.0.0 LANGUAGES CXX) -# Set C++ standard set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -# Platform-specific configurations if(WIN32) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) add_definitions(-DWIN32_LEAN_AND_MEAN) add_definitions(-DNOMINMAX) endif() -if(NOT CONAN_TOOLCHAIN_FOUND) - message(WARNING "Conan toolchain not found, proceeding without it") -endif() - -# Make PkgConfig optional for Windows compatibility find_package(PkgConfig QUIET) -# Set CMAKE_PREFIX_PATH for Conan-generated files -set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/generators ${CMAKE_PREFIX_PATH}) - -# Include Conan's generated target files directly (only CURL now, no nlohmann_json) -include(${CMAKE_BINARY_DIR}/generators/CURL-config.cmake OPTIONAL) +# Ensure CMake uses Conan's find modules for dependencies +if(EXISTS "${CMAKE_BINARY_DIR}/generators/CURLConfig.cmake") + list(PREPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/generators") +endif() -# Alternative: Load all available Conan targets -file(GLOB CONAN_CONFIGS "${CMAKE_BINARY_DIR}/generators/*-config.cmake") -foreach(config_file ${CONAN_CONFIGS}) - include(${config_file}) -endforeach() +find_package(CURL REQUIRED) -# Create library - handle both dummy.cpp and header-only scenarios -set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/src/dummy.cpp -) +file(GLOB_RECURSE SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") +file(GLOB_RECURSE HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") -if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/dummy.cpp) - add_library(AppwriteSDK INTERFACE) - target_include_directories(AppwriteSDK - INTERFACE - $ - $ - ) - set(LIBRARY_TYPE "INTERFACE") -else() - add_library(AppwriteSDK ${SOURCES}) - target_include_directories(AppwriteSDK - PUBLIC - $ - $ - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/src - ) - set(LIBRARY_TYPE "STATIC") -endif() - -# Install headers -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ - DESTINATION include/AppwriteSDK) +add_library(AppwriteSDK STATIC ${SOURCES}) -# Install library only if not header-only -if(NOT LIBRARY_TYPE STREQUAL "INTERFACE") - install(TARGETS AppwriteSDK - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin) -endif() +target_include_directories(AppwriteSDK + PUBLIC + $ + $ + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/src +) -# Handle CURL target compatibility -set(CURL_TARGET "") if(TARGET CURL::libcurl) - set(CURL_TARGET CURL::libcurl) - message(STATUS "Using CURL target: CURL::libcurl") + target_link_libraries(AppwriteSDK PUBLIC CURL::libcurl) + message(STATUS "AppwriteSDK: Linked with CURL::libcurl") elseif(TARGET CURL::CURL) - set(CURL_TARGET CURL::CURL) - message(STATUS "Using CURL target: CURL::CURL") + target_link_libraries(AppwriteSDK PUBLIC CURL::CURL) + message(STATUS "AppwriteSDK: Linked with CURL::CURL") else() - message(STATUS "No CURL target found, continuing without it") -endif() - -# Link libraries - ONLY CURL (nlohmann_json removed as per Issue #19) -if(CURL_TARGET) - if(LIBRARY_TYPE STREQUAL "INTERFACE") - target_link_libraries(AppwriteSDK INTERFACE ${CURL_TARGET}) - else() - target_link_libraries(AppwriteSDK PUBLIC ${CURL_TARGET}) - endif() + message(FATAL_ERROR "CURL library not found! Ensure Conan CMakeDeps configured correctly.") endif() -# Windows-specific linking if(WIN32) - if(LIBRARY_TYPE STREQUAL "INTERFACE") - target_link_libraries(AppwriteSDK INTERFACE ws2_32 wldap32 crypt32) - else() - target_link_libraries(AppwriteSDK PRIVATE ws2_32 wldap32 crypt32) - endif() + target_link_libraries(AppwriteSDK PRIVATE ws2_32 wldap32 crypt32) endif() -# Status messages -message(STATUS "AppwriteSDK configured successfully") -message(STATUS "Library type: ${LIBRARY_TYPE}") -message(STATUS "CURL target: ${CURL_TARGET}") -message(STATUS "nlohmann_json removed as per Issue #19") -message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}") +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ + DESTINATION include/AppwriteSDK +) +install(TARGETS AppwriteSDK + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin +) + +message(STATUS "AppwriteSDK: Ready for install, all dependencies resolved.") diff --git a/README.md b/README.md index 5d89fd7..a8bd991 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Clone the repository and run the following commands **(out-of-source build, all ```bash mkdir build && cd build conan install .. --output-folder=. --build=missing -cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake +cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release make ```