mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
CMake: Use interrogate's -import instead of linking directly
This commit is contained in:
parent
2f6c79b9e6
commit
411e0ee93f
@ -229,24 +229,34 @@ function(interrogate_sources target output database language_flags)
|
||||
endfunction(interrogate_sources)
|
||||
|
||||
#
|
||||
# Function: add_python_module(module [lib1 [lib2 ...]] [LINK lib1 ...])
|
||||
# Function: add_python_module(module [lib1 [lib2 ...]] [LINK lib1 ...]
|
||||
# [IMPORT mod1 ...])
|
||||
# Uses interrogate to create a Python module. If the LINK keyword is specified,
|
||||
# the Python module is linked against the specified libraries instead of those
|
||||
# listed before.
|
||||
# listed before. The IMPORT keyword makes the output module import another
|
||||
# Python module when it's initialized.
|
||||
#
|
||||
function(add_python_module module)
|
||||
if(INTERROGATE_PYTHON_INTERFACE)
|
||||
set(targets)
|
||||
set(link_targets)
|
||||
set(import_flags)
|
||||
set(infiles)
|
||||
set(sources)
|
||||
|
||||
set(link_keyword OFF)
|
||||
set(import_keyword OFF)
|
||||
foreach(arg ${ARGN})
|
||||
if(arg STREQUAL "LINK")
|
||||
set(link_keyword ON)
|
||||
set(import_keyword OFF)
|
||||
elseif(arg STREQUAL "IMPORT")
|
||||
set(link_keyword OFF)
|
||||
set(import_keyword ON)
|
||||
elseif(link_keyword)
|
||||
list(APPEND link_targets "${arg}")
|
||||
elseif(import_keyword)
|
||||
list(APPEND import_flags "-import" "${arg}")
|
||||
else()
|
||||
list(APPEND targets "${arg}")
|
||||
endif()
|
||||
@ -269,6 +279,7 @@ function(add_python_module module)
|
||||
COMMAND interrogate_module
|
||||
-oc "${CMAKE_CURRENT_BINARY_DIR}/${module}_module.cxx"
|
||||
-module ${module} -library ${module}
|
||||
${import_flags}
|
||||
${INTERROGATE_MODULE_OPTIONS}
|
||||
${IMOD_FLAGS} ${infiles}
|
||||
DEPENDS interrogate_module ${infiles}
|
||||
|
@ -17,8 +17,7 @@ add_subdirectory(src/interval)
|
||||
add_subdirectory(src/showbase)
|
||||
|
||||
if(HAVE_PYTHON)
|
||||
add_python_module(direct p3dcparser p3deadrec p3distributed p3interval p3showbase)
|
||||
target_link_libraries(direct core)
|
||||
add_python_module(direct p3dcparser p3deadrec p3distributed p3interval p3showbase IMPORT panda3d.core)
|
||||
|
||||
# Make an __init__.py pointing at the source directory so users can run
|
||||
# Panda3D code straight from their build path:
|
||||
|
@ -96,15 +96,12 @@ if(HAVE_PYTHON)
|
||||
add_python_module(core ${CORE_MODULE_COMPONENTS} LINK panda)
|
||||
|
||||
if(HAVE_EGG)
|
||||
add_python_module(egg p3egg p3egg2pg)
|
||||
target_link_libraries(egg core)
|
||||
add_python_module(egg p3egg p3egg2pg IMPORT panda3d.core)
|
||||
endif()
|
||||
|
||||
add_python_module(physics p3physics p3particlesystem)
|
||||
target_link_libraries(physics core)
|
||||
add_python_module(physics p3physics p3particlesystem IMPORT panda3d.core)
|
||||
|
||||
if(HAVE_ODE)
|
||||
add_python_module(ode p3ode)
|
||||
target_link_libraries(ode core)
|
||||
add_python_module(ode p3ode IMPORT panda3d.core)
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user