Update README to refer to Building Tutorial

This commit is contained in:
Will Hedgecock 2021-12-12 21:26:40 -06:00
parent d6e42b3f47
commit 7e4e45493b
1 changed files with 5 additions and 172 deletions

177
README.md
View File

@ -117,176 +117,9 @@ and we will be glad to look into it.
Building this library yourself is not advised (at least not for distribution)
since it requires native compilation across multiple platforms. It is
recommended to simply use the pre-built ```jSerialComm``` library in your
application. For installation/usage instructions, please skip to the [usage](#usage) section.
application. For installation/usage instructions, please skip to the [usage](#usage)
section.
If you do choose to build this library for your specific system, the recommended
methodology is to use [Gradle](https://gradle.org/) coupled with two
Java SDKs, [version 1.6](https://www.oracle.com/java/technologies/javase-java-archive-javase6-downloads.html)
and [version 9.0.4](https://www.oracle.com/java/technologies/javase/javase9-archive-downloads.html)
(for backward compatibility).
Once the Java SDKs have been installed, ensure that you have an environment
variable called ```JDK_HOME``` set to the base directory of your JDK 9.0.4
installation. Once this has been done, refer to the section corresponding to
your specific Operating System for further instructions.
Please note, if you would like to edit any of the source code or view it in an
IDE (such as Eclipse), you can automatically build the Eclipse project files by
entering the following on a command line or terminal from the base directory of
this project:
gradle eclipse
You can then Import the project using the "Existing Project into Workspace" import
tool in Eclipse. (Note that if you use Eclipse as an IDE, you will probably want
to install the Eclipse CDT plugin for proper handling of the C source code).
### Linux/UNIX
Ensure that the following tools are installed on your Linux distribution:
# On some distros, these may be called multilib tools for gcc and binutils
gcc make glibc-devel.x86_64 glibc-devel.i686
Ensure that the ```JDK_HOME``` environment variable has been set for the 9.0.4
version of your Java SDK. The correct directory can usually be found by entering
the following command:
readlink -f /usr/bin/java
Export the result of this command ***up to but not including*** the
```/jre/...``` portion using the ```export``` command. For example, if
```readlink``` produced ```/usr/lib/jvm/java-9.0.4/jre/bin/java``` as an output,
the export command would look like: ```export JDK_HOME=/usr/lib/jvm/java-9.0.4```
Run the following commands:
cd src/main/c/Posix
make linux
cd ../../../..
gradle build
The resulting ```jSerialComm``` library can be found in the project directory
```build/libs``` under the name ```jSerialComm-{VERSION}.jar```.
### Solaris
Ensure that you have a cross-compiler installed on your Linux distribution
capable of compiling for both x86 and Sparc-based Solaris architectures.
Instructions for creating such a toolchain can be found on the
[Solaris Cross-Compiler wiki](https://github.com/Fazecast/jSerialComm/wiki/Building-Solaris-Cross-Compilers).
Ensure that the ```JDK_HOME``` environment variable has been set for the 9.0.4
version of your Java SDK. The correct directory can usually be found by entering
the following command:
readlink -f /usr/bin/java
Export the result of this command ***up to but not including*** the
```/jre/...``` portion using the ```export``` command. For example, if
```readlink``` produced ```/usr/lib/jvm/java-9.0.4/jre/bin/java``` as an output,
the export command would look like: ```export JDK_HOME=/usr/lib/jvm/java-9.0.4```
Run the following commands:
cd src/main/c/Posix
make solaris
cd ../../../..
gradle build
The resulting ```jSerialComm``` library can be found in the project directory
```build/libs``` under the name ```jSerialComm-{VERSION}.jar```.
### ARM-Based Mobile Linux (non-Android)
Ensure that you have a cross-compiler installed on your Linux distribution
capable of compiling for ARM-based architectures. I prefer ```crosstool-ng```
for this purpose.
Ensure that the ```JDK_HOME``` environment variable has been set for the 9.0.4
version of your Java SDK. The correct directory can usually be found by entering
the following command:
readlink -f /usr/bin/java
Export the result of this command ***up to but not including*** the
```/jre/...``` portion using the ```export``` command. For example, if
```readlink``` produced ```/usr/lib/jvm/java-9.0.4/jre/bin/java``` as an output,
the export command would look like: ```export JDK_HOME=/usr/lib/jvm/java-9.0.4```
Run the following commands:
cd src/main/c/Posix
make arm
cd ../../../..
gradle build
The resulting ```jSerialComm``` library can be found in the project directory
```build/libs``` under the name ```jSerialComm-{VERSION}.jar```.
### Android
Ensure that the Android NDK is installed on your system. For purposes of these
instructions, assume that it is installed at ```{NDK_HOME}```.
Run the following commands in order:
cd src/main/c/Android
{NDK_HOME}/ndk-build
cd ../../../..
gradle build
The resulting ```jSerialComm``` library can be found in the project directory
```build/libs``` under the name ```jSerialComm-{VERSION}.jar```
### Mac OS X
Ensure that [Xcode](https://developer.apple.com/xcode/) is installed on your system.
If it is not, it can be downloaded via the App Store. You must also make sure
that the ```Xcode Command Line Tools``` are installed. This can be done by
entering the following command in a terminal: ```xcode-select --install```
Run the following commands in order:
cd src/main/c/Posix
make osx
cd ../../../..
gradle build
The resulting ```jSerialComm``` library can be found in the project directory
```build/libs``` under the name ```jSerialComm-{VERSION}.jar```
### Windows
Ensure that the [Visual Studio C++ Compiler](https://www.visualstudio.com/) is
installed on your system.
On Windows, the Visual Studio Compiler must be configured to build either
32- or 64-bit binaries but never both at the same time. Therefore, you will have
to build binaries for the two architectures separately.
Open a command prompt and run the following command:
SET VC_DIRECTORY="C:\Program Files (x86)\Microsoft Visual Studio [version]\VC"
where ```[version]``` matches the version of the ```Visual Studio C++ Compiler```
that is installed.
Then run:
PUSHD src\main\c\Windows
%VC_DIRECTORY%\vcvarsall.bat x64
nmake win64
%VC_DIRECTORY%\vcvarsall.bat x86
nmake win32
POPD
gradle build
The resulting ```jSerialComm``` library can be found in the project directory
```build/libs``` under the name ```jSerialComm-{VERSION}.jar```
If you do choose to build this library for your specific system, please follow
the instructions in the [Building Tutorial](https://github.com/Fazecast/jSerialComm/wiki/Building-Tutorial)
to set up the required native cross-compilation toolchains.