-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add VS Code tasks and CMake Presets #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add VS Code tasks and CMake Presets #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds Visual Studio Code development environment configurations and CMake presets to the MaterialX repository. The changes aim to streamline the development workflow for contributors using VS Code on Windows.
Changes:
- Added CMakePresets.json with Windows-specific Visual Studio 2022 build configurations
- Added VS Code tasks for configuring, building, and installing MaterialX
- Added VS Code settings for C++ file associations, Python configuration, and pytest integration
- Added VS Code launch configuration for debugging MaterialXView
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| CMakePresets.json | Defines CMake configuration and build presets for Visual Studio 2022 with Debug/Release configurations and optional Metashade support |
| .vscode/tasks.json | Provides VS Code tasks for CMake configuration, build, install, and clean operations |
| .vscode/settings.json | Contains C++ file associations, Python interpreter settings, and pytest configuration |
| .vscode/launch.json | Defines debug launch configuration for MaterialXView using Windows debugger |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| "version": 3, | ||
| "configurePresets": [ | ||
| { | ||
| "name": "windows-base", | ||
| "hidden": true, | ||
| "generator": "Visual Studio 17 2022", | ||
| "binaryDir": "${sourceDir}/build", | ||
| "cacheVariables": { | ||
| "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/installed", | ||
| "MATERIALX_BUILD_VIEWER": "ON", | ||
| "MATERIALX_BUILD_GRAPH_EDITOR": "ON", | ||
| "MATERIALX_BUILD_PYTHON": "ON", | ||
| "MATERIALX_BUILD_TESTS": "ON", | ||
| "MATERIALX_BUILD_METASHADE": "OFF" | ||
| } | ||
| }, | ||
| { | ||
| "name": "default", | ||
| "inherits": "windows-base", | ||
| "displayName": "Default (Windows)", | ||
| "description": "Default build options for Windows (No Metashade)" | ||
| }, | ||
| { | ||
| "name": "metashade", | ||
| "inherits": "windows-base", | ||
| "displayName": "Metashade (Windows)", | ||
| "description": "Build with Metashade features enabled", | ||
| "cacheVariables": { | ||
| "MATERIALX_BUILD_METASHADE": "ON" | ||
| } | ||
| } | ||
| ], | ||
| "buildPresets": [ | ||
| { | ||
| "name": "debug", | ||
| "configurePreset": "default", | ||
| "configuration": "Debug", | ||
| "displayName": "Debug Build", | ||
| "description": "Debug build (Default)" | ||
| }, | ||
| { | ||
| "name": "debug-metashade", | ||
| "configurePreset": "metashade", | ||
| "configuration": "Debug", | ||
| "displayName": "Debug Build (Metashade)", | ||
| "description": "Debug build with Metashade" | ||
| }, | ||
| { | ||
| "name": "release", | ||
| "configurePreset": "default", | ||
| "configuration": "Release", | ||
| "displayName": "Release Build", | ||
| "description": "Release build" | ||
| }, | ||
| { | ||
| "name": "release-metashade", | ||
| "configurePreset": "metashade", | ||
| "configuration": "Release", | ||
| "displayName": "Release Build (Metashade)", | ||
| "description": "Release build with Metashade" | ||
| } | ||
| ] | ||
| } No newline at end of file |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This CMake presets file is Windows-specific (using "Visual Studio 17 2022" generator) but is placed at the repository root where it will apply to all users on all platforms. MaterialX is a cross-platform project that supports Windows, macOS, and Linux. Consider one of the following approaches:
- Add presets for macOS (Xcode, Unix Makefiles) and Linux (Unix Makefiles, Ninja) platforms
- Rename or organize the file to indicate it's Windows-specific (e.g., CMakePresets-Windows.json and provide platform-specific alternatives)
- Use CMakeUserPresets.json instead, which is typically git-ignored and allows per-user configuration without forcing platform-specific settings on all contributors
.vscode/settings.json
Outdated
| "files.associations": { | ||
| "xlocale": "cpp", | ||
| "xlocmon": "cpp", | ||
| "chrono": "cpp", | ||
| "functional": "cpp", | ||
| "future": "cpp", | ||
| "memory": "cpp", | ||
| "random": "cpp", | ||
| "ratio": "cpp", | ||
| "tuple": "cpp", | ||
| "type_traits": "cpp", | ||
| "utility": "cpp", | ||
| "variant": "cpp", | ||
| "xmemory0": "cpp", | ||
| "xtr1common": "cpp", | ||
| "xutility": "cpp", | ||
| "array": "cpp", | ||
| "compare": "cpp", | ||
| "format": "cpp", | ||
| "xmemory": "cpp", | ||
| "xstring": "cpp", | ||
| "deque": "cpp", | ||
| "list": "cpp", | ||
| "map": "cpp", | ||
| "queue": "cpp", | ||
| "set": "cpp", | ||
| "stack": "cpp", | ||
| "vector": "cpp", | ||
| "xhash": "cpp", | ||
| "xtree": "cpp", | ||
| "algorithm": "cpp", | ||
| "xiosbase": "cpp" | ||
| }, | ||
| "python.testing.pytestArgs": [ | ||
| "python/MaterialXTest" | ||
| ], | ||
| "python.testing.unittestEnabled": false, | ||
| "python.testing.pytestEnabled": true, | ||
| "python.testing.cwd": "${workspaceFolder}", | ||
| "python.defaultInterpreterPath": "C:\\Users\\tripc\\AppData\\Local\\Programs\\Python\\Python313\\python.exe", |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Python interpreter path is user-specific and hardcoded to a Windows path for user "tripc". VS Code settings files that are checked into the repository should not contain user-specific paths, as they will not work for other contributors. Consider:
- Removing this line entirely - VS Code will use the system Python or user's configured default
- Moving this configuration to .vscode/settings.json.user or a similar git-ignored file
- Using a relative path or environment variable if a specific Python version is required
The same issue applies to the file associations (lines 3-34) which appear to be auto-generated by VS Code based on individual development activity and may not be universally applicable.
| "files.associations": { | |
| "xlocale": "cpp", | |
| "xlocmon": "cpp", | |
| "chrono": "cpp", | |
| "functional": "cpp", | |
| "future": "cpp", | |
| "memory": "cpp", | |
| "random": "cpp", | |
| "ratio": "cpp", | |
| "tuple": "cpp", | |
| "type_traits": "cpp", | |
| "utility": "cpp", | |
| "variant": "cpp", | |
| "xmemory0": "cpp", | |
| "xtr1common": "cpp", | |
| "xutility": "cpp", | |
| "array": "cpp", | |
| "compare": "cpp", | |
| "format": "cpp", | |
| "xmemory": "cpp", | |
| "xstring": "cpp", | |
| "deque": "cpp", | |
| "list": "cpp", | |
| "map": "cpp", | |
| "queue": "cpp", | |
| "set": "cpp", | |
| "stack": "cpp", | |
| "vector": "cpp", | |
| "xhash": "cpp", | |
| "xtree": "cpp", | |
| "algorithm": "cpp", | |
| "xiosbase": "cpp" | |
| }, | |
| "python.testing.pytestArgs": [ | |
| "python/MaterialXTest" | |
| ], | |
| "python.testing.unittestEnabled": false, | |
| "python.testing.pytestEnabled": true, | |
| "python.testing.cwd": "${workspaceFolder}", | |
| "python.defaultInterpreterPath": "C:\\Users\\tripc\\AppData\\Local\\Programs\\Python\\Python313\\python.exe", | |
| "python.testing.pytestArgs": [ | |
| "python/MaterialXTest" | |
| ], | |
| "python.testing.unittestEnabled": false, | |
| "python.testing.pytestEnabled": true, | |
| "python.testing.cwd": "${workspaceFolder}", |
| { | ||
| "cmake.sourceDirectory": "${workspaceFolder}", | ||
| "files.associations": { | ||
| "xlocale": "cpp", | ||
| "xlocmon": "cpp", | ||
| "chrono": "cpp", | ||
| "functional": "cpp", | ||
| "future": "cpp", | ||
| "memory": "cpp", | ||
| "random": "cpp", | ||
| "ratio": "cpp", | ||
| "tuple": "cpp", | ||
| "type_traits": "cpp", | ||
| "utility": "cpp", | ||
| "variant": "cpp", | ||
| "xmemory0": "cpp", | ||
| "xtr1common": "cpp", | ||
| "xutility": "cpp", | ||
| "array": "cpp", | ||
| "compare": "cpp", | ||
| "format": "cpp", | ||
| "xmemory": "cpp", | ||
| "xstring": "cpp", | ||
| "deque": "cpp", | ||
| "list": "cpp", | ||
| "map": "cpp", | ||
| "queue": "cpp", | ||
| "set": "cpp", | ||
| "stack": "cpp", | ||
| "vector": "cpp", | ||
| "xhash": "cpp", | ||
| "xtree": "cpp", | ||
| "algorithm": "cpp", | ||
| "xiosbase": "cpp" | ||
| }, | ||
| "python.testing.pytestArgs": [ | ||
| "python/MaterialXTest" | ||
| ], | ||
| "python.testing.unittestEnabled": false, | ||
| "python.testing.pytestEnabled": true, | ||
| "python.testing.cwd": "${workspaceFolder}", | ||
| "python.defaultInterpreterPath": "C:\\Users\\tripc\\AppData\\Local\\Programs\\Python\\Python313\\python.exe", | ||
| "python.analysis.extraPaths": [ | ||
| "${workspaceFolder}/build/python", | ||
| "${workspaceFolder}/python" | ||
| ] | ||
| } No newline at end of file |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file associations listed here (lines 3-34) appear to be auto-generated by VS Code based on individual usage patterns. These associations are typically user-specific and don't need to be shared across the team. Unless there's a specific reason to include them (e.g., enforcing specific IntelliSense behavior for the project), consider removing them to keep the settings file focused on project-wide requirements.
| { | |
| "cmake.sourceDirectory": "${workspaceFolder}", | |
| "files.associations": { | |
| "xlocale": "cpp", | |
| "xlocmon": "cpp", | |
| "chrono": "cpp", | |
| "functional": "cpp", | |
| "future": "cpp", | |
| "memory": "cpp", | |
| "random": "cpp", | |
| "ratio": "cpp", | |
| "tuple": "cpp", | |
| "type_traits": "cpp", | |
| "utility": "cpp", | |
| "variant": "cpp", | |
| "xmemory0": "cpp", | |
| "xtr1common": "cpp", | |
| "xutility": "cpp", | |
| "array": "cpp", | |
| "compare": "cpp", | |
| "format": "cpp", | |
| "xmemory": "cpp", | |
| "xstring": "cpp", | |
| "deque": "cpp", | |
| "list": "cpp", | |
| "map": "cpp", | |
| "queue": "cpp", | |
| "set": "cpp", | |
| "stack": "cpp", | |
| "vector": "cpp", | |
| "xhash": "cpp", | |
| "xtree": "cpp", | |
| "algorithm": "cpp", | |
| "xiosbase": "cpp" | |
| }, | |
| "python.testing.pytestArgs": [ | |
| "python/MaterialXTest" | |
| ], | |
| "python.testing.unittestEnabled": false, | |
| "python.testing.pytestEnabled": true, | |
| "python.testing.cwd": "${workspaceFolder}", | |
| "python.defaultInterpreterPath": "C:\\Users\\tripc\\AppData\\Local\\Programs\\Python\\Python313\\python.exe", | |
| "python.analysis.extraPaths": [ | |
| "${workspaceFolder}/build/python", | |
| "${workspaceFolder}/python" | |
| ] | |
| } | |
| { | |
| "cmake.sourceDirectory": "${workspaceFolder}", | |
| "python.testing.pytestArgs": [ | |
| "python/MaterialXTest" | |
| ], | |
| "python.testing.unittestEnabled": false, | |
| "python.testing.pytestEnabled": true, | |
| "python.testing.cwd": "${workspaceFolder}", | |
| "python.defaultInterpreterPath": "C:\\Users\\tripc\\AppData\\Local\\Programs\\Python\\Python313\\python.exe", | |
| "python.analysis.extraPaths": [ | |
| "${workspaceFolder}/build/python", | |
| "${workspaceFolder}/python" | |
| ] | |
| } |
| { | ||
| "name": "Launch MaterialXView", | ||
| "type": "cppvsdbg", | ||
| "request": "launch", | ||
| "program": "${workspaceFolder}/build/bin/Debug/MaterialXView.exe", | ||
| "args": [], | ||
| "stopAtEntry": false, | ||
| "cwd": "${workspaceFolder}/resources/Materials/Examples/StandardSurface", | ||
| "environment": [], | ||
| "console": "integratedTerminal" | ||
| } |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This launch configuration uses a Windows-specific debugger type ("cppvsdbg") and hardcoded Windows paths (.exe extension, Windows-style path separators). Since MaterialX is a cross-platform project supporting Windows, macOS, and Linux, consider:
- Adding platform-specific launch configurations for macOS (using "lldb") and Linux (using "gdb")
- Documenting that this configuration is Windows-only in the name or description
- Using VS Code variables and conditional configurations where possible to support multiple platforms
The hardcoded path to MaterialXView.exe will only work on Windows systems with Visual Studio builds.
| { | ||
| "version": "2.0.0", | ||
| "tasks": [ | ||
| { | ||
| "label": "Configure MaterialX", | ||
| "type": "shell", | ||
| "command": "cmake", | ||
| "args": [ | ||
| "--preset", | ||
| "default" | ||
| ], | ||
| "group": "build", | ||
| "problemMatcher": [], | ||
| "isBackground": false, | ||
| "options": { | ||
| "cwd": "${workspaceFolder}" | ||
| } | ||
| }, | ||
| { | ||
| "label": "Configure MaterialX (Metashade)", | ||
| "type": "shell", | ||
| "command": "cmake", | ||
| "args": [ | ||
| "--preset", | ||
| "metashade" | ||
| ], | ||
| "group": "build", | ||
| "problemMatcher": [], | ||
| "isBackground": false, | ||
| "options": { | ||
| "cwd": "${workspaceFolder}" | ||
| } | ||
| }, | ||
| { | ||
| "label": "Build MaterialX Debug", | ||
| "type": "shell", | ||
| "command": "cmake", | ||
| "args": [ | ||
| "--build", | ||
| "--preset", | ||
| "debug" | ||
| ], | ||
| "group": { | ||
| "kind": "build", | ||
| "isDefault": true | ||
| }, | ||
| "problemMatcher": [ | ||
| "$msCompile", | ||
| "$gcc" | ||
| ], | ||
| "isBackground": false, | ||
| "dependsOn": "Configure MaterialX", | ||
| "options": { | ||
| "cwd": "${workspaceFolder}" | ||
| } | ||
| }, | ||
| { | ||
| "label": "Build MaterialX Debug (Metashade)", | ||
| "type": "shell", | ||
| "command": "cmake", | ||
| "args": [ | ||
| "--build", | ||
| "--preset", | ||
| "debug-metashade" | ||
| ], | ||
| "group": "build", | ||
| "problemMatcher": [ | ||
| "$msCompile", | ||
| "$gcc" | ||
| ], | ||
| "isBackground": false, | ||
| "dependsOn": "Configure MaterialX (Metashade)", | ||
| "options": { | ||
| "cwd": "${workspaceFolder}" | ||
| } | ||
| }, | ||
| { | ||
| "label": "Install MaterialX Debug", | ||
| "type": "shell", | ||
| "command": "cmake", | ||
| "args": [ | ||
| "--install", | ||
| "build", | ||
| "--config", | ||
| "Debug" | ||
| ], | ||
| "group": "build", | ||
| "problemMatcher": [], | ||
| "isBackground": false, | ||
| "dependsOn": "Build MaterialX Debug", | ||
| "options": { | ||
| "cwd": "${workspaceFolder}" | ||
| } | ||
| }, | ||
| { | ||
| "label": "Build MaterialX Release (Metashade)", | ||
| "type": "shell", | ||
| "command": "cmake", | ||
| "args": [ | ||
| "--build", | ||
| "--preset", | ||
| "release-metashade" | ||
| ], | ||
| "group": "build", | ||
| "problemMatcher": [ | ||
| "$msCompile", | ||
| "$gcc" | ||
| ], | ||
| "isBackground": false, | ||
| "dependsOn": "Configure MaterialX (Metashade)", | ||
| "options": { | ||
| "cwd": "${workspaceFolder}" | ||
| } | ||
| }, | ||
| { | ||
| "label": "Clean MaterialX", | ||
| "type": "shell", | ||
| "command": "cmake", | ||
| "args": [ | ||
| "--build", | ||
| "build", | ||
| "--target", | ||
| "clean" | ||
| ], | ||
| "group": "build", | ||
| "problemMatcher": [], | ||
| "isBackground": false, | ||
| "options": { | ||
| "cwd": "${workspaceFolder}" | ||
| } | ||
| } | ||
| ] | ||
| } No newline at end of file |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The VS Code tasks defined here use CMake presets that are only defined for Windows in CMakePresets.json. Since this tasks file will be used by all contributors regardless of platform, the tasks will fail on macOS and Linux systems. The tasks should either:
- Be platform-conditional (using VS Code's platform-specific task syntax)
- Reference CMake presets that exist for all platforms
- Be moved to user-specific configuration files
Additionally, tasks like "Install MaterialX Debug" assume a Windows-style Debug configuration, which may not apply to Unix Makefiles generators used on other platforms.
| { | ||
| "label": "Build MaterialX Release (Metashade)", | ||
| "type": "shell", | ||
| "command": "cmake", | ||
| "args": [ | ||
| "--build", | ||
| "--preset", | ||
| "release-metashade" | ||
| ], | ||
| "group": "build", | ||
| "problemMatcher": [ | ||
| "$msCompile", | ||
| "$gcc" | ||
| ], | ||
| "isBackground": false, | ||
| "dependsOn": "Configure MaterialX (Metashade)", | ||
| "options": { | ||
| "cwd": "${workspaceFolder}" | ||
| } | ||
| }, |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tasks are missing a "Build MaterialX Release" task (without Metashade). Currently, there are build tasks for:
- Build MaterialX Debug (line 35)
- Build MaterialX Debug (Metashade) (line 58)
- Build MaterialX Release (Metashade) (line 96)
But no corresponding "Build MaterialX Release" task that uses the "release" build preset defined in CMakePresets.json (line 50-55). This creates an inconsistency where users can build Debug with and without Metashade, but can only build Release with Metashade enabled.
| { | ||
| "cmake.sourceDirectory": "${workspaceFolder}", | ||
| "files.associations": { | ||
| "xlocale": "cpp", | ||
| "xlocmon": "cpp", | ||
| "chrono": "cpp", | ||
| "functional": "cpp", | ||
| "future": "cpp", | ||
| "memory": "cpp", | ||
| "random": "cpp", | ||
| "ratio": "cpp", | ||
| "tuple": "cpp", | ||
| "type_traits": "cpp", | ||
| "utility": "cpp", | ||
| "variant": "cpp", | ||
| "xmemory0": "cpp", | ||
| "xtr1common": "cpp", | ||
| "xutility": "cpp", | ||
| "array": "cpp", | ||
| "compare": "cpp", | ||
| "format": "cpp", | ||
| "xmemory": "cpp", | ||
| "xstring": "cpp", | ||
| "deque": "cpp", | ||
| "list": "cpp", | ||
| "map": "cpp", | ||
| "queue": "cpp", | ||
| "set": "cpp", | ||
| "stack": "cpp", | ||
| "vector": "cpp", | ||
| "xhash": "cpp", | ||
| "xtree": "cpp", | ||
| "algorithm": "cpp", | ||
| "xiosbase": "cpp" | ||
| }, | ||
| "python.testing.pytestArgs": [ | ||
| "python/MaterialXTest" | ||
| ], | ||
| "python.testing.unittestEnabled": false, | ||
| "python.testing.pytestEnabled": true, | ||
| "python.testing.cwd": "${workspaceFolder}", | ||
| "python.defaultInterpreterPath": "C:\\Users\\tripc\\AppData\\Local\\Programs\\Python\\Python313\\python.exe", | ||
| "python.analysis.extraPaths": [ | ||
| "${workspaceFolder}/build/python", | ||
| "${workspaceFolder}/python" | ||
| ] | ||
| } No newline at end of file |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .vscode directory is being added to version control, but it contains user-specific settings (such as the hardcoded Python interpreter path and auto-generated file associations). Common practice for IDE/editor configurations is to either:
- Add .vscode/ to .gitignore and provide example configurations in documentation
- Only commit workspace-level settings that are truly project-wide, while excluding user-specific settings
- Provide .vscode/*.example files that users can copy and customize
Since MaterialX is a cross-platform project with contributors using different operating systems and development environments, committing Windows-specific VS Code configurations may not be appropriate for the main repository.
No description provided.