Replace scons with direct clang++ build#680
Open
mpurnell1 wants to merge 2 commits intocommaai:masterfrom
Open
Replace scons with direct clang++ build#680mpurnell1 wants to merge 2 commits intocommaai:masterfrom
mpurnell1 wants to merge 2 commits intocommaai:masterfrom
Conversation
Remove scons dependency and replace with build.py that compiles C++/Cython extensions using direct clang++ calls via subprocess. Supports parallel compilation and incremental builds via -MMD dependency tracking. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4 tasks
Allows callers (e.g. openpilot's scons) to pass additional compiler flags like -DSWAGLOG for swaglog integration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
build.pythat compiles C++/Cython extensions using directclang++/cythonizesubprocess callssubprocess.Popenand incremental builds via-MMDdependency trackingimport msgq/import msgq.visionipc(no-op if already built)Build performance
Clean builds are comparable (~4s gap is the two sequential Cython compile+link steps). No-op rebuilds are faster since it's just stat checks vs scons' dependency database.
What changed
SConstruct,SConscript,site_scons/(custom Cython SCons tool)build.py— standalone build module withbuild_msgq(),build_visionipc(),build_test_runners()msgq/__init__.py,msgq/visionipc/__init__.py— call build functions before importing Cython extensionstest.sh—scons -j8→python build.pypyproject.toml— removedsconsdependency andsite_sconsexclusion.gitignore— swapped.sconsign.dblitefor*.d(clang dependency files)Follows the same pattern as commaai/opendbc#3194
Test plan
./test.shpasses (build + lefthook lint + pytest + C++ test runners).ddepfile checking)