Project

General

Profile

Installation » History » Version 77

Tony Ciavarella, 12/27/2017 03:51 AM

1 1 Tony Ciavarella
h1. Installation
2
3 5 Tony Ciavarella
h2. Obtaining the Source Code
4 1 Tony Ciavarella
5 2 Tony Ciavarella
h3. Release Tarballs
6
7 4 Tony Ciavarella
Release source tarballs are available on the "Files":http://oss.squalllinesoftware.com/projects/disorder/files page.  This is what you want if you are looking for stability and something ready for production use.  You'll probably want to use the most recent version found on that page.
8 2 Tony Ciavarella
9
h3. SCM
10
11 72 Tony Ciavarella
The Disorder source code is hosted in a "Mercurial":https://www.mercurial-scm.org repository.  This is what you want if you are looking for the very latest bleeding edge of the code for contributing to Disorder, forking an evil fork, or whatever other reason you may have.
12 2 Tony Ciavarella
13 54 Tony Ciavarella
Read the "Mercurial Documentation":http://hgbook.red-bean.com/ if you aren't familiar with that and you want to go this route.
14 27 Tony Ciavarella
15 53 Tony Ciavarella
To clone the repository including the full history:
16 54 Tony Ciavarella
<pre>hg clone http://hg.squalllinesoftware.com/oss/disorder</pre>
17 2 Tony Ciavarella
18 1 Tony Ciavarella
h2. Prerequisites
19
20 38 Tony Ciavarella
Given the assumption that a somewhat sane build environment for C++ already exists on the build machine, the following third party things are required to build Disorder:
21 77 Tony Ciavarella
* "ASIO":http://think-async.com < 1.11.0
22
** Either the standalone version of ASIO or the one built into boost can be used.
23 1 Tony Ciavarella
* "Eigen":http://eigen.tuxfamily.org >= 3.0.5
24
* "Google Test/Mock":https://github.com/google/googletest >= 1.7.0
25 77 Tony Ciavarella
* One of the following geospatial conversion libraries:
26
** "GeographicLib":https://geographiclib.sourceforge.io >= 1.45
27
** C++ version of the "SEDRIS SRM":http://www.sedris.org/srm_4.4/srm_c_cpp.htm >= 4.4.0
28
** Patches to support other geospatial conversion libraries are welcome
29 71 Tony Ciavarella
* A "Python":http://www.python.org interpreter (needed to use the "waf":https://waf.io/ build system)
30 52 Tony Ciavarella
* A C++ compiler capable of understanding the "ISO C++ 2011 Standard":http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=50372
31
** "GCC":http://gcc.gnu.org >= 4.7.0
32
** "Clang++":http://clang.llvm.org >= 3.1.0
33 63 Tony Ciavarella
** Visual Studio = 2013 (version 12.x)
34
*** If you intend to use Visual Studio to build this thing on Windows, you're going to need 2013.  Visual Stupido is way behind in standards compliance.  They haven't even bothered to comply with the C99 standard yet.  Their C++11 support is not good in many areas so some things aren't as good as they could be when using disorder on Windows.
35
*** The express version may work, but using it to build an open source project may be a violation of Microsoft's silly license.
36 59 Tony Ciavarella
*** You can, of course, use gcc to build disorder on windows in a "cygwin":http://cygwin.org/ environment, but you should expect pain because SEDRIS won't build on cygwin out of the box.
37 1 Tony Ciavarella
38 13 Tony Ciavarella
Build and install these things in accordance with the instructions for your operating system provided by each vendor.  Some hints for certain platforms follow.
39 1 Tony Ciavarella
40 8 Tony Ciavarella
h3. Debian Linux and Derivatives
41
42 39 Tony Ciavarella
h4. Debian 6.x (Squeeze)
43 41 Tony Ciavarella
44 39 Tony Ciavarella
The binary packages for "Boost":http://www.boost.org and "Eigen":http://eigen.tuxfamily.org in the package system are way too old.  You'll have to download the source for them and build "Boost":http://www.boost.org yourself.
45 1 Tony Ciavarella
46 39 Tony Ciavarella
h4. Debian >= 7.x (Wheezy)
47 33 Tony Ciavarella
48 42 Tony Ciavarella
All the dependencies are available via the package system.  To install the Boost and Eigen build dependencies on Debian and maybe other derivatives:
49 77 Tony Ciavarella
<pre>sudo apt-get install libasio-dev libeigen3-dev libgeographic-dev googletest google-mock</pre>
50 33 Tony Ciavarella
51 37 Tony Ciavarella
If you don't already have python, this will get the required bits of that:
52 33 Tony Ciavarella
<pre>sudo apt-get install python</pre>
53 35 Tony Ciavarella
54 34 Tony Ciavarella
55 13 Tony Ciavarella
h2. Configuration
56
57
If everything is setup properly, this step will be a breeze, but it is important to resolve any errors produced by the configuration step prior to attempting to compile Disorder.
58
59 46 Tony Ciavarella
h3. General
60
61
The basic idea of configuration is to allow disorder to learn enough about your build platform to be able to compile.  Disorder uses the 
62 47 Tony Ciavarella
"waf":https://code.google.com/p/waf/ build system to configure and compile. In general terms, you want to invoke waf with the configure target like this:
63 46 Tony Ciavarella
<pre>./waf configure</pre>
64
65 65 Tony Ciavarella
On linux-like systems, waf will attempt to find "Boost":http://www.boost.org, "Eigen":http://eigen.tuxfamily.org, and "GLUT":http://www.opengl.org/resources/libraries/glut/ but you can override this behavior in the event of non-standard installation location or fanciful whimsy.  You will always have to tell it where to find the SEDRIS SRM however.  The options for configuring disorder's dependencies can be found by issuing the following command:
66 46 Tony Ciavarella
<pre>./waf --help</pre>
67
68
Said options are thusly enumerated for your convenience:
69
70
h4. Boost
71 49 Tony Ciavarella
72 46 Tony Ciavarella
|_. Option |_. Argument |_. Description |
73
| --boost-includes | path to the Boost includes root (eg. /opt/boost_1_49_0) | Tells disorder where to find the include files for the Boost libraries. |
74 48 Tony Ciavarella
| --boost-libs | path to the directory where the compiled Boost libraries are (eg. /opt/boost_1_49_0/stage/lib) | Tells disorder where to find Boost's compiled library files. |
75 46 Tony Ciavarella
| --boost-mt | none | Links disorder against the multi-threaded versions of the Boost libraries. |
76
| --boost-abi | desired tags from dgsyp | Select Boost libraries with tags.  See Boost documentation ("Unixes":http://www.boost.org/doc/libs/1_53_0/more/getting_started/unix-variants.html#library-naming, "windows":http://www.boost.org/doc/libs/1_53_0/more/getting_started/windows.html#library-naming) for more information. |
77
| --boost-toolset | desired toolset (eg. msvc, vc90, or gcc) | Overrides the automatic toolset detection as specified. |
78
79
h4. Eigen
80 49 Tony Ciavarella
81 46 Tony Ciavarella
|_. Option |_. Argument |_. Description |
82 50 Tony Ciavarella
| --eigen-root | path to the root of the Eigen library (eg. /opt/eigen-3.1.2) | Tells disorder where to find the Eigen library. |
83 46 Tony Ciavarella
84
h4. SEDRIS SRM
85 49 Tony Ciavarella
86 46 Tony Ciavarella
|_. Option |_. Argument |_. Description |
87 48 Tony Ciavarella
| --sedris-srm-root | path to the root of the SEDRIS SRM tree (eg. /opt/srm) | Tells disorder where to find the SEDRIS SRM.  This argument is *required*. |
88 46 Tony Ciavarella
| --sedris-srm-static | none | Links disorder against the static SEDRIS SRM library instead of the default dynamic one. |
89
| --sedris-srm-build-variant | build variant directory (eg. linux-3.5.0-sabayon-i386-gnu-/OPT) to find the compiled output files | Overrides the default selection of the first build variant found. |
90
91 69 Tony Ciavarella
h4. Google Test/Mock
92
93
|_. Option |_. Argument |_. Description |
94
| --gtest-src-root | path to the root of the Google Test source tree (eg. /usr/src/gtest) | Tells disorder where to find the Google Test source tree. |
95
| --gmock-src-root | path to the root of the Google Mock source tree (eg. /usr/src/gmock) | Tells disorder where to find the Google Mock source tree. |
96
97 64 Tony Ciavarella
h4. GLUT
98
99
|_. Option |_. Argument |_. Description |
100
| --glut-root | path to the root of the GLUT tree (eg. /opt/freeglut) | Tells disorder where to find GLUT. |
101
| --glut-lib | root name of the GLUT library | Tells disorder which GLUT library to link against.  For example, specify 'glut' for libglut.so on linux or freeglut for freeglut.lib on windows. |
102 69 Tony Ciavarella
103
h4. 0mq
104
105
|_. Option |_. Argument |_. Description |
106
| --zmq-root | path to the 0MQ root (eg. /opt/zeromq-4.0.4) | Tells disorder where to find 0MQ. |
107 64 Tony Ciavarella
108 15 Tony Ciavarella
h3. Linux
109 13 Tony Ciavarella
110
From inside the root of the Disorder tree do this in your favorite terminal emulator:
111 68 Tony Ciavarella
<pre>./waf configure --sedris-srm-root=<put the path to the SEDRIS SRM root here> --eigen-root=/opt/eigen</pre>
112
For example, if your SEDRIS SRM is in /opt/sedris/srm and your Eigen is in /opt/eigen:
113
<pre>./waf configure --sedris-srm-root=/opt/sedris/srm --eigen-root=/opt/eigen</pre>
114 1 Tony Ciavarella
115
That command will take several seconds and print a bunch of hopefully green stuff.  The output should end up looking something like this:
116
<pre>
117 76 Tony Ciavarella
Setting top to                           : /usr/local/src/disorder 
118
Setting out to                           : /usr/local/src/disorder/bin 
119 74 Tony Ciavarella
Checking for 'g++' (C++ compiler)        : /usr/bin/g++ 
120
Checking for program 'doxygen'           : /usr/bin/doxygen 
121
Checking for program 'tar'               : /bin/tar 
122
Checking boost includes                  : 1.62.0 
123
Checking boost libs                      : ok 
124
Checking for boost linkage               : ok 
125
Checking for header boost/asio.hpp       : yes 
126
Checking for header boost/config.hpp     : yes 
127
Checking for header boost/detail/endian.hpp : yes 
128
Checking for header boost/filesystem/operations.hpp : yes 
129
Checking for header boost/preprocessor.hpp          : yes 
130
Checking for header boost/optional.hpp              : yes 
131
Checking for C++11 compiler support                 : yes 
132
Checking for program 'pkg-config'                   : /usr/bin/pkg-config 
133
Checking for 'eigen3'                               : yes 
134
Checking for header Eigen/Dense                     : yes 
135
Checking for SEDRIS SRM                             : /opt/srm 
136
Checking for SEDRIS SRM include directory           : /opt/srm/src/include 
137
Checking for SEDRIS SRM library directory           : /opt/srm/lib/linux-4.9.0-2-amd64-i386-gnu-/OPT 
138
SEDRIS SRM library                                  : /opt/srm/lib/linux-4.9.0-2-amd64-i386-gnu-/OPT/libsrm.a 
139
SEDRIS SRM library mode                             : static 
140
Checking for header srf_all.h                       : yes 
141
Checking for library pthread                        : yes 
142
Checking for gtest source directory                 : /usr/src/googletest/googletest 
143
Checking for gtest-all.cc                           : /usr/src/googletest/googletest/src/gtest-all.cc 
144
Checking for gtest include directory                : /usr/src/googletest/googletest/include 
145
Checking for header gtest/gtest.h                   : yes 
146
Checking for gmock source directory                 : /usr/src/googletest/googlemock 
147
Checking for gmock-all.cc                           : /usr/src/googletest/googlemock/src/gmock-all.cc 
148
Checking for gmock_main.cc                          : /usr/src/googletest/googlemock/src/gmock_main.cc 
149
Checking for gmock include directory                : /usr/src/googletest/googlemock/include 
150
Checking for header gmock/gmock.h                   : yes 
151
Checking for library GL                             : yes 
152
Checking for library glut                           : yes 
153
Checking GLUT sanity                                : yes 
154
Checking for 0MQ                                    : yes 
155
Checking 0MQ sanity                                 : yes 
156
Checking for sane chrono duration modulo            : yes 
157
Checking for defaulted move functions               : yes 
158
Checking for array initializer lists                : yes 
159
Checking for sane std::chrono                       : yes 
160
'configure' finished successfully (6.832s)
161 13 Tony Ciavarella
</pre>
162
163 18 Tony Ciavarella
If you get an error instead of that last line saying that 'configure' finished successfully, you must fix whatever is making it unhappy and try again.
164 13 Tony Ciavarella
165 19 Tony Ciavarella
h4. Clang++
166 16 Tony Ciavarella
167 32 Tony Ciavarella
To use the "Clang":http://clang.llvm.org/ C++ compiler instead of "GCC":http://gcc.gnu.org/, assuming clang++ is installed on the build system:
168 16 Tony Ciavarella
<pre>CXX=<put the path to clang++ here> ./waf configure --sedris-srm-root=<put the path to the SEDRIS SRM root here></pre>
169
170 19 Tony Ciavarella
For example:
171 16 Tony Ciavarella
<pre>CXX=/usr/bin/clang++ ./waf configure --sedris-srm-root=/opt/sedris/srm</pre>
172
173 13 Tony Ciavarella
h3. Windows
174
175
On windows, your $PATH environment variable needs to include the path to the Python interpreter.
176
177 30 Tony Ciavarella
The easiest way to configure Disorder on Windows is to use a modified version of the provided batch file to tell Disorder where your prerequisites live.  Copy the template from @tools/windows/configure.bat@ to the root of the Disorder tree.
178 1 Tony Ciavarella
179 30 Tony Ciavarella
This file contains some variables near the middle that must be set according to your system configuration.  An example is provided in the template for guidance.
180
181
Once you are finished editing configure.bat, it's time to execute it.  From the command line:
182
<pre>configure.bat</pre>
183
184
If everything is successful, you should get something that looks like this:
185
<pre>
186
C:\oss\disorder>python waf configure --boost-includes=c:\oss\boost_1_48_0 --boost-libs=c:\oss\boost_1_48_0\stage\lib --boost-mt --boost-static --eigen-root=c:\oss\eigen-3.0.4 --sedris-srm-root=c:\oss\sedris\srm --sedris-srm-static
187
Setting top to                           : C:\oss\disorder
188
Setting out to                           : C:\oss\disorder\bin
189
Checking for 'msvc' (c++ compiler)       : c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\CL.exe
190
Checking for program doxygen             : not found
191
Checking for Eigen library               : c:\oss\eigen-3.0.4
192
Checking for header Eigen/Dense          : yes
193
Checking for SEDRIS SRM                  : c:\oss\sedris\srm
194
Checking for SEDRIS SRM include directory : c:\oss\sedris\srm\src\include
195
Checking for SEDRIS SRM library directory : c:\oss\sedris\srm\lib\[Debug/Release]
196
Checking for header srf_all.h             : yes
197
Configuring boost libraries               : debug variant
198
Checking boost ABI tag                    : gd
199
Checking boost includes                   : 1_48
200
Checking boost libs                       : ok
201
Checking for boost linkage                : ok
202
Checking for header boost/asio.hpp        : yes
203
Checking for header boost/bind.hpp        : yes
204
Checking for header boost/date_time.hpp   : yes
205
Checking for header boost/detail/endian.hpp : yes
206
Checking for header boost/format.hpp        : yes
207
Checking for header boost/function.hpp      : yes
208
Checking for header boost/functional/factory.hpp : yes
209
Checking for header boost/ptr_container/ptr_vector.hpp : yes
210
Checking for header boost/scoped_ptr.hpp               : yes
211
Checking for header boost/static_assert.hpp            : yes
212
Checking for header boost/thread.hpp                   : yes
213
Configuring boost libraries                            : optimized variant
214
Checking boost ABI tag                                 :
215
Checking boost includes                                : 1_48
216
Checking boost libs                                    : ok
217
Checking for boost linkage                             : ok
218
Checking for header boost/asio.hpp                     : yes
219
Checking for header boost/bind.hpp                     : yes
220
Checking for header boost/date_time.hpp                : yes
221
Checking for header boost/detail/endian.hpp            : yes
222
Checking for header boost/format.hpp                   : yes
223
Checking for header boost/function.hpp                 : yes
224
Checking for header boost/functional/factory.hpp       : yes
225
Checking for header boost/ptr_container/ptr_vector.hpp : yes
226
Checking for header boost/scoped_ptr.hpp               : yes
227
Checking for header boost/static_assert.hpp            : yes
228
Checking for header boost/thread.hpp                   : yes
229
'configure' finished successfully (31.262s)
230
</pre>
231
232
If you don't see that last line that says @'configure' finished successfully@, then something is screwed up and it needs to be fixed.  Fix it and try again.
233 10 Tony Ciavarella
234 1 Tony Ciavarella
h2. Compiling
235
236 20 Tony Ciavarella
The basic strategy for building Disorder is to invoke the waf build system with the desired build variant.
237 1 Tony Ciavarella
238 20 Tony Ciavarella
Disorder has two build variants:
239 23 Tony Ciavarella
* debug: produces a library that contains debugging symbols and disables most compiler optimizations
240
* optimized: produces a library stripped of debugging symbols and enables compiler optimizations for performance
241 1 Tony Ciavarella
242 23 Tony Ciavarella
It might be reasonable to use the @debug@ variant in a development environment and the @optimized@ variant in a production environment.
243 1 Tony Ciavarella
244 23 Tony Ciavarella
The @debug@ variant is produced by the @build_debug@ build target and the @optimized@ variant is produced by the @build_optimized@ build target.
245
246 26 Tony Ciavarella
The results of the build are put in the @bin@ subdirectory under the name of the variant.  
247 23 Tony Ciavarella
248 26 Tony Ciavarella
Both variants can coexist peacefully in the tree at the same time.
249 23 Tony Ciavarella
250 20 Tony Ciavarella
h3. Linux
251 1 Tony Ciavarella
252 23 Tony Ciavarella
On Linux, to build the Disorder @debug@ variant:
253 20 Tony Ciavarella
<pre>./waf build_debug</pre>
254
255
h3. Windows
256
257 23 Tony Ciavarella
On Windows, the waf script is invoked indirectly.  To build the @optimized@ variant:
258
<pre>python.exe waf build_optimized</pre>
259 12 Tony Ciavarella
260 43 Tony Ciavarella
h2. Ensuring Build Correctness
261
262 44 Tony Ciavarella
Due to the complexity of varied compilers and build configurations, it is imperative that you preform the necessary testing on your build to ensure that it performs correctly.
263 43 Tony Ciavarella
264 67 Tony Ciavarella
Don't fret.  It's easy and is well worth the time it takes for the peace of mind you gain.  Just tell waf to run_unit_test_<variant> like this for the @optimized@ variant:
265
<pre>./waf run_unit_test_optimized</pre>
266 43 Tony Ciavarella
267 1 Tony Ciavarella
That should result in something like this:
268
<pre>
269 67 Tony Ciavarella
...
270
[----------] Global test environment tear-down
271 73 Tony Ciavarella
[==========] 772 tests from 75 test cases ran. (2071 ms total)
272
[  PASSED  ] 772 tests.
273
274 67 Tony Ciavarella
*PASS*: All tests passed!  This silly thing actually works properly.  Hooray!
275 73 Tony Ciavarella
Waf: Leaving directory `/usr/local/src/disorder/bin/debug'
276
'run_unit_test_debug' finished successfully (2.821s)
277 43 Tony Ciavarella
</pre>
278
279
If you see
280
<pre>Something failed!  That's not good.  This build cannot be trusted until the damn thing is fixed.</pre>
281
in red at the bottom instead of a green "finished successfully" message, you need to file a bug report and/or fix it yourself and send in a patch.  Under no circumstances should you attempt to use a build that fails the test suite.  A test failure means disorder isn't working as expected for some reason and that reason needs to be resolved for your simulation to function properly.
282
283 1 Tony Ciavarella
h2. Building Against the Disorder Library
284 28 Tony Ciavarella
285
h3. Compiling
286
287
In order to compile your goodness against the Disorder library, you'll need to have the header files from the @src@ directory in the Disorder tree and Eigen's include directory in your compiler's include path.  You do not need anything from SEDRIS SRM in your include path.
288
289
h3. Linking
290
291 29 Tony Ciavarella
Just link your program against Disorder's static library that can be found in the @bin/<build variant>@ directory.