This repository shows some advanced use cases for the OMNeT++ CMake package, including:
- Managing of complex dependencies like INET
- Using functions like add_opp_target to automatically add an OMNeT++ structured folder as a CMake target
- Using add_opp_run to create a debug configuration for Visual Studio Code
- Managing CMake based dependencies
Developing with VS-Code is done easily with the following plugins:
- ms-vscode.cpptools for C/C++ language support
- twxs.cmake for CMake language support
- ms-vscode.cmake-tools for CMake project integration
- schrej.omnetpp-ned for OMNeT++ NED language support
- vadimcn.vscode-lldb (CodeLLDB) for debugging C++ applications
You simply can instruct the VS-Code CMake extension about your OMNeT++ compiler paths by adding a 'cmake-kits.json' file similar to the following example:
[
{
"name": "CLang Omnet++ 6.10 with .venv",
"environmentSetupScript": "${workspaceFolder}/.vscode/omnetpp-6.0pre10env.cmd",
"compilers": {
"C": "path/to/omnetpp-6.0pre10/tools/win64/mingw64/bin/clang.exe",
"CXX": "path/to/omnetpp-6.0pre10/tools/win64/mingw64/bin/clang++.exe"
}
}
]
where the script omnetpp-6.0pre10env.cmd
is optional and can help to initialize the build environment:
set PATH=%PATH%;path\to\omnetpp-6.0pre10\tools\win64\mingw64\bin
set PATH=%PATH%;path\to\omnetpp-6.0pre10\bin
set PATH=%PATH%;path\to\omnetpp-6.0pre10\tools\win64\opt\mingw64\bin
set PATH=%PATH%;path\to\omnetpp-6.0pre10\tools\win64\usr\bin
set PATH=%PATH%;path\to\omnetpp-6.0pre10\lib
rem Optional: Activate a python virtual environment (CMake will then use the corresponding interpreter)
set current_dir="%~dp0"
call %current_dir%..\.venv\Scripts\activate.bat