forked from Fazecast/jSerialComm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL
151 lines (91 loc) · 6.6 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
----------
BUILDING
----------
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 ahead to the "USAGE" section.
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).
Java SDK 1.6 can be downloaded from http://www.oracle.com/technetwork/java/archive-139210.html
Gradle can be downloaded from https://gradle.org/
Once the Java SDK 1.6 has been installed, ensure that you have an environment variable called JDK_HOME set to the base directory of your JDK 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 (.../jSerialComm/): 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: gcc make glibc-devel.x86_64 glibc-devel.i686 (on some distros, these may be called multilib tools for gcc and binutils)
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 the following project directory: ".../jSerialComm/src/main/c/Linux/"
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"
--------------------------------------
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 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 the following project directory: ".../jSerialComm/src/main/c/Linux/"
Run the following commands in order:
make arm
cd ../../../..
gradle build
The resulting jSerialComm library can be found in the project directory ".../jSerialComm/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}.
Change directories to the following project directory: ".../jSerialComm/src/main/c/Android/"
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"
----------
MAC OS X
----------
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 the following project directory: ".../jSerialComm/src/main/c/OSX/"
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"
---------
WINDOWS
---------
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 https://www.visualstudio.com/downloads/download-visual-studio-vs.
Open up 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"
-------
USAGE
-------
In order to use the jSerialComm library in your own project, you must simply include the jSerialComm JAR file in your build path and import it like any other java package using "import com.fazecast.jSerialComm.*;"
Alternatively, you can automatically add jSerialComm to your project as a dependency from the Maven Central Repository. Use the following dependency declaration depending on your build system:
Maven:
<dependency>
<groupId>com.fazecast</groupId>
<artifactId>jSerialComm</artifactId>
<version>[1.0.0,2.0.0)</version>
</dependency>
Ivy:
<dependency org="com.fazecast" name="jSerialComm" rev="[1.0.0,2.0.0)"/>
Groovy:
@Grab(group='com.fazecast', module='jSerialComm', version='[1.0.0,2.0.0)')
Gradle:
compile 'com.fazecast:jSerialComm:[1.0.0,2.0.0)'
Buildr:
compile.with 'com.fazecast:jSerialComm:jar:[1.0.0,2.0.0)'
Scala/SBT:
libraryDependencies += "com.fazecast" % "jSerialComm" % "[1.0.0,2.0.0)"
Leiningen:
[com.fazecast/jSerialComm "[1.0.0,2.0.0)"]