Skip to content

Commit

Permalink
WIP conda-build.
Browse files Browse the repository at this point in the history
Have been iterating build.sh

Current issue is that when a venv is being setup to build the wheel, setuptools cannot be found despite it being installed by conda via requirements.

Trying to install setuptools via pip fails too.

Similarly, cmake can't find conda installed SWIG, however requires it be conda installed to allow build to suceed.

May be able to address this one by manually locating paths to pass to CMake.
  • Loading branch information
Robadob committed Oct 24, 2023
1 parent edf85da commit 46debd4
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
2 changes: 2 additions & 0 deletions swig/conda/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"%PYTHON%" -m pip install "pyflamegpu-2.0.0rc1+cuda122-cp38-cp38-linux_x86_64.whl"
if errorlevel 1 exit 1
25 changes: 25 additions & 0 deletions swig/conda/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

build_threads=${FLAMEGPU_CONDA_BUILD_THREADS:-1}
[[ -z "$FLAMEGPU_CONDA_CUDA_ARCHITECTURES" ]] && build_arch="" || build_arch="-DCMAKE_CUDA_ARCHITECTURES=$FLAMEGPU_CONDA_CUDA_ARCHITECTURES"

# Setup python packages
# Issues with CMake locating ones installed by conda

pip install setuptools wheel build astpretty

mkdir -p build && cd build

#cmake .. -DCMAKE_BUILD_TYPE=Release -DFLAMEGPU_BUILD_PYTHON=ON -DFLAMEGPU_BUILD_PYTHON_CONDA=ON
#temp faster build
cmake .. -DCMAKE_BUILD_TYPE=Release -DFLAMEGPU_BUILD_PYTHON=ON -DFLAMEGPU_BUILD_PYTHON_VENV=OFF -DFLAMEGPU_BUILD_PYTHON_CONDA=ON $build_arch

# Build python wheel
cmake --build . --target pyflamegpu --parallel ${build_threads}

# Install built wheel
pip install lib/Release/python/dist/pyflamegpu-2.0.0rc1+cuda122-cp38-cp38-linux_x86_64.whl

# Cleanup
cd .
rm -rf build
50 changes: 50 additions & 0 deletions swig/conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package:
name: "pyflamegpu"
version: "2.0.0rc1"

source:
git_url: https://github.com/FLAMEGPU/FLAMEGPU2.git
git_rev: v2.0.0-rc
git_depth: 1 # Shallow

# requires: conda config --add channels conda-forge
requirements:
build:
- {{ compiler('cxx') }}
- cuda-toolkit
- swig ==4.0.2 # CMake can't find this, but needs it to build swig from src? (>= does not work either), alt find where conda puts swig and pass path to CMake
- cmake
- python
- pip
- setuptools >=40.8.0 # CMake can't find this when installed by conda
- wheel
- build
- astpretty
run:
- python
- cuda-toolkit

#build:
# track_features:
# - feature2
# run_exports:
# strong:
# - _pyflamegpu
# - libnvrtc
# - libcuda
# - libcudart
# - libdl
# - libstdc++
# - libgcc
# - librt
# - libpthread

test:
imports:
- pyflamegpu

about:
home: https://flamegpu.com/
license: MIT
license_family: MIT
summary: GPU accelerated agent based modelling framework for Python

0 comments on commit 46debd4

Please sign in to comment.