Skip to content
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

conda packaging (experimental WIP) #1131

Draft
wants to merge 34 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9108703
Build flamegpu binaries(and pyflamegpu linking with shared cuda libs.
Robadob Oct 23, 2023
b926d94
WIP conda-build.
Robadob Oct 24, 2023
e8a193d
Find swig works now
Robadob Oct 24, 2023
086c96e
final changes of the day
Robadob Oct 24, 2023
5bd7a9a
Enable bash output in conda/build.sh for debugging
ptheywood Oct 24, 2023
42b1fc1
Don't use CMAKE_ARGS for now, it breaks find_jitify on my local machi…
ptheywood Oct 24, 2023
5eaec7e
Switch to using the current committed git state, rather than cloning …
ptheywood Oct 24, 2023
3101a2f
Fix forwarding of FLAMEPGU_CONDA_ env vars for cuda arch and parllleism
ptheywood Oct 24, 2023
b858422
Remove redundant(?) -v
Robadob Oct 25, 2023
9cc2cdf
Fix find_jitify()
Robadob Oct 25, 2023
4ee709a
Fix compiler CUDA
Robadob Oct 25, 2023
c23862b
This now finds setuptools, but wheel is missing at build time.
Robadob Oct 25, 2023
7d9a92f
setupptolls >= 40.8.0, == is 2.7 only via mambasolve?
ptheywood Oct 25, 2023
2cfb245
try no isolation
ptheywood Oct 25, 2023
77d05db
Add comment about --no-isolation should be conda only
ptheywood Oct 25, 2023
8a0cec4
Try packages being in run?
ptheywood Oct 25, 2023
e3a7522
wip
ptheywood Oct 25, 2023
283b0b3
Linux conda tenuously now works.
Robadob Oct 30, 2023
3ea87b1
Fix overlinking warnings.
Robadob Oct 30, 2023
395bb94
Supress python/ast pretty warning
Robadob Oct 30, 2023
39af3fb
WIP windows
Robadob Oct 30, 2023
1659fc1
CMake typos
Robadob Oct 30, 2023
f0690a8
Windows now works, warnings still to address (and need to test the pa…
Robadob Oct 30, 2023
245820f
bld.bat cleanup
Robadob Oct 31, 2023
5c67dd4
cleanup build.sh
Robadob Oct 31, 2023
989932e
Fix windows warnings.
Robadob Oct 31, 2023
a0df6d2
Add note re version, tbd with Pete.
Robadob Oct 31, 2023
f38a298
Fix windows run reqs.
Robadob Oct 31, 2023
d8977cf
Split conda recipe into vis and not vis
Robadob Oct 31, 2023
fbb9762
Linux will require fontconfig for vis build too
Robadob Nov 1, 2023
6e8170a
Direct vis to conda test branch
Robadob Nov 1, 2023
520debc
Now appears to build vis conda properly on Windows.
Robadob Nov 1, 2023
d1b63fd
wip linux opengl stuff (it doesn't work)
Robadob Nov 3, 2023
a1f34e8
wasn't meant to commit this
Robadob Nov 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ cmake --build . --target all
| `CMAKE_CUDA_ARCHITECTURES` | e.g `60`, `"60;70"` | [CUDA Compute Capabilities][cuda-CC] to build/optimise for, as a `;` separated list. See [CMAKE_CUDA_ARCHITECTURES][cmake-CCA]. Defaults to `all-major` or equivalent. Alternatively use the `CUDAARCHS` environment variable. |
| `FLAMEGPU_SEATBELTS` | `ON`/`OFF` | Enable / Disable additional runtime checks which harm performance but increase usability. Default `ON` |
| `FLAMEGPU_BUILD_PYTHON` | `ON`/`OFF` | Enable Python target `pyflamegpu` via Swig. Default `OFF`. Python packages `setuptools`, `build` & `wheel` required |
| `FLAMEGPU_BUILD_PYTHON_VENV` | `ON`/`OFF` | Use a python `venv` when building the python Swig target. Default `ON`. Python package `venv` required |
| `FLAMEGPU_BUILD_PYTHON_VENV` | `ON`/`OFF` | Use a Python `venv` when building the Python Swig target. Default `ON`. Python package `venv` required |
| `FLAMEGPU_BUILD_PYTHON_CONDA` | `ON`/`OFF` | Build target 'pyflamegpu' as a Conda compatible Python package. Default `OFF`. |
| `FLAMEGPU_BUILD_TESTS` | `ON`/`OFF` | Build the C++/CUDA test suite. Default `OFF`. |
| `FLAMEGPU_BUILD_TESTS_DEV` | `ON`/`OFF` | Build the reduced-scope development test suite. Default `OFF` |
| `FLAMEGPU_ENABLE_GTEST_DISCOVER` | `ON`/`OFF` | Run individual CUDA C++ tests as independent `ctest` tests. This dramatically increases test suite runtime. Default `OFF`. |
Expand Down
2 changes: 1 addition & 1 deletion cmake/CUDAArchitecturesProjectInclude.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Set a locally scoped cmake variable, to alter the error message within.
set(flamegpu_IN_PROJECT_INCLUDE ON)
# Call the appropraite command to set CMAKE_CUDA_ARCHITECTURES to the user-provided value, the exising value, or a sane libray-provided defualt
# Call the appropriate command to set CMAKE_CUDA_ARCHITECTURES to the user-provided value, the existing value, or a sane library-provided default
flamegpu_set_cuda_architectures()
# Unset the variable used to alter behaviour in set_cuda_architectures
unset(flamegpu_IN_PROJECT_INCLUDE)
10 changes: 5 additions & 5 deletions cmake/CheckCompilerFunctionality.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ function(flamegpu_check_compiler_functionality)
return()
endif()

# Ensure that required languages are avialable.
# Enabling the languages must however be perfomed in file scope, so do this in the root cmake after docs only checks have been found.
# Ensure that required languages are available.
# Enabling the languages must however be performed in file scope, so do this in the root cmake after docs only checks have been found.
include(CheckLanguage)
check_language(CXX)
if(NOT CMAKE_CXX_COMPILER)
Expand All @@ -26,7 +26,7 @@ function(flamegpu_check_compiler_functionality)
endif()
enable_language(CUDA)

# We need c++17 std::filesytem, but not all compilers which claim to implement c++17 provide filesystem (GCC 7)
# We need c++17 std::filesystem, but not all compilers which claim to implement c++17 provide filesystem (GCC 7)
if(NOT DEFINED CUDA_STD_FILESYSTEM)
# Disable CMAKE_CUDA_ARCHTIECTURES if not already controlled. This is scoped to the function so safe to control.
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES OR "${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "")
Expand Down Expand Up @@ -120,7 +120,7 @@ function(flamegpu_check_compiler_functionality)
CXX_STANDARD_REQUIRED "ON"
)
endif()
# If an error occured while building MWE emit a dev warning.
# If an error occurred while building MWE emit a dev warning.
if(NOT GCC_CUDA_VECTOR_TUPLE_PUSHBACK)
# If the GCC versions is known to be bad, give an appropriate error
message(AUTHOR_WARNING
Expand All @@ -129,7 +129,7 @@ function(flamegpu_check_compiler_functionality)
"See https://github.com/FLAMEGPU/FLAMEGPU2/issues/650")
# Not erroring, so don't change the output value, just emit the above developer warning

# The compilation error is somewhat tempremental, so always emit a warning for the known bad combination
# The compilation error is somewhat temperamental, so always emit a warning for the known bad combination
elseif(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "11.0" AND CMAKE_CUDA_COMPILER_VERSION VERSION_LESS "11.1" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "9" AND CMAKE_CXX_COMILER_VERSION VERSION_LESS "10")
message(AUTHOR_WARNING
"CUDA 11.0 with g++ 9 in c++17 mode may encounter compiler segmentation faults with 'std::vector<std::tuple<...>>::push_back'.\n"
Expand Down
10 changes: 5 additions & 5 deletions cmake/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "Control the output of compi
# Use the FindCUDATooklit package (CMake > 3.17) to find other parts of the cuda toolkit not provided by the CMake language support
find_package(CUDAToolkit REQUIRED)

# Control how we link against the cuda runtime library (CMake >= 3.17)
# We may wish to use static or none instead, subject to python library handling.
set(CMAKE_CUDA_RUNTIME_LIBRARY shared)

# Ensure the cuda driver API is available, and save it to the list of link targets.
if(NOT TARGET CUDA::cuda_driver)
message(FATAL_ERROR "CUDA::cuda_driver is required.")
Expand Down Expand Up @@ -315,7 +311,7 @@ function(flamegpu_setup_source_groups)
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION}: 'SRC' argument required.")
endif()

# Get a regex escaped represenatation of the current source dir, for paths containg + etc.
# Get a regex escaped representation of the current source dir, for paths containing + etc.
escape_regex("${CMAKE_CURRENT_SOURCE_DIR}" CURRENT_SOURCE_DIR_ESCAPE)

# Convert all paths to abs paths, to remove any ../ components
Expand Down Expand Up @@ -374,6 +370,10 @@ function(flamegpu_add_executable NAME SRC FLAMEGPU_ROOT PROJECT_ROOT IS_EXAMPLE)
add_subdirectory("${FLAMEGPU_ROOT}/src" "${PROJECT_ROOT}/FLAMEGPU")
endif()

# Control how we link against the cuda runtime library (CMake >= 3.17)
# We may wish to use static or none instead, subject to python library handling.
set(CMAKE_CUDA_RUNTIME_LIBRARY shared)

# Define which source files are required for the target executable
add_executable(${NAME} ${SRC})

Expand Down
5 changes: 3 additions & 2 deletions cmake/dependencies/flamegpu2-visualiser.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ include(FetchContent)
cmake_policy(SET CMP0079 NEW)

# Set the visualiser repo and tag to use unless overridden by the user.
set(DEFAULT_FLAMEGPU_VISUALISATION_GIT_VERSION "02097b5ca1bf38a52693e926d0d750d972a2ae80")
#set(DEFAULT_FLAMEGPU_VISUALISATION_GIT_VERSION "02097b5ca1bf38a52693e926d0d750d972a2ae80")
set(DEFAULT_FLAMEGPU_VISUALISATION_GIT_VERSION "conda_test")
set(DEFAULT_FLAMEGPU_VISUALISATION_REPOSITORY "https://github.com/FLAMEGPU/FLAMEGPU2-visualiser.git")

# Set a VISUSLAITION_ROOT cache entry so it is available in the GUI to override the location if required
Expand All @@ -31,7 +32,7 @@ if (FLAMEGPU_VISUALISATION_ROOT)
)
# If found, use the local vis, otherwise error.
if(FLAMEGPU_VISUALISATION_ROOT_ABS)
# If the correct visualtiion root was found, output a successful status message
# If the correct visualisation root was found, output a successful status message
message(STATUS "Found FLAMEGPU_VISUALISATION_ROOT: ${FLAMEGPU_VISUALISATION_ROOT_ABS} (${FLAMEGPU_VISUALISATION_ROOT})")
# update the value to the non abs version, in local and parent scope.
set(FLAMEGPU_VISUALISATION_ROOT "${FLAMEGPU_VISUALISATION_ROOT_ABS}")
Expand Down
1 change: 1 addition & 0 deletions cmake/modules/FindJitify.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ include(FindPackageHandleStandardArgs)
find_path(Jitify_INCLUDE_DIRS
NAMES
jitify/jitify.hpp
CMAKE_FIND_ROOT_PATH_BOTH
)

# if found, get the version number.
Expand Down
6 changes: 3 additions & 3 deletions cmake/modules/FindNVTX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "10.0")
endif()
endif()

# @todo - find both if possible, so both targets are avialable?
# @todo - find both if possible, so both targets are available?
# If not yet aware of NVTX, or we found V1/2 while looking for V3, make sure we find the actual V1/2
if(NOT NVTX_FOUND OR NVTX_VERSION VERSION_LESS 3)
# Find the header file
Expand All @@ -77,7 +77,7 @@ if(NOT NVTX_FOUND OR NVTX_VERSION VERSION_LESS 3)
PATH_SUFFIXES
include
)
# Find the appropraite dynamic library - but only 64 bit.
# Find the appropriate dynamic library - but only 64 bit.
find_library(NVTX_LIBRARIES
NAMES
libnvToolsExt.so
Expand All @@ -104,7 +104,7 @@ if(NOT NVTX_FOUND OR NVTX_VERSION VERSION_LESS 3)
)

if(NVTX_FOUND)
# Create an imported target which can be linked against to inherit include directories and the shared object(s). Mark this as imported, because there are no build steps requred.
# Create an imported target which can be linked against to inherit include directories and the shared object(s). Mark this as imported, because there are no build steps required.
add_library(NVTX::nvtx1 SHARED IMPORTED)
target_include_directories(NVTX::nvtx1 INTERFACE ${NVTX_INCLUDE_DIRS})
target_include_directories(NVTX::nvtx1 INTERFACE ${NVTX_LIBRARIES})
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,10 @@ set_property(TARGET ${PROJECT_NAME} PROPERTY CUDA_SEPARABLE_COMPILATION ON)

# Link against dependency targets / directories.

# Cub and thrust targets are not imported targets, so they do not use -isystem, so warnings must be suppressed as pragmas as requied. This is due to nvcc magic preventing isystem from being reliable with them.
# Cub and thrust targets are not imported targets, so they do not use -isystem, so warnings must be suppressed as pragmas as required. This is due to nvcc magic preventing isystem from being reliable with them.
target_link_libraries(${PROJECT_NAME} PUBLIC CUB::CUB)
target_link_libraries(${PROJECT_NAME} PUBLIC Thrust::Thrust)

# tinyxml2 static library
target_link_libraries(${PROJECT_NAME} PRIVATE Tinyxml2::tinyxml2)

Expand All @@ -613,7 +613,7 @@ if(FLAMEGPU_ENABLE_NVTX AND TARGET NVTX::nvtx)
endif()

target_link_libraries(${PROJECT_NAME} PUBLIC Jitify::jitify)
# jitify is included in public headers, so this definiition must be public too.
# jitify is included in public headers, so this definition must be public too.
target_compile_definitions(${PROJECT_NAME} PUBLIC "JITIFY_PRINT_LOG")

# If gcc < 9, needs to link against stdc++fs
Expand Down
4 changes: 4 additions & 0 deletions swig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,9 @@ if(NOT WIN32)
list(APPEND CMAKE_SWIG_FLAGS "-DSWIGWORDSIZE64")
endif()

# Enable changes required to produce a conda compatible build
# e.g. dlopen() cuda libraries on Linux
cmake_dependent_option(FLAMEGPU_BUILD_PYTHON_CONDA "Enable building conda package" OFF "FLAMEGPU_BUILD_PYTHON" OFF)

# Add the python swig subdirectory
add_subdirectory(python)
39 changes: 39 additions & 0 deletions swig/conda/pyflamegpu/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

setlocal EnableDelayedExpansion
:: Enable output of commands executed to make script debugging easier.
@echo on

:: Setup user config
set "build_threads=%FLAMEGPU_CONDA_BUILD_THREADS%"
if "%build_threads%" == "" set "build_threads=1"

set "build_arch="
if not "%FLAMEGPU_CONDA_CUDA_ARCHITECTURES%" == "" (
set "build_arch=-DCMAKE_CUDA_ARCHITECTURES=%FLAMEGPU_CONDA_CUDA_ARCHITECTURES%"
)

mkdir build 2>nul
cd build

:: Configure CMake
cmake .. -DFLAMEGPU_BUILD_PYTHON=ON -DFLAMEGPU_BUILD_PYTHON_VENV=OFF -DFLAMEGPU_BUILD_ALL_EXAMPLES=OFF -DFLAMEGPU_BUILD_PYTHON_CONDA=ON %build_arch% %CMAKE_ARGS% -DPython3_FIND_VIRTUALENV=ONLY -DPython3_ROOT_DIR="%BUILD_PREFIX%" -DPython3_EXECUTABLE="%PYTHON%"
if errorlevel 1 exit /b 1

:: Build Python wheel
cmake --build . --config Release --target pyflamegpu --parallel %build_threads%
if errorlevel 1 exit /b 1

:: Install built wheel
for /r "lib\Release\python\dist" %%f in (pyflamegpu*.whl) do (
set "pyfgpu_wheel=%%~f"
goto :found_pyfgpu_wheel
)

:found_pyfgpu_wheel
%PYTHON% -m pip install --no-deps %pyfgpu_wheel%

:: Cleanup
cd ..
rmdir /s /q build

if errorlevel 1 exit 1
36 changes: 36 additions & 0 deletions swig/conda/pyflamegpu/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Enable output of bash commands executed to make script debugging easier.
set -x

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

# Locate SWIG
# (CMake can't auto find conda installed SWIG)
swig_exe=$(find ${CONDA_PREFIX} -type f -name swig -print -quit)
swig_dir=$(dirname $(find ${CONDA_PREFIX} -type f -name swig.swg -print -quit))
if [[ ! -z "$swig_exe" ]] && [[ ! -z "$swig_dir" ]]; then
swig_exe="-DSWIG_EXECUTABLE=$swig_exe"
swig_dir="-DSWIG_DIR=$swig_dir"
else
swig_exe=""
swig_dir=""
fi

mkdir -p build && cd build

# Configure CMake
cmake .. -DCMAKE_BUILD_TYPE=Release -DFLAMEGPU_BUILD_PYTHON=ON -DFLAMEGPU_BUILD_PYTHON_VENV=OFF -DFLAMEGPU_BUILD_ALL_EXAMPLES=OFF -DFLAMEGPU_BUILD_PYTHON_CONDA=ON $build_arch $swig_exe $swig_dir $CMAKE_ARGS -DPython3_FIND_VIRTUALENV=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH -DPython3_ROOT_DIR="$BUILD_PREFIX" -DPython3_EXECUTABLE="$PYTHON"

# Build Python wheel
cmake --build . --target pyflamegpu --parallel $build_threads

# Install built wheel
pyfgpu_wheel=$(find "lib/Release/python/dist/" -type f -name "pyflamegpu*.whl" -print -quit)
$PYTHON -m pip install --no-deps $pyfgpu_wheel

# Cleanup
cd ..
rm -rf build
10 changes: 10 additions & 0 deletions swig/conda/pyflamegpu/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# https://docs.conda.io/projects/conda-build/en/3.21.x/resources/compiler-tools.html#using-your-customized-compiler-package-with-conda-build-3
# https://github.com/rapidsai/cuml/blob/branch-23.12/conda/recipes/libcuml/conda_build_config.yaml
# https://github.com/conda-forge/conda-forge-pinning-feedstock/blob/main/recipe/conda_build_config.yaml
cuda_compiler:
- cuda-nvcc # requires 'conda build -c nvidia conda' on Windows

c_compiler: # [win]
- vs2022 # [win]
cxx_compiler: # [win]
- vs2022 # [win]
65 changes: 65 additions & 0 deletions swig/conda/pyflamegpu/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package:
name: "pyflamegpu"
version: "2.0.0rc1"

source:
# Use the current committed state of the repo, to avoid pinning versions or copying the build directory if using path.
git_url: ../../../
# 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') }}
- {{ compiler('cuda') }}
- cuda-cudart-dev # [linux]
- cuda-nvrtc-dev # [linux]
- libcurand-dev # [linux]
- swig ==4.0.2 # Have to manually direct swig to find this
- git
- cmake
host:
- python
- astpretty
- python-devtools
- pip
- setuptools >=40.8.0
- wheel
- build

run:
- python
- astpretty
- cuda-cudart
- cuda-nvrtc

build:
# Allow certain env vars to be passed through to build.sh. this seems to set warnings...
# Probably need to add other env vars CMake might expect to this?
script_env:
- FLAMEGPU_CONDA_BUILD_THREADS
- FLAMEGPU_CONDA_CUDA_ARCHITECTURES
missing_dso_whitelist:
- $RPATH/libcuda.so.1 # [linux] Ignore as this comes from CUDA driver
- $RPATH/libnvrtc.so.12 # [linux] Conda-build can't find this in run reqs cuda-cudart??
- $RPATH/libcudart.so.12 # [linux] Conda-build can't find this in run reqs cuda-nvrtc??
- $RPATH/nvrtc64_120_0.dll # [win64] Conda-build can't find this in run reqs cuda-cudart??
- $RPATH/cudart64_12.dll # [win64] Conda-build can't find this in run reqs cuda-nvrtc??
ignore_run_exports:
- python # [linux] Not clear why conda thinks this isn't used
- astpretty # [linux, win64] Not clear why conda thinks this isn't used
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving this here as a future reminder for when conda picks back up - astpretty is only a dependency of a test, not actually a pyflamegpu, so conda is correct (see #1164)

- vc14_runtime # [win64] Not clear why conda thinks this isn't used (we aren't static linking)
- ucrt # [win64] Not clear why conda thinks this isn't used (we aren't static linking)

test:
imports:
- pyflamegpu
- pyflamegpu.codegen

about:
home: https://flamegpu.com/
license: MIT
license_family: MIT
summary: GPU accelerated agent based modelling framework for Python
39 changes: 39 additions & 0 deletions swig/conda/pyflamegpu_vis/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

setlocal EnableDelayedExpansion
:: Enable output of commands executed to make script debugging easier.
@echo on

:: Setup user config
set "build_threads=%FLAMEGPU_CONDA_BUILD_THREADS%"
if "%build_threads%" == "" set "build_threads=1"

set "build_arch="
if not "%FLAMEGPU_CONDA_CUDA_ARCHITECTURES%" == "" (
set "build_arch=-DCMAKE_CUDA_ARCHITECTURES=%FLAMEGPU_CONDA_CUDA_ARCHITECTURES%"
)

mkdir build 2>nul
cd build

:: Configure CMake
cmake .. -DFLAMEGPU_BUILD_PYTHON=ON -DFLAMEGPU_BUILD_PYTHON_VENV=OFF -DFLAMEGPU_BUILD_ALL_EXAMPLES=OFF -DFLAMEGPU_BUILD_PYTHON_CONDA=ON %build_arch% %CMAKE_ARGS% -DPython3_FIND_VIRTUALENV=ONLY -DPython3_ROOT_DIR="%BUILD_PREFIX%" -DPython3_EXECUTABLE="%PYTHON%" -DFLAMEGPU_VISUALISATION=ON
if errorlevel 1 exit /b 1

:: Build Python wheel
cmake --build . --config Release --target pyflamegpu --parallel %build_threads%
if errorlevel 1 exit /b 1

:: Install built wheel
for /r "lib\Release\python\dist" %%f in (pyflamegpu*.whl) do (
set "pyfgpu_wheel=%%~f"
goto :found_pyfgpu_wheel
)

:found_pyfgpu_wheel
%PYTHON% -m pip install --no-deps %pyfgpu_wheel%

:: Cleanup
cd ..
rmdir /s /q build

if errorlevel 1 exit 1
Loading