Skip to content

Commit 78d48d4

Browse files
committed
docs: Updated documentations and version
Signed-off-by: Yash Pandey (YP) <[email protected]>
1 parent 24d43ce commit 78d48d4

6 files changed

+91
-4
lines changed

.github/ISSUE_TEMPLATE.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### Description
2+
3+
4+
5+
### Your System Info
6+
7+
<!-- *Optional -->
8+
9+
### Screenshots/Testimonials
10+
11+
<!-- *Optional -->

.github/PULL_REQUEST_TEMPLATE.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!--
2+
We follow semantic pull requests. Make sure you sign-off and format every commit message
3+
as well as the PR title as specified in
4+
https://github.com/commitizen/conventional-commit-types/blob/master/index.json
5+
6+
Eg. feat: New feature name,
7+
fix: Some error, etc.
8+
-->
9+
10+
## Fixes # <Enter the issue number>
11+
12+
### Description
13+
14+
15+
16+
### Screenshots/Testimonials
17+
18+

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ set(CMAKE_MODULE_PATH
2020
)
2121

2222
set(CMAKE_WARN_DEPRECATED ON)
23-
set(PY_CASBIN_VERSION 1.0)
23+
set(PY_CASBIN_VERSION 1.1)
2424

2525
if(APPLE AND NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET)
2626
# The value of this variable should be set prior to the first project() command invocation
@@ -32,7 +32,7 @@ endif()
3232
# Project definition.
3333

3434
project(CasbinCPP
35-
VERSION 1.37.0
35+
VERSION 1.38.2
3636
DESCRIPTION "An authorization library that supports access control models like ACL, RBAC, ABAC in C/C++"
3737
HOMEPAGE_URL https://github.com/casbin/casbin-cpp
3838
LANGUAGES CXX C

CONTRIBUTING.md

+5
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,8 @@ Good pull requests (e.g. patches, improvements, new features) are a fantastic he
3535
Please ask first before embarking on any significant pull request (e.g. implementing new features, refactoring code etc.), otherwise you risk spending a lot of time working on something that the maintainers might not want to merge into the project.
3636

3737
First add an issue to the project to discuss the improvement. Please adhere to the coding conventions used throughout the project. If in doubt, consult the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html).
38+
39+
We follow semantic pull requests. Make sure you sign-off and format every commit message
40+
as well as the PR title as specified in [conventional-commit-types](https://github.com/commitizen/conventional-commit-types/blob/master/index.json).
41+
42+
Eg. `feat: New feature name`, `fix: Some error`, etc.

README.md

+55-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ Windows (VS C++) | :heavy_check_mark: Available
1515
Linux | :heavy_check_mark: Available
1616
macOS | :heavy_check_mark: Available
1717

18+
<br/>
1819

19-
![casbin Logo](casbin-logo.png)
20+
![casbin Logo](./assets/images/casbin-logo.png)
21+
22+
<br/>
2023

2124
## All the languages supported by Casbin:
2225

@@ -108,6 +111,56 @@ You can also use the online editor (https://casbin.org/editor/) to write your Ca
108111

109112
https://casbin.org/docs/en/tutorials
110113

114+
## Integrating Casbin to your project through CMake
115+
116+
Here is a [working project](https://github.com/EmperorYP7/casbin-CMake-setup) to demonstarte how to set up your CMake
117+
configurations to integrate casbin.
118+
119+
You may integrate casbin into your CMake project through `find_package`. **It is assumed that you're using CMake >= v3.19.**
120+
121+
You must have casbin installed on your system OR have it fetched from GitHub through [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html).
122+
123+
Here's what your Findcasbin.cmake file should be:
124+
```cmake
125+
include(FetchContent)
126+
127+
FetchContent_Declare(
128+
casbin
129+
GIT_REPOSITORY https://github.com/casbin/casbin-cpp.git
130+
GIT_TAG v1.38.1
131+
)
132+
133+
set(CASBIN_BUILD_TEST OFF) # If you don't need to build tests for casbin
134+
set(CASBIN_BUILD_BENCHMARK OFF) # If you don't need to build benchmarks for casbin
135+
set(CASBIN_BUILD_BINDINGS OFF) # If you don't need language bindings provided by casbin
136+
set(CASBIN_BUILD_PYTHON_BINDINGS OFF) # If you don't need python bindings provided by casbin
137+
138+
# Making casbin and its targets accessible to our project
139+
FetchContent_MakeAvailable(casbin)
140+
141+
FetchContent_GetProperties(casbin)
142+
143+
# If casbin wasn't populated, then manually populate it
144+
if(NOT casbin_POPULATED)
145+
FetchContent_Populate(casbin)
146+
add_subdirectory(${casbin_SOURCE_DIR} ${casbin_BINARY_DIR})
147+
endif()
148+
```
149+
150+
Now that casbin's targets are available to your project,
151+
your may link your own targets against casbin's likewise:
152+
153+
```cmake
154+
add_executable(myexec main.cpp)
155+
156+
target_link_libraries(myexec PRIVATE casbin)
157+
158+
set(myexec_INCLUDE_DIR ${casbin_SOURCE_DIR}/include)
159+
target_include_directories(myexec PRIVATE ${myexec_INCLUDE_DIR})
160+
```
161+
162+
Do remember to include `casbin_SOURCE_DIR/include` directory wherever casbin's functions are utilised.
163+
111164
## Installation and Set-Up
112165

113166
### Build instructions for all platforms
@@ -162,7 +215,7 @@ https://casbin.org/docs/en/tutorials
162215
#include <casbin/casbin.h>
163216
```
164217

165-
2. New a Casbin enforcer with a model file and a policy file:
218+
2. Make a new a `casbin::Enforcer` with a model file and a policy file:
166219

167220
```cpp
168221
casbin::Enforcer e("./path/to/model.conf", "./path/to/policy.csv");
File renamed without changes.

0 commit comments

Comments
 (0)