Manual Build and Install

During development and testing, it’s often necessary to build and install openEMS manually. Such cases are encountered when creating a package of openEMS for a new system (especially with non-standard library paths, like certain servers or HPC environments). It’s also useful when modifying the source code of openEMS without rebuilding all the git submodules.

If you are an end-user, please refer to Clone, Build and Install and Installing Ready-Made Packages instead.

Install Dependencies

Refer to Requirements for a list of dependencies.

Install Basic Programs

  1. Build fparser:

cd fparser
mkdir build
cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=/home/user/openEMS
make
make install

cd ..
  1. Build CSXCAD:

cd CSXCAD
mkdir build
cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=/home/user/openEMS
make
make install

cd ..

3. Build openEMS. The CMAke variales -DFPARSER_ROOT_DIR and -DCSXCAD_ROOT_DIR should be pointed to the install root paths of fparser and CSXCAD, which are usually the same as -DCMAKE_INSTALL_PREFIX.

cd openEMS
mkdir build
cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=/home/user/openEMS -DFPARSER_ROOT_DIR=/tmp/opt -DCSXCAD_ROOT_DIR=/tmp/opt
make
make install

cd ..

Install Python bindings (optional)

  1. Build CSXCAD’s Python extension.

cd CSXCAD
cd python
python3 setup.py install --user

cd ..
  1. Build openEMS’s Python extension:

cd openEMS
cd python
python3 setup.py install --user

cd ..

Install AppCSXCAD GUI (optional)

  1. Build QCSXCAD:

cd QCSXCAD
mkdir build
cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=/home/user/openEMS
make
make install

cd ..
  1. Build AppCSXCAD:

cd AppCSXCAD
mkdir build
cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=/home/user/openEMS
make
make install

cd ..

openEMS search path

After the build is complete, add ~/openEMS/bin into your search path:

export PATH=”$HOME/openEMS/bin:$PATH”

You need to write this line into your shell’s profile, such as ~/.bashrc or ~/.zshrc to make this change persistent.

Setup the Octave/Matlab or Python Interfaces

Troubleshooting

On FreeBSD, the default CMake has a bug, causing it unable to find HDF5 for CSXCAD and openEMS (the version in FreeBSD Ports is fine).

CMake Error at /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_HL_LIBRARIES) (found
  suitable version "1.12.2", minimum required is "1.8")
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/share/cmake/Modules/FindHDF5.cmake:1007 (find_package_handle_standard_args)
  CMakeLists.txt:116 (find_package)

If it happens, please change the following line in CMakeLists.txt:

find_package(HDF5 1.8 COMPONENTS C HL REQUIRED)

To:

find_package(HDF5 COMPONENTS C HL REQUIRED)