Skip to content

Commit

Permalink
doc(bindings): update bindings README
Browse files Browse the repository at this point in the history
  • Loading branch information
itas109 committed Jul 4, 2024
1 parent 1e4710b commit ef14106
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 4 deletions.
11 changes: 10 additions & 1 deletion bindings/c/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CSerialPort for C

```
cmake: 3.8.2
cmake: 3.26.4
```

## Install cmake
Expand All @@ -25,6 +25,15 @@ $ cmake --version
cmake version 3.26.4
```

### macos

- cmake

```
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install cmake
```

## Build

```
Expand Down
16 changes: 14 additions & 2 deletions bindings/csharp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
############################################################################
cmake_minimum_required(VERSION 3.8.2)

project(cserialport)
project(libcserialport)

# add_definitions(-DCSERIALPORT_DEBUG) # CSerialPort Debug Mode

Expand All @@ -32,6 +32,16 @@ elseif (UNIX)
list(APPEND CSerialPortSourceFiles ${CSerialPortRootPath}/src/SerialPortInfoUnixBase.cpp ${CSerialPortRootPath}/src/SerialPortUnixBase.cpp)
endif ()

if (WIN32)
link_libraries(setupapi)
elseif (APPLE)
find_library(IOKIT_LIBRARY IOKit)
find_library(FOUNDATION_LIBRARY Foundation)
link_libraries(${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
elseif (UNIX)
link_libraries(pthread)
endif ()

# find swig
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
Expand All @@ -47,4 +57,6 @@ set(CMAKE_SWIG_FLAGS -namespace itas109)
swig_add_library(${PROJECT_NAME} LANGUAGE csharp SOURCES cserialport.i ${CSerialPortSourceFiles})

# example
add_subdirectory(example)
if (WIN32)
add_subdirectory(example)
endif ()
51 changes: 50 additions & 1 deletion bindings/csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,25 @@ $ cmake --version
cmake version 3.26.4
```

### macos

- swig

```
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install swig
```

- cmake

```
$ brew install cmake
```

## Build

- windows

```
cd bindings/csharp
mkdir bin
Expand All @@ -68,13 +85,45 @@ set path=D:/swigwin-4.1.1;%path%
cmake ..
```

- linux (ubuntu 22.04)

```
sudo apt update
sudo apt install mono-complete
cd bindings/csharp
mkdir bin
cd bin
cmake .. -DSWIG_EXECUTABLE=/usr/bin/swig
cmake --build .
```

comple example with mono

```
cd example
cmake -E copy ../bin/bin/libcserialport.so .
cmake -E copy ../generate/*.cs .
mcs Program.cs cserialportCSharp.cs cserialportCSharpPINVOKE.cs CSerialPort.cs CSerialPortInfo.cs CSerialPortListener.cs BaudRate.cs DataBits.cs FlowControl.cs OperateMode.cs Parity.cs StopBits.cs SerialPortError.cs SerialPortInfo.cs SerialPortInfoVector.cs
```

## Run

- windows

```
cd bin
CommCSharp
```

- linux

```
cd example
LD_LIBRARY_PATH=. mono Program.exe
```

### Tree

```
Expand All @@ -84,7 +133,7 @@ bindings/csharp $tree
| +--- bin
| | +--- Debug
| | | +--- CommCSharp.exe
| | | +--- cserialport.dll
| | | +--- libcserialport.dll
+--- CMakeLists.txt
+--- cserialport.i
+--- example
Expand Down
15 changes: 15 additions & 0 deletions bindings/java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ $ cmake --version
cmake version 3.26.4
```

### macos

- swig

```
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install swig
```

- cmake

```
$ brew install cmake
```

## Build

```
Expand Down
55 changes: 55 additions & 0 deletions bindings/javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,61 @@ cmake: 3.8.2
nodejs: 12.22.12
```

## Install swig && cmake

### windows

- swig

```
$ wget https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.1.1/swigwin-4.1.1.zip
```

- cmake

```
$ wget https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4-windows-x86_64.msi
```

### linux

- swig

```
$ wget https://sourceforge.net/projects/swig/files/swig/swig-4.1.1/swig-4.1.1.tar.gz
$ tar zxvf swig-4.1.1.tar.gz
$ cd swig-4.1.1
$ ./configure --without-pcre
$ make
$ sudo make install
$ swig -version
SWIG Version 4.1.1
```

- cmake

```
$ wget https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4-linux-x86_64.sh
$ sudo ./cmake-3.26.4-linux-x86_64.sh --prefix=/usr/local --skip-license
$ cmake --version
cmake version 3.26.4
```

### macos

- swig

```
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install swig
```

- cmake

```
$ brew install cmake
```

## Build

```
Expand Down
55 changes: 55 additions & 0 deletions bindings/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,61 @@ cmake-js: 7.3.0 (2024-01-16)
node-addon-api: 8.0.0 (2024-05-05)
```

## Install swig && cmake

### windows

- swig

```
$ wget https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.1.1/swigwin-4.1.1.zip
```

- cmake

```
$ wget https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4-windows-x86_64.msi
```

### linux

- swig

```
$ wget https://sourceforge.net/projects/swig/files/swig/swig-4.1.1/swig-4.1.1.tar.gz
$ tar zxvf swig-4.1.1.tar.gz
$ cd swig-4.1.1
$ ./configure --without-pcre
$ make
$ sudo make install
$ swig -version
SWIG Version 4.1.1
```

- cmake

```
$ wget https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4-linux-x86_64.sh
$ sudo ./cmake-3.26.4-linux-x86_64.sh --prefix=/usr/local --skip-license
$ cmake --version
cmake version 3.26.4
```

### macos

- swig

```
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install swig
```

- cmake

```
$ brew install cmake
```

## Build

```
Expand Down
15 changes: 15 additions & 0 deletions bindings/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ $ cmake --version
cmake version 3.26.4
```

### macos

- swig

```
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install swig
```

- cmake

```
$ brew install cmake
```

## Build

```
Expand Down

0 comments on commit ef14106

Please sign in to comment.