Skip to content

Commit

Permalink
Use system pybind11 for building dartpy
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 committed Jan 21, 2025
1 parent d5a62b3 commit 909eec7
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 33 deletions.
52 changes: 44 additions & 8 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 11 additions & 21 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ninja = ">=1.11.1"
pip = ">=24.0"
pipx = ">=1.4.3"
pkg-config = ">=0.29.2"
pybind11 = ">=2.13.6,<3"
pytest = ">=8.1.1"
setuptools = ">=69.1.1"

Expand Down Expand Up @@ -51,11 +52,12 @@ config = { cmd = """
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
-DDART_BUILD_DARTPY=$DART_BUILD_DARTPY \
-DDART_USE_SYSTEM_GOOGLEBENCHMARK=ON \
-DDART_USE_SYSTEM_GOOGLETEST=ON \
-DDART_USE_SYSTEM_IMGUI=ON \
-DDART_VERBOSE=$DART_VERBOSE
""", env = { DART_VERBOSE = "OFF", BUILD_TYPE = "Release" } }
""", env = { DART_BUILD_DARTPY = "OFF", DART_VERBOSE = "OFF", BUILD_TYPE = "Release" } }

lint-cpp = { cmd = """
cmake \
Expand Down Expand Up @@ -98,11 +100,8 @@ build-tests = { cmd = """
""", depends-on = ["config"], env = { BUILD_TYPE = "Release" } }

build-dartpy = { cmd = """
cmake \
--build build/$PIXI_ENVIRONMENT_NAME/cpp/$BUILD_TYPE \
-j \
--target dartpy
""", depends-on = ["config"], env = { BUILD_TYPE = "Release" } }
pip install . -vv
""", env = { BUILD_TYPE = "Release", DART_BUILD_DARTPY = "ON" } }

test = { cmd = """
ctest \
Expand All @@ -111,10 +110,7 @@ test = { cmd = """
""", depends-on = ["build-tests"], env = { BUILD_TYPE = "Release" } }

test-dartpy = { cmd = """
cmake \
--build build/$PIXI_ENVIRONMENT_NAME/cpp/$BUILD_TYPE \
-j \
--target pytest
pytest python/tests
""", depends-on = ["config"], env = { BUILD_TYPE = "Release" } }

test-all = { cmd = """
Expand Down Expand Up @@ -329,12 +325,13 @@ config = { cmd = """
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
-DDART_BUILD_DARTPY=$DART_BUILD_DARTPY \
-DDART_MSVC_DEFAULT_OPTIONS=ON \
-DDART_USE_SYSTEM_GOOGLEBENCHMARK=ON \
-DDART_USE_SYSTEM_GOOGLETEST=ON \
-DDART_USE_SYSTEM_IMGUI=ON \
-DDART_VERBOSE=$DART_VERBOSE
""", env = { DART_VERBOSE = "OFF" } }
""", env = { DART_BUILD_DARTPY = "OFF", DART_VERBOSE = "OFF" } }

lint-py = { cmd = """
black . --exclude '\\..*' && isort . --skip-glob '.*'
Expand Down Expand Up @@ -364,11 +361,8 @@ build-tests = { cmd = """
""", depends-on = ["config"], env = { BUILD_TYPE = "Release" } }

build-dartpy = { cmd = """
cmake \
--build build/$PIXI_ENVIRONMENT_NAME/cpp \
-j \
--target dartpy
""", depends-on = ["config"] }
pip install . -vv
""", depends-on = ["config"], env = { DART_BUILD_DARTPY = "ON" } }

test = { cmd = """
ctest \
Expand All @@ -378,11 +372,7 @@ test = { cmd = """
""", depends-on = ["build-tests"], env = { BUILD_TYPE = "Release" } }

test-dartpy = { cmd = """
cmake \
--build build/$PIXI_ENVIRONMENT_NAME/cpp \
--config $BUILD_TYPE \
-j \
--target pytest
pytest python/tests
""", depends-on = ["config"], env = { BUILD_TYPE = "Release" } }

test-all = { cmd = """
Expand Down
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,16 @@ def build_extension(self, ext: CMakeExtension) -> None:
# DARTPY_VERSION_INFO shows you how to pass a value into the C++ code
# from Python.
cmake_args = [
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}",
f"-DPYTHON_EXECUTABLE={sys.executable}",
f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm
f"-DBUILD_SHARED_LIBS=OFF",
f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}",
f"-DDART_BUILD_DARTPY=ON",
f"-DDART_ENABLE_SIMD=OFF",
f"-DDART_BUILD_WHEELS=ON",
f"-DDART_ENABLE_SIMD=OFF",
f"-DDART_TREAT_WARNINGS_AS_ERRORS=OFF",
f"-DDART_USE_SYSTEM_PYBIND11=ON",
f"-DDART_VERBOSE=ON",
f"-DPYTHON_EXECUTABLE={sys.executable}",
]
build_args = []
# Adding CMake arguments set as environment variable
Expand Down

0 comments on commit 909eec7

Please sign in to comment.