mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 00:32:57 -04:00
CMake: Generate panda.prc with the correct model-path
This also generates a second prc for installation purposes, which has the correct paths once installed
This commit is contained in:
parent
fd94a33c56
commit
4a307f9cdf
@ -32,19 +32,43 @@ else()
|
|||||||
"$XDG_CACHE_HOME/panda3d")
|
"$XDG_CACHE_HOME/panda3d")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
configure_file(panda.prc.in "${CMAKE_BINARY_DIR}/etc/20_panda.prc")
|
|
||||||
if(IS_MULTICONFIG)
|
if(IS_MULTICONFIG)
|
||||||
file(GENERATE OUTPUT "${PROJECT_BINARY_DIR}/$<CONFIG>/etc/20_panda.prc"
|
set(_out_path "${PROJECT_BINARY_DIR}/$<CONFIG>/etc")
|
||||||
INPUT "${PROJECT_BINARY_DIR}/etc/20_panda.prc")
|
else()
|
||||||
|
set(_out_path "${PROJECT_BINARY_DIR}/etc")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(_confdir "etc")
|
set(_confdir "etc")
|
||||||
|
|
||||||
else()
|
else()
|
||||||
# On Unices, ask the GNUInstallDirs module where /etc is
|
# On Unices, ask the GNUInstallDirs module where /etc is
|
||||||
set(_confdir "${CMAKE_INSTALL_FULL_SYSCONFDIR}")
|
set(_confdir "${CMAKE_INSTALL_FULL_SYSCONFDIR}")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(FILES "${CMAKE_BINARY_DIR}/etc/20_panda.prc" COMPONENT Core DESTINATION ${_confdir})
|
# Path from the directory containing *.prc to the *parent of* models/
|
||||||
|
# In the build tree, reckoning this is pretty easy
|
||||||
|
set(MODELS_PARENT_PATH "..")
|
||||||
|
configure_file(panda.prc.in "${CMAKE_CURRENT_BINARY_DIR}/20_panda.prc")
|
||||||
|
|
||||||
|
# For the install tree, we need to introspect our paths
|
||||||
|
if(_confdir MATCHES "^/")
|
||||||
|
set(_abs_confdir "${_confdir}")
|
||||||
|
else()
|
||||||
|
set(_abs_confdir "${CMAKE_INSTALL_PREFIX}/${_confdir}")
|
||||||
|
endif()
|
||||||
|
if(CMAKE_INSTALL_DATADIR MATCHES "^/")
|
||||||
|
set(_abs_datadir "${CMAKE_INSTALL_DATADIR}")
|
||||||
|
else()
|
||||||
|
set(_abs_datadir "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}")
|
||||||
|
endif()
|
||||||
|
file(RELATIVE_PATH MODELS_PARENT_PATH
|
||||||
|
"${_abs_confdir}" "${_abs_datadir}/panda3d")
|
||||||
|
configure_file(panda.prc.in "${CMAKE_CURRENT_BINARY_DIR}/20_panda.prc.install")
|
||||||
|
|
||||||
|
file(GENERATE OUTPUT "${_out_path}/20_panda.prc"
|
||||||
|
INPUT "${CMAKE_CURRENT_BINARY_DIR}/20_panda.prc")
|
||||||
|
file(GENERATE OUTPUT "${_out_path}/20_panda.prc.install"
|
||||||
|
INPUT "${CMAKE_CURRENT_BINARY_DIR}/20_panda.prc.install")
|
||||||
|
|
||||||
|
install(FILES "${_out_path}/20_panda.prc.install" RENAME "20_panda.prc"
|
||||||
|
COMPONENT Core DESTINATION ${_confdir})
|
||||||
|
@ -3,10 +3,12 @@
|
|||||||
|
|
||||||
# Some paths first...
|
# Some paths first...
|
||||||
plugin-path $THIS_PRC_DIR/../lib
|
plugin-path $THIS_PRC_DIR/../lib
|
||||||
model-path $THIS_PRC_DIR/../share/panda3d/models
|
model-path $MAIN_DIR
|
||||||
|
model-path $THIS_PRC_DIR/${MODELS_PARENT_PATH}
|
||||||
|
model-path $THIS_PRC_DIR/${MODELS_PARENT_PATH}/models
|
||||||
|
|
||||||
# Let's set up a default window size of 800x600. The user can
|
# Let's set up a default window size of 800x600. The user can
|
||||||
# override this in his or her personal prc file.
|
# override this in a separate, personal prc file.
|
||||||
win-origin -2 -2
|
win-origin -2 -2
|
||||||
win-size 800 600
|
win-size 800 600
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user