## Step 1: Install Prerequisites
Before you can build NetAnim, you need to set up your Mac for development.
-
Install Xcode Command Line Tools: This package provides essential compilers and tools like
makeandgit. Open your Terminal and run:Bash
xcode-select --install -
Install Homebrew: Homebrew is a package manager that makes it easy to install software on macOS.
Bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
## Step 2: Install the Qt Dependency
NetAnim's graphical interface is built using the Qt framework. You can install it easily with Homebrew.
-
On an Apple Silicon Mac (M1/M2/M3): It's often best to install Qt version 5.
Bash
brew install qt@5 -
On an Intel Mac: You can install the latest version.
Bash
brew install qt
After installation, you must add Qt's tools to your shell's PATH.
-
Open your Zsh configuration file:
Bash
nano ~/.zshrc -
Add the correct line for your setup.
-
For qt@5 on Apple Silicon:
export PATH="/opt/homebrew/opt/qt@5/bin:$PATH" -
For qt@6 on Apple Silicon:
export PATH="/opt/homebrew/opt/qt/bin:$PATH" -
For qt@5 on Intel:
export PATH="/usr/local/opt/qt@5/bin:$PATH"
-
-
Save the file (
Ctrl + X,Y,Enter) and reload your shell:Bash
source ~/.zshrc
## Step 3: Get the NetAnim Source Code
You can download the source code directly using git. This gives you the latest version.
Bash
git clone https://gitlab.com/nsnam/netanim.git
cd netanim
## Step 4: Build the Executable with CMake 🛠️
Modern versions of NetAnim use CMake to handle the build process.
-
Create a Build Directory: From the
netanimroot directory, create a separate folder for the build files. This is a best practice that keeps the source directory clean.Bash
mkdir build cd build -
Configure the Build: Run
cmakeand point it to the parent directory, where the mainCMakeLists.txtconfiguration file is located.Bash
cmake .. -
Compile the Code: Run
maketo compile the source code and link it against the Qt libraries.Bash
make
## Step 5: Run NetAnim ✅
If the build completes without errors, the NetAnim executable will be located inside the build directory. You can now run it from the Terminal.
Bash
./NetAnim
The NetAnim application window should appear on your screen, ready to visualize your network simulation data!