Build the source code
Contents
Build the source code#
Step 1: Open the source code folder#
As we did in the Future visit of the source code.
Step 2: Activate the intel environment#
Use the module load command as mentioned in previous step. Or you may ignore this if you have already setup the ~/.bashrc file properly.
Click F1 to open the command palette, then type intel initialize and click Intel oneAPI: Initialize default environment variabls.
Step 3: CMake Configure#
Use the following command to perform the configuration step in using cmake. We are relying on cmake presets (that’s why we require version higher than 3.20) to make our usage of cmake easier and more standarized.
cmake --preset="linux-intel-Debug" -S "."
In most cases, you just need to configure your project once.
Step 4: CMake Build#
Once the project is configured, you can now build your project. Here we choose the linux-intel-Debug preset, you may choose other presets base on your needs.
Warning
The linux-intel-Debug preset is configured to skip the license checking, so DO NOT distribute program built with this preset to any users without access to our source code, otherwise they will have unlimited access to our library subroutines.
cmake --build --preset="linux-intel-Debug"
You may specify the cmake target that you want to build, for example, the default target is all.
cmake --build --preset="linux-intel-Debug" --target all
I created some alias for the commands in setvars.sh, you can update your bashrc to use these aliases.
echo 'source ~/work/PhaseFieldSDK/setvars.sh' >> ~/.bashrc
Step 5: Add alias for executable#
The built output are located within out/build/linux-intel-Debug. The library archive file is located at out/build/linux-intel-Debug/dev/libmuprolib.a. The executables are located within their corresponding folder, such as the ferroelectric main program is located at out/build/linux-intel-Debug/apps/PhaseFieldFerroelectric/apps/basic/muFerroBasic.
To make future usage of the executables easier, we can create alias for the executables in the bashrc file. Such as for the ferroelectric executable, we can use the following command:
echo 'alias muferro="~/work/PhaseFieldSDK/out/build/linux-intel-Debug/apps/PhaseFieldFerroelectric/apps/basic/muFerroBasic"' >> ~/.bashrc