-
Notifications
You must be signed in to change notification settings - Fork 28
2. Dev Setup
N.B. This is an incomplete draft version of the development environment setup notes
Originally, the README.md contained instructions for how to set up a development environment for the edge-addition-planarity-suite on Windows using the Eclipse IDE (see README.md from commit b4063b). Support was extended to using Visual Studio Code on Windows 10 (both MinGW gcc and MSVC cl) and MacOS Sequoia 15.0 (clang) with the testing of PR #16, and subsequently to include Debian Linux 12.7 with the testing of PR #58. The most recent Visual Studio Code configuration files were updated in PR #92 to reflect the new project structure described by Epic #91.
To install MinGW 32, download and run mingw-get-setup.exe from here and then use the package installer to install C and C++, GDB, MSYS, and any other packages you may want. Then, ensure your gcc is accessible from the command line by adding C:\MinGW\bin to the system PATH.
N.B. These instructions will be revised to cover installing MinGW 64 as a part of Issue #102 - Add support for MinGW 64 and deprecate MinGW 32
To install the MSVC compiler toolchain, follow the third step of Configure VS Code for Microsoft C++ to use the Visual Studio Installer to install the "Desktop development with C++" Visual Studio Build Tools workload. One must use the Developer Command Prompt to use the MSVC compiler toolchain, as other shells won't have the appropriate environment variables set; if you choose to use VSCode with MSVC cl, you must open the Developer Command Prompt, navigate to the edge-addition-planarity-suite repository root, and run VSCode by executing:
code .
To install Python 3.12 on Windows 10:
- Follow 4.1.1. Installation steps using the Python 3.12.7 Windows 64-bit installer from the Python Releases for Windows page.
-
N.B. Unless you choose to customize the installation, you will only install Python for the current user; the
Pathvariable under "User variables for " will be prepended with the user-level Python installation directory (i.e. a subdirectory of%LOCALAPPDATA%)
-
N.B. Unless you choose to customize the installation, you will only install Python for the current user; the
- Open “Manage App Execution Aliases” through the Start menu and toggle both
python3.exeandpython3.exeto off, - Confirm successful installation by opening a command prompt and checking the output from
python --version:C:\Users\wbkbo>python --version Python 3.12.7
If you follow 4.2. The Microsoft Store package, you may end up installing a higher version of Python than that which the TestSupport/planaritytesting package has been tested.
Creating a Windows 10 22H2 VM using VirtualBox
If you are on a Windows device and wish to create a Windows 10 Home 22H2 virtual machine to contain your development environment, you can download the Windows 10 Media Creation tool which will help you create an .iso file. Otherwise, you may download the .iso file directly from the Windows 10 Home 22H2 ISO Download page.
- Ensure your username is part of the
sudoersgroup; if not, then follow the advice in the replies to this Unix StackExchange post - Run the following command
To install build dependencies (i.e. the
sudo apt update && sudo apt -y upgrade && sudo apt install -y build-essential gdb autotools-devbuild-essentialmetapackage, which includesgccbut doesn't includegdb, as well as the GNU Autotools (see the Autotools FAQ and the Debian AutoTools home for more info))-
N.B. It is preferable to use
aptrather thanapt-getto update, upgrade, and install packages due to more sophisticated package search, system memory cleanup, and dependency resolution; please see the AWS docs on What’s the Difference Betweenaptandapt-get? for more in-depth justification.
-
N.B. It is preferable to use
- To build Python 3.12 from source on Debian Linux, please follow the Python documentation page Building Python; in particular, please ensure that you run
make altinstallso that you do not override the systempython3binary.-
N.B. Although the
TestSupport/planaritytestingpackage doesn't depend on extension modules that impose further requirements of development headers for additional libraries, it might be prudent to follow the Python Developer's Guide - Build Dependencies for instructions on how to get all build dependencies on Linux. If you decide to install these dependencies after having initially built and installed Python 3.12 from source, you'll have to re-runconfigureandmake altinstall.
-
N.B. Although the
Creating a Debian Linux 12.7 VM using VirtualBox
If you wish to create a Debian Linux VM to contain your development environment, you can get the most recent version of Debian Linux from the Debian Downloads page; however, the edge-addition-planarity-suite has been tested on Debian 12.7.0, the netinst CD image .iso for which may be obtained from Installing Debian 12.7 (Bookworm). If you are using VirtualBox to set up your VM, follow a guide like How To Install Debian 12 on VirtualBox, which includes instructions for how to set up VirtualBox Guest Additions on the Debian Linux VM; there are alternate instructions for how to install VirtualBox Guest Additions on the VM provided by the Debian Wiki: Installing the Guest Additions on a Debian VM - Debian 10 "Buster", Debian 11 "Bullseye", and Debian 12 "Bookworm". If your sources.list doesn't contain the expected package mirrors, you can copy a default version by running:
sudo cp /usr/share/doc/apt/examples/sources.list /etc/apt/sources.list
Recommended in this reply to a Unix StackExchange post.
- Open a terminal window and type:
% xcode-select --install xcode-select: note: install requested for command line developer tools - A new prompt will open outside the terminal window; click 'Install'
- Agree to the Command Line Tools License Agreement
- A new prompt will open indicating the progress as the software is downloaded
- Verify that Xcode command line tools were correctly installed and the requisite utilities are present:
Where
% xcode-select -p /Applications/Xcode.app/Contents/Developer % which clang /usr/bin/clang % which lldb /usr/bin/lldb % which leaks /usr/bin/leaksclangis the compiler,lldbis the debugger, andleaksis a command-line tool for finding memory leaks (see the 3. Test Support wiki page section on Automating memory checking on MacOS usingleaks) - To install Python 3.12 on MacOS, download the Python 3.12.7 macOS 64-bit universal2 installer from the Python Releases for macOS, or from the Python 3.12.7 release page.
N.B. Issue #111 has been created to investigate whether we should be using the
clanginstalled viahomebrewrather than that which is installed with the Xcode command line tools
Installing Python 3.12 using Homebrew (NOT recommended)
- Follow The Hitchhiker's Guide to Python instructions for Installing Python 3 on Mac OS X. This recommends using
homebrewto install Python 3 using the commandbrew install python; however, you can specifypython@3.12by running the install command:% brew install python@3.12 - In order to ensure the proper environment variables are set for
homebrew, you must add the following to your~/.zprofilefile:Then runeval "$(/opt/homebrew/bin/brew shellenv)"source ~/.zprofile - Check what the aliases for
pythonandpython3correspond to by typing the following:% python --version zsh: command not found: python % which python python not found % python3 --version Python 3.9.X <----- INSTALLED BY xcode-select --install % which python3 /usr/bin/python3 % python3.12 --version Python 3.12.7 % which python3.12 /opt/homebrew/bin/python3.12 - To set the alias
pythonandpython3to correspond to thepython3.12binary, add the following to your~/.zprofilefile:Then runexport PATH=/opt/homebrew/opt/python@3.12/libexec/bin:$PATHsource ~/.zprofile.-
N.B. If you do not follow this step, then scripts in the
TestSupport/planaritytestingpackage (see 3. Test Support) must be run usingpython3.12as the interpreter alias
-
N.B. If you do not follow this step, then scripts in the
Creating a MacOS Sequoia 15.0 VM using UTM
If you wish to create a MacOS VM to contain your development environment, visit the Apple Developer Download page and sign in using your Apple ID; then, search for MacOS (i.e. Sequoia 15.0) and click the link labelled Mac computers with Apple silicon to download the .ipsw restore image. Then, download UTM and install this system emulator. Finally, follow their instructions for How to set up a MacOS Guest using the .ipsw previously downloaded.
To install Visual Studio Code on Windows, follow Visual Studio Code on Windows - Installation, and then depending on which compiler toolchain you have installed, follow either Using GCC with MinGW or Configure VS Code for Microsoft C++.
To install Visual Studio Code on MacOS, follow Visual Studio Code on macOS - Installation, and then Using Clang in Visual Studio Code.
To install Visual Studio Code on Linux, follow Visual Studio Code on Linux - Installation, and then Using C++ on Linux in VS Code.
Once you have installed VSCode on your chosen platform(s), you must Browse for extensions and choose to install:
- C/C++ Extension Pack -
ms-vscode.cpptools-extension-packName: C/C++ Extension Pack Id: ms-vscode.cpptools-extension-pack Description: Popular extensions for C++ development in Visual Studio Code. Version: 1.3.0 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools-extension-pack - Python -
ms-python.pythonName: Python Id: ms-python.python Description: Python language support with extension access points for IntelliSense (Pylance), Debugging (Python Debugger), linting, formatting, refactoring, unit tests, and more. Version: 2024.14.1 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.python - Pylint -
ms-python.pylintName: Pylint Id: ms-python.pylint Description: Linting support for Python files using Pylint. Version: 2023.10.1 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.pylint - Black Formatter -
ms-python.black-formatterName: Black Formatter Id: ms-python.black-formatter Description: Formatting support for Python files using the Black formatter. Version: 2024.2.0 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter - GitLens -
eamodio.gitlensName: GitLens — Git supercharged Id: eamodio.gitlens Description: Supercharge Git within VS Code — Visualize code authorship at a glance via Git blame annotations and CodeLens, seamlessly navigate and explore Git repositories, gain valuable insights via rich visualizations and powerful comparison commands, and so much more Version: 15.5.1 Publisher: GitKraken VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens
Finally, one must run the edge-addition-planarity-suite/devEnvSetupAndDefaults/devEnvSetupScript.sh (to be added in forthcoming PR to satisfy Issue #89) to copy the bespoke tasks.json and launch.json into the .vscode directory at the root of the project. These configuration files allow users to build and run/debug the planarity executable on Windows (MinGW gcc and MSVC cl), Debian Linux (gcc), and MacOS (clang), and also enable one to debug the Python TestSupport scripts. Additionally, this script copies a bespoke settings.json to configure the pylint as well as the black Python formatter extension.
Debug and Release configurations within tasks.json and launch.json for C/C++ applications
To debug the planarity executable within VSCode:
- Update the
argsarray of your platform's Debug configuration to contain a quotes-enclosed comma-separated list of the command-line parameters; for example, from the "C/C++: (Windows) [Debug] gcc.exe build and debug planarity project" inlaunch.json:... "args": [ ... // Command: `planarity -test <samplesDir>` // "-test", // "${workspaceFolder}\\c\\samples" ], ... - Add desired breakpoints
- Ensure a
.cfile's tab has focus before clicking the dropdown next to the play button icon ("[Run|Debug] C/C++ File") in the top right of the VSCode editor and select "Debug C/C++ File" - Select the launch configuration corresponding to your current platform and compiler toolchain; please read the following for the correspondence between
tasks.jsonbuild tasks andlaunch.jsonrun/debug configurations.
- For MinGW
gcc, refer to Using GCC with MinGW sections Run helloworld.cpp and Customize debugging withlaunch.json-
C/C++: (Windows) [Debug] gcc.exe build planarity projectintasks.jsonis thepreLaunchTaskforC/C++: (Windows) [Debug] gcc.exe build and debug planarity projectinlaunch.json -
C/C++: (Windows) [Release] gcc.exe build planarity projectintasks.jsonis thepreLaunchTaskforC/C++: (Windows) [Release] gcc.exe build and run planarity projectinlaunch.json
-
- For MSVC
cl, refer to Configure VS Code for Microsoft C++ sections Run helloworld.cpp and Customize debugging with launch.json. N.B. You must run VSCode from the Developer Command Prompt, otherwise you won't have the appropriate environment variables set to build using MSVCclnor to debug; see section Check your Microsoft Visual C++ installation-
C/C++: (Windows) [Debug] cl.exe build planarity projectintasks.jsonis thepreLaunchTaskforC/C++: (Windows) [Debug] cl.exe build and debug planarity projectinlaunch.json -
C/C++: (Windows) [Release] cl.exe build planarity projectintasks.jsonis thepreLaunchTaskforC/C++: (Windows) [Release] cl.exe build and run planarity projectinlaunch.json
-
- For
gccon Linux, refer to Using C++ on Linux in VS Code sections Run helloworld.cpp and Customize debugging with launch.json-
C/C++: (Linux) [Debug] gcc build planarity projectintasks.jsonis thepreLaunchTaskforC/C++: (Linux) [Debug] gcc build and debug planarity projectinlaunch.json -
C/C++: (Linux) [Release] gcc build planarity projectintasks.jsonis thepreLaunchTaskforC/C++: (Linux) [Release] gcc build and run planarity projectinlaunch.json
-
- For
clangon MacOS refer to Using Clang in Visual Studio Code sections Run helloworld.cpp, specifically Understanding tasks.json and Customize debugging with launch.json-
C/C++: (MacOS) [Debug] clang build planarity projectintasks.jsonis thepreLaunchTaskforC/C++: (MacOS) [Debug] clang build and debug planarity projectinlaunch.json -
C/C++: (MacOS) [Release] clang build planarity projectintasks.jsonis thepreLaunchTaskforC/C++: (MacOS) [Release] clang build and run planarity projectinlaunch.json
-
Debug configuration for Python TestSupport scripts
Please see the 3. Test Support wiki page for more context on the scripts within the TestSupport/planaritytesting package, in particular their command-line parameterization; to debug one of these scripts using the "Python Debugger: Current File with Arguments" configuration:
- Update the
argsarray to contain a quotes-enclosed comma-separated list of the command-line parameters:... "args": [ // Args to test test_table_generation_with_numInvalidOK.py // "-n", // "5,8", // "-c", // "3", // "p", // "o" ] ... - Open the target Python script
- Set any desired breakpoints
- Ensure the tab corresponding to the target Python script has focus
- Click the dropdown next to the play button icon ("Run Python File") in the top right of the VSCode editor and select "Python Debugger: Debug using launch.json"
- Select "Python Debugger: Current File with Arguments"
For greater context on how to debug Python applications in VSCode using the "Python Debugger: Current File with Arguments" configuration in launch.json, please see Python debugging in VS Code. In particular, the section Set configuration options details the keys and possible values to augment the Python debugging experience.
Python linting and formatting for the TestSupport scripts
The settings.json customizes the behaviour of the pylint and black VSCode extensions.
N.B. Issue #100 will entail filling out further detail of this configuration.
For greater context on the configuration for linting and formatting specified in settings.json, please refer to Linting Python in Visual Studio Code and Formatting Python in VS Code.
N.B. These instructions were originally a part of
README.md(commit # b4063bf) and refer to older software versions; Issue #103 will entail updating these instructions.
To set up the Eclipse IDE on Windows 10:
- Install a recent version of the Java JDK (such as Java version 14 or higher)
- Ensure that you set the
JAVA_HOMEsystem environment variable (e.g. toc:\Program Files\Java\jdk-14.0.1) - Ensure that you add
%JAVA_HOME%\binto your systemPATH - Install Eclipse, such as the "Eclipse IDE for Enterprise Java Developers"
- In Eclipse, and install the C Development Tools (CDT)
- In Eclipse, choose the menu option Help > Install New Software
- Choose to work with the main repository (e.g. 2020 - 06 - http://download.eclipse.org/releases)
- Under Programming Languages, choose C/C++ Autotools, C/C++ Development Tools, C/C++ Development Tools SDK, C/C++ Library API Documentation Hover Help, and C/C++ Unit Testing Support
- Run the
edge-addition-planarity-suite/devEnvSetupAndDefaults/devEnvSetupScript.sh(N.B. Will be added in forthcoming PR to satisfy Issue #89) to copy defaults for the following files:edge-addition-planarity-suite/.projectedge-addition-planarity-suite/c/.projectedge-addition-planarity-suite/c/.cproject
Coming soon
Coming soon
N.B. The following process has been tested on Debian Linux 12.7.0 and Windows 10 22H2 with MinGW 32
Coming soon