CMake: Restructure output directory to mimic makepanda
This commit is contained in:
parent
556c03c0c1
commit
bed9c40283
|
|
@ -35,6 +35,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/macros/")
|
|||
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
# Set up the output directory structure, mimicking that of makepanda
|
||||
set(CMAKE_BINARY_DIR "${CMAKE_BINARY_DIR}/cmake")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
||||
|
||||
# Include global modules needed for configure scripts
|
||||
include(PackageConfig) # Defines package_option AND target_use_packages
|
||||
|
||||
|
|
@ -50,7 +56,7 @@ include(CompositeSources) # Defines composite_sources function
|
|||
include(Interrogate) # Defines target_interrogate AND add_python_module
|
||||
|
||||
# Add the include path for source and header files generated by CMake
|
||||
include_directories("${CMAKE_BINARY_DIR}/include")
|
||||
include_directories("${PROJECT_BINARY_DIR}/include")
|
||||
|
||||
# Determine which trees to build.
|
||||
option(BUILD_DTOOL "Build the dtool source tree." ON)
|
||||
|
|
@ -60,19 +66,19 @@ option(BUILD_PANDATOOL "Build the pandatool source tree." ON)
|
|||
|
||||
# Include Panda3D packages
|
||||
if(BUILD_DTOOL)
|
||||
add_subdirectory(dtool)
|
||||
add_subdirectory(dtool "${CMAKE_BINARY_DIR}/dtool")
|
||||
endif()
|
||||
|
||||
if(BUILD_PANDA)
|
||||
add_subdirectory(panda)
|
||||
add_subdirectory(panda "${CMAKE_BINARY_DIR}/panda")
|
||||
endif()
|
||||
|
||||
if(BUILD_DIRECT)
|
||||
add_subdirectory(direct)
|
||||
add_subdirectory(direct "${CMAKE_BINARY_DIR}/direct")
|
||||
endif()
|
||||
|
||||
if(BUILD_PANDATOOL)
|
||||
add_subdirectory(pandatool)
|
||||
add_subdirectory(pandatool "${CMAKE_BINARY_DIR}/pandatool")
|
||||
endif()
|
||||
|
||||
# This bit is to generate the 'pandac' compatibility shim. It's deprecated now,
|
||||
|
|
@ -82,13 +88,13 @@ endif()
|
|||
# from panda3d.FOO import *
|
||||
if(HAVE_PYTHON)
|
||||
# Generate PandaModules:
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pandac/PandaModules.py"
|
||||
file(WRITE "${PROJECT_BINARY_DIR}/pandac/PandaModules.py"
|
||||
"\"This module is deprecated. Import from panda3d.core and other panda3d.* modules instead.\"
|
||||
|
||||
print(\"Warning: pandac.PandaModules is deprecated, import from panda3d.core instead\")\n")
|
||||
|
||||
foreach(module ${ALL_INTERROGATE_MODULES})
|
||||
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/pandac/PandaModules.py" "
|
||||
file(APPEND "${PROJECT_BINARY_DIR}/pandac/PandaModules.py" "
|
||||
try:
|
||||
from panda3d.${module} import *
|
||||
except ImportError as err:
|
||||
|
|
@ -97,10 +103,10 @@ except ImportError as err:
|
|||
")
|
||||
endforeach()
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pandac/__init__.py" "")
|
||||
file(WRITE "${PROJECT_BINARY_DIR}/pandac/__init__.py" "")
|
||||
|
||||
# Now install ourselves:
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/pandac/__init__.py" "${CMAKE_CURRENT_BINARY_DIR}/pandac/PandaModules.py"
|
||||
FILES "${PROJECT_BINARY_DIR}/pandac/__init__.py" "${PROJECT_BINARY_DIR}/pandac/PandaModules.py"
|
||||
DESTINATION "${PYTHON_LIB_INSTALL_DIR}/pandac")
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Reference in New Issue