Skip to content

Commit

Permalink
Merge pull request #6 from pooranjoyb/feat/pooranjoyb
Browse files Browse the repository at this point in the history
Build Setup with CMakeLists
  • Loading branch information
sristy17 authored Dec 14, 2024
2 parents b0321b1 + 447130b commit d9dbc06
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
40 changes: 40 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
cmake_minimum_required(VERSION 3.10)
project(AppwriteSDK CXX)

set(CMAKE_CXX_STANDARD 11)

include_directories(include)

set(SRCS
src/Appwrite.cpp
src/services/Account.cpp
src/services/Databases.cpp
src/services/Storage.cpp
src/services/Health.cpp
src/Utils.cpp
src/Validator.cpp
)

add_library(AppwriteSDK STATIC ${SRCS})

target_link_libraries(AppwriteSDK curl)

set_target_properties(AppwriteSDK PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
)

set(HEADERS
include/Appwrite.hpp
include/classes/Account.hpp
include/classes/Databases.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
)

install(DIRECTORY include/ DESTINATION /usr/local/include/AppwriteSDK)
install(FILES ${HEADERS} DESTINATION /usr/local/include/AppwriteSDK)
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@ This **C++ SDK** is built from scratch as a **prototype** for interacting with A
![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png)


## Installation

### Build From Source Code

Clone the repository and run the following commands
```bash
mkdir build
cd build
cmake ..
make
```

Install the SDK.
```bash
sudo make install
```

## Getting Started

### Make Your First Request
Expand Down Expand Up @@ -74,6 +91,16 @@ The Appwrite C++ SDK raises `AppwriteException` object with `message`, `code` an
}
```
### Compilation & Execution
```bash
# Compile
g++ -o <output-file-name> <your-file-name>.cpp -I/usr/local/include/AppwriteSDK -L/usr/local/lib -lAppwriteSDK -lcurl
# Execute
./output-file-name
```

For a more detailed view of the implementations, please check out the example directory. [Example](/examples/)

### Learn more
Expand Down

0 comments on commit d9dbc06

Please sign in to comment.