From a37eabe08939d4bf9089574fc11c2c1566110efb Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Mon, 25 Nov 2019 03:02:50 -0700 Subject: [PATCH] CMake: Set generated prc's `model-cache-dir` properly for Windows/macOS --- panda/src/configfiles/CMakeLists.txt | 11 +++++++++++ panda/src/configfiles/panda.prc.in | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/panda/src/configfiles/CMakeLists.txt b/panda/src/configfiles/CMakeLists.txt index edaa95eeb2..69509806f9 100644 --- a/panda/src/configfiles/CMakeLists.txt +++ b/panda/src/configfiles/CMakeLists.txt @@ -21,6 +21,17 @@ else() set(AUDIO_LIBRARY_NAME none) endif() +if(WIN32) + set(BAM_CACHE_DIR + "$USER_APPDATA/Panda3D-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}") +elseif(APPLE) + set(BAM_CACHE_DIR + "$HOME/Library/Caches/Panda3D-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}") +else() + set(BAM_CACHE_DIR + "$XDG_CACHE_HOME/panda3d") +endif() + configure_file(panda.prc.in "${CMAKE_BINARY_DIR}/etc/20_panda.prc") if(IS_MULTICONFIG) file(GENERATE OUTPUT "${PROJECT_BINARY_DIR}/$/etc/20_panda.prc" diff --git a/panda/src/configfiles/panda.prc.in b/panda/src/configfiles/panda.prc.in index b18fb20ca2..373852b241 100644 --- a/panda/src/configfiles/panda.prc.in +++ b/panda/src/configfiles/panda.prc.in @@ -35,7 +35,7 @@ load-file-type egg pandaegg default-model-extension .egg # Enable the model-cache, but only for models, not textures. -model-cache-dir $XDG_CACHE_HOME/panda3d +model-cache-dir ${BAM_CACHE_DIR} model-cache-textures #f