build: migrate from git submodule to CPM for dependency management#116
build: migrate from git submodule to CPM for dependency management#116izzalDev wants to merge 4 commits into
Conversation
Replace dlprimitives git submodule with CPM (CMake Package Manager) to automatically fetch dlprimitives, OpenCL-Headers, and OpenCL-CLHPP at build time. This removes the need for --recurse-submodules on clone. - Remove .gitmodules and dlprimitives submodule - Add cmake/CPM.cmake bootstrap script (v0.42.3) - Update CMakeLists.txt to use CPMAddPackage for all C++ dependencies - Switch include_directories to target_include_directories on pt_ocl - Bump cmake minimum version to 3.15 - Add pyproject.toml for scikit-build-core / uv based Python packaging - Update README-build.md to reflect new uv-based build workflow
|
With scikit-build-core, you no longer need to manually specify the Python and Pytorch paths, having to write those path every build is a real pain. Instead of spending time on configuration, this lets contributors stay focused on the implementation. |
|
Can you please elaborate - I'm not aware of CPM and there is another good reason for submodule - development. I frequently do changed in dlprimitives together with pytorch dlprim - so having it as submodule allows smooth transition. As I modify it in submodule directly and commit changes.
|
|
CPM (CMake Package Manager) simplifies dependency management by handling libraries like OpenCL headers automatically within CMake, keeping your system clean without the need for external package managers (such as apt, Homebrew, vcpkg, or Conan). On the other hand, you can still use Git Submodules for the active development of dlprimitives to ensure that the process of modifying and committing code across projects remains smooth, standard, and portable. Do you want to keep using submodules for that part? |
Summary
Replaces the
dlprimitivesgit submodule with CPM.cmake so that all C++ dependencies are fetched automatically at CMake configure time. Callers no longer need--recurse-submoduleswhen cloning.Also adds
pyproject.tomlto enable building and installing the package viauv build/pip install .using scikit-build-core.Motivation
CPM_SOURCE_CACHE.pyproject.tomlmakes the project installable with standard Python tooling without manual CMake invocations.Changes
.gitmodulesdlprimitivescmake/CPM.cmakeCMakeLists.txtCPMAddPackagefor dlprimitives, OpenCL-Headers, OpenCL-CLHPP; switch totarget_include_directories; bump cmake min to 3.15pyproject.tomlREADME-build.mdHow to test
--recurse-submodules— build should succeed.uv buildand verify a.whlis produced indist/.python mnist.py --device ocl:0.CPM_SOURCE_CACHE=$HOME/.cache/CPM, deletebuild/, reconfigure — deps should load from cache without re-downloading.