diff --git a/bindings/c/README.md b/bindings/c/README.md index f7eb05a..6ee32cf 100644 --- a/bindings/c/README.md +++ b/bindings/c/README.md @@ -1,7 +1,7 @@ # CSerialPort for C ``` -cmake: 3.8.2 +cmake: 3.26.4 ``` ## Install cmake @@ -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 ``` diff --git a/bindings/csharp/CMakeLists.txt b/bindings/csharp/CMakeLists.txt index e0b9589..e65c671 100644 --- a/bindings/csharp/CMakeLists.txt +++ b/bindings/csharp/CMakeLists.txt @@ -12,7 +12,7 @@ ############################################################################ cmake_minimum_required(VERSION 3.8.2) -project(cserialport) +project(libcserialport) # add_definitions(-DCSERIALPORT_DEBUG) # CSerialPort Debug Mode @@ -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}) @@ -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) \ No newline at end of file +if (WIN32) +add_subdirectory(example) +endif () \ No newline at end of file diff --git a/bindings/csharp/README.md b/bindings/csharp/README.md index a52fb20..f52ca25 100644 --- a/bindings/csharp/README.md +++ b/bindings/csharp/README.md @@ -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 @@ -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 ``` @@ -84,7 +133,7 @@ bindings/csharp $tree | +--- bin | | +--- Debug | | | +--- CommCSharp.exe -| | | +--- cserialport.dll +| | | +--- libcserialport.dll +--- CMakeLists.txt +--- cserialport.i +--- example diff --git a/bindings/java/README.md b/bindings/java/README.md index 024b2ea..694571f 100644 --- a/bindings/java/README.md +++ b/bindings/java/README.md @@ -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 ``` diff --git a/bindings/javascript/README.md b/bindings/javascript/README.md index 201d070..f5259f2 100644 --- a/bindings/javascript/README.md +++ b/bindings/javascript/README.md @@ -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 ``` diff --git a/bindings/nodejs/README.md b/bindings/nodejs/README.md index b5f882e..b831d10 100644 --- a/bindings/nodejs/README.md +++ b/bindings/nodejs/README.md @@ -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 ``` diff --git a/bindings/python/README.md b/bindings/python/README.md index e5f5a06..a7807e5 100644 --- a/bindings/python/README.md +++ b/bindings/python/README.md @@ -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 ```