ug4
|
Before building ug4, you should make sure that you installed all necessary tools (Prerequisites and Recommended Tools) for your system. Beginners might also want to have a look at Some information about Shell and Linux.
Please follow the description at https://github.com/UG4/ughub to obtain a copy of UG4.
For some helpful bash tools and completion, use the BASH Tools. If you are new to bash/Linux, please also try the bash prompt covered there.
For installing additional software like cmake, SuperLU, BLAS etc. see uginstall - Scripts for installation.
We are using CMake to do an out of source build. That means that the files created at compile time are in a different directory than the source. It is recommended to do the build in subdirectories of YOURUG4ROOT
. Depending on the type of build, you can give them names, most common are build_release
or build_debug
, but some also like debug
or release
. When you are in the directory, you start cmake [DIR]
where [DIR]
is the directory where you find the CMakeLists.txt
which says `project(P_UG4) inside. The following example is for a debug build:
YOURUG4ROOT
mkdir build_debug
cd build_debug
cmake ..
cmake -DCMAKE_TOOLCHAIN_FILE=<TOOLCHAINFILE> ..
Note that there are several options that can be passed to CMake to change the build behaviour. You see always the current chosen setup when runnig cmake ..
and you should see a list of options which you can change. In order to change an option run cmake
again with the parameter -D<option>=<val>
, where <option>
is one of the enumerated options and <val>
is one of the possible values for that option (<
and >
should of course not be typed). The last argument to cmake
always has to be the path which you used when you called cmake the first time.
Note that you only have to specify the variables which you want to change. All other variables will keep their values. Since in our example we want to do a debug build (hence the name build_debug
) we need to enter cmake -DDEBUG=ON ..
. On the console in YOURUG4ROOT/build_debug
.
As default ug is build for all supported world dimensions (Dim = 1,2,3
). If you only need a special dimension (e.g. for code development) and you want to save compilation time, use the -DDIM
option. Examples:
cmake -DDIM=ALL ..
-> Builds all dimensionscmake -DDIM=2 ..
-> Builds only dimension 2cmake -DDIM="2;3" ..
-> Builds dimension 2 and 3, but not 1For CMake Versions older than 2.8 you may be forced to explicitly specify, that the option DIM
is passed as a string. So, please use: cmake -DDIM:STRING=2 ..
etc.
YOURUG4ROOT/build_debug
make
and your ug4 is being build. Common options for make are
-k
: Don't stop at errors-jN
: Where N
is the number of cores. We suggest to use no more than 4 and to keep an eye on memory consumption. There are some files in ug4/ugbase/bridge
which need more than 1 GB RAM when being compiled, so you'll get stuck there.VERBOSE=1
: Do a "verbose" build, i.e., see what happens in detail (commands executed and their output which otherwise is suppressed).With redirection of the output into a file, for later analysis, you would have e.g. (Bash syntax):
make VERBOSE=1 > static-build_make-verbose-output.txt 2>&1
If everything went fine, you can move to YOURUG4ROOT/bin
and start ugshell .