FLAMEGPU / FLAMEGPU2

FLAME GPU 2 is a GPU accelerated agent based modelling framework for CUDA C++ and Python
https://flamegpu.com
MIT License
105 stars 20 forks source link

Fix Rapidjosn CMake patching for windows #1181

Closed ptheywood closed 8 months ago

ptheywood commented 8 months ago

Closes #1180

ptheywood commented 8 months ago

Unable to get PATCH_COMMAND to behave on windows.

Instead calling execute_process to manually check if the patch is applicable, and only apply it if it is. Seems to work.

First configuration output will now include:

-- Found Jitify: C:/Users/ptheywood/code/flamegpu/FLAMEGPU2/build/_deps/jitify-src (found version "0.9")
-- Patching RapidJSON
-- Patching RapidJSON - done
-- RapidJSON found. Headers: C:/Users/ptheywood/code/flamegpu/FLAMEGPU2/build/_deps/rapidjson-src/include
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)

Second output (i.e. when the patch can't be applied so isn't attempted)

-- CUDA Architectures: 50-real;60-real;70-real;80-real;90-real;90-virtual
-- RapidJSON found. Headers: C:/Users/ptheywood/code/flamegpu/FLAMEGPU2/build/_deps/rapidjson-src/include
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)

This does mean that if the patch becomes stale it will silently not be applied, but that will only occur if the rapidjson hash is changed and the relevant lines are changed too. The patch is only fixing a cmake deprecation notice, and there are PRs upstream to fix that (but they've been open for a while and rapidJSON have also broken their find_package logic anyway, so larger changes will beneeded if we bump the hash any further).

If there were a race on disk, where between the patch being checked and the patch being applied on disk, the output would instead be as follows, but it would not prevent cmake from progressing.

-- Patching RapidJSON - patching failed

Need to check this still behaves on linux prior to marking as ready.

ptheywood commented 8 months ago

Linux configure, reconfigure and build are all behaving, so this is good to go subject to CI passing.

Will want a squash merge