Skip to content

Commit 187dcf3

Browse files
committed
fix: merge conflict.
Signed-off-by: divy9881 <[email protected]>
2 parents 7b25d51 + 9133467 commit 187dcf3

File tree

8 files changed

+82
-16
lines changed

8 files changed

+82
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ x86/
2828
bld/
2929
[Bb]in/
3030
[Oo]bj/
31+
[Ll]ib/
3132
# [Ll]og/
3233
[Ll]ogs/
3334

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: cpp
2+
3+
script:
4+
- make
5+
- make library
6+
- make clean

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
project(casbin)
2+
3+
cmake_minimum_required(VERSION 3.16)
4+
5+
set(CMAKE_CXX_STANDARD 11)
6+
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
7+
8+
FILE(GLOB_RECURSE SC_FILES "casbin/*.cpp" "casbin/*.h")
9+
10+
add_library(casbin ${SC_FILES})

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Casbin-CPP
22
====
33

44
[![Build Status](https://dev.azure.com/Casbin/casbin/_apis/build/status/casbin.casbin-cpp?branchName=master)](https://dev.azure.com/Casbin/casbin/_build?definitionId=2&branchName=master)
5+
[![Build Status](https://travis-ci.org/casbin/casbin-cpp.svg?branch=master)](https://travis-ci.org/casbin/casbin-cpp)
56
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/casbin/casbin-cpp)](https://github.com/casbin/casbin-cpp/releases/latest)
67
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
78
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/casbin/lobby)
@@ -12,7 +13,7 @@ Casbin-CPP
1213
Operating Systems | Availability status
1314
----------------- | -------------------
1415
Windows (VS C++) | :heavy_check_mark: Available
15-
Linux and MacOS | :wrench: Under-Development
16+
Linux and MacOS | :heavy_check_mark: Available
1617

1718

1819
![casbin Logo](casbin-logo.png)
@@ -107,6 +108,27 @@ You can also use the online editor (https://casbin.org/editor/) to write your Ca
107108

108109
https://casbin.org/docs/en/tutorials
109110

111+
## Installation and Set-Up
112+
113+
#### Windows (Microsoft Visual Studio 2019)
114+
- `Clone` the repository in your target client project
115+
- Open the project solution and `build` the solution
116+
- To use the `casbin-cpp` project in your client project add the path to the static library `casbin.lib` file to your client project properties under `VC++ Directories` > `Library Directories` and also add the path of `casbin` directory to your client project properties under `VC++ Directories` > `Include Directories`
117+
- Add the static library file name `casbin.lib` to the properties under `Linker` > `Input` > `Additional Dependencies`
118+
119+
#### Unix
120+
- `Clone` the repository in your target client project
121+
- Change the current working directory to the `casbin-cpp` directory and build the library through following commands:
122+
```shell
123+
$ make
124+
$ make library
125+
```
126+
- To get rid of intermediate files generated during building of library:
127+
```shell
128+
$ make clean
129+
```
130+
- Now, you can use the file present in `lib` directory, created through `archiver`, as a static library
131+
110132
## Get started
111133

112134
1. New a Casbin enforcer with a model file and a policy file:

casbin/casbin.vcxproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@
154154
</ItemDefinitionGroup>
155155
<ItemGroup>
156156
<ClCompile Include="config\config.cpp" />
157-
<ClCompile Include="dllmain.cpp" />
158157
<ClCompile Include="duktape\duktape.cpp" />
159158
<ClCompile Include="effect\default_effector.cpp" />
160159
<ClCompile Include="enforcer.cpp" />

casbin/casbin.vcxproj.filters

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@
8787
</Filter>
8888
</ItemGroup>
8989
<ItemGroup>
90-
<ClCompile Include="dllmain.cpp">
91-
<Filter>Source Files</Filter>
92-
</ClCompile>
9390
<ClCompile Include="pch.cpp">
9491
<Filter>Source Files</Filter>
9592
</ClCompile>

lgtm.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

makefile

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
#Define C/C++ compiler variables
22
CXX := g++
3+
<<<<<<< HEAD
4+
=======
5+
AR := ar
6+
>>>>>>> upstream/master
37

48
#Define compiler flags
59
OBJ_FLAG := -c
610
FILE_FLAG := -o
11+
<<<<<<< HEAD
12+
=======
13+
STD_FLAG := -std=c++11
14+
15+
#Define archive flags
16+
AR_FLAG := crv
17+
AR_NAME := casbin.a
18+
>>>>>>> upstream/master
719

820
#Define directory variables
921
SRC_DIR := casbin
@@ -16,12 +28,41 @@ OBJ_EXT := o
1628
LIB_EXT := a
1729
INC_EXT := h
1830

31+
<<<<<<< HEAD
32+
=======
33+
#Define make directory command variable
34+
MKDIR_P := mkdir -p
35+
36+
>>>>>>> upstream/master
1937
#Get source cpp files
2038
SRC_FILES := $(shell find $(SRC_DIR) -type f -name *.$(SRC_EXT))
2139
INC_DIRS := $(shell find $(SRC_DIR) -type d)
2240
INC_FLAG_DIRS := $(addprefix -I /, $(INC_DIRS))
41+
<<<<<<< HEAD
2342

2443
all:
2544
$(foreach SRC_FILE, $(SRC_FILES),\
2645
$(CXX) $(OBJ_FLAG) $(FILE_FLAG) $(SRC_FILE:$(SRC_DIR)/%.$(SRC_EXT)=$(OBJ_DIR)/%.$(OBJ_EXT)) $(SRC_FILE);\
27-
)
46+
)
47+
=======
48+
OBJ_DIRS := $(addprefix $(OBJ_DIR)/, $(INC_DIRS))
49+
50+
object:
51+
$(foreach OBJ_DIR, $(OBJ_DIRS),\
52+
$(MKDIR_P) $(OBJ_DIR);\
53+
)
54+
$(foreach SRC_FILE, $(SRC_FILES),\
55+
$(CXX) $(STD_FLAG) $(OBJ_FLAG) $(FILE_FLAG) $(SRC_FILE:$(SRC_DIR)/%.$(SRC_EXT)=$(OBJ_DIR)/$(SRC_DIR)/%.$(OBJ_EXT)) $(SRC_FILE);\
56+
)
57+
58+
#Get object files
59+
OBJ_FILES := $(shell find $(OBJ_DIR) -type f -name *.$(OBJ_EXT))
60+
61+
library:
62+
$(MKDIR_P) $(LIB_DIR)
63+
$(AR) $(AR_FLAG) $(AR_NAME) $(OBJ_FILES)
64+
mv $(AR_NAME) $(LIB_DIR)/$(AR_NAME)
65+
66+
clean:
67+
rm -r $(OBJ_DIR)
68+
>>>>>>> upstream/master

0 commit comments

Comments
 (0)