-
Notifications
You must be signed in to change notification settings - Fork 286
Building Tutorial
Building this library yourself is not advised (at least not for distribution) as it requires native compilation across multiple platforms. It is recommended to simply use the pre-built jSerialComm.jar library in your application. For installation instructions, please refer to the Installation wiki.
If you do choose to build this library for your specific system, the recommended methodology is to use Gradle coupled with the Java SDK, version 1.6 (for backward compatibility). These tools can be obtained from the following locations:
Please note that there may be alternate methods of obtaining the Java JDK based on your operating system (especially certain Linux distributions).
If you would like to edit any of the source code or view it in an IDE (such as Eclipse), you can automatically create the Eclipse project files by entering the following instruction on a command line or terminal from the base directory of this project:
gradle eclipse
You can then import the project into Eclipse using the built-in "Import->Existing Project into Workspace" tool. (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)
Once the required tools have been installed, refer to the section corresponding to your specific Operating System for further instructions.
To build the library on Linux, you will need both the 32- and 64-bit header files and libraries associated with the C Standard Library and GCC. On some distributions, these packages can be obtained by installing the multilib versions of the required Linux tools. On other distros, you will have to manually install them by specifying the correct extensions (.i686 and .x86_64) in your package manager.
If you plan to cross-compile for an ARM-based architecture (e.g. RaspberryPi, BeagleBone, etc.), you will need to ensure that you have a cross-compiler installed (preferably crosstool-ng) and that the gcc compiler for ARM is available on your PATH (usually called arm-unknown-linux-gnueabi).
In all cases, you must first ensure that both the 32- and 64-bit (and optionally ARM) versions of the following tools are installed on your Linux system:
- gcc
- make
- glibc (development version)
- kernel-headers (or linux-headers)
Ensure that the JDK_HOME environment variable has been set for the 1.6 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-6-jdk/jre/bin/java" as an output, the export command would look like:
export JDK_HOME=/usr/lib/jvm/java-6-jdk
Change directories to jSerialComm/src/main/c/Linux/, and run the following commands in order:
make
make arm (optional, if compiling for ARM)
cd ../../../..
gradle build
The resulting jSerialComm library can be found in the project directory jSerialComm/build/libs/ under the name "jSerialComm-{VERSION}.jar"
Ensure that the Android NDK is installed on your system. If it is not, it can be downloaded from the Android NDK Web Page. For these instructions, assume that the NDK is installed at {NDK_HOME}.
Change directories to jSerialComm/src/main/c/Android/, and run the following commands in order:
{NDK_HOME}/ndk-build
cd ../../../..
gradle build
The resulting jSerialComm library can be found in the project directory jSerialComm/build/libs/ under the name "jSerialComm-{VERSION}.jar"
Ensure that 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
Change directories to jSerialComm/src/main/c/OSX/, and run the following commands in order:
make
cd ../../../..
gradle build
The resulting jSerialComm library can be found in the project directory jSerialComm/build/libs/ under the name "jSerialComm-{VERSION}.jar"
Ensure that the Visual Studio C++ Compiler is installed on your system. If it is not, you can download a free version (Visual C++ 2010 Express) from here.
Open a command prompt (Run->'cmd'
) and change to the following project directory: *jSerialComm\src\main\c\Windows*
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. For the following commands, {VC_DIRECTORY} is the installation directory of your Visual Studio C++ Compiler (for example: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC). Run the following commands in order:
{VC_DIRECTORY}\vcvarsall.bat x64
nmake win64
{VC_DIRECTORY}\vcvarsall.bat x86
nmake win32
cd ..\..\..\..
gradle build
The resulting jSerialComm library can be found in the project directory *jSerialComm\build\libs* under the name "jSerialComm-{VERSION}.jar"
Copyright © 2012-2024 Fazecast, Inc. All rights reserved.