CMake: Refactor interrogate.cmake a little

In particular, rely on INTERROGATE_PYTHON_INTERFACE, not
HAVE_PYTHON AND HAVE_INTERROGATE.
This commit is contained in:
Sam Edwards 2018-02-11 12:48:17 -07:00
parent 897e3b9e5b
commit f8c63dbe2b

View File

@ -8,7 +8,7 @@
# add_python_module(module [lib1 [lib2 ...]])
#
set(IGATE_FLAGS -DCPPPARSER -D__cplusplus -Dvolatile -Dmutable -python-native)
set(IGATE_FLAGS -DCPPPARSER -D__cplusplus -Dvolatile -Dmutable)
# In addition, Interrogate needs to know if this is a 64-bit build:
include(CheckTypeSize)
@ -48,7 +48,6 @@ set(ALL_INTERROGATE_MODULES CACHE INTERNAL "Internal variable")
# target are added.
#
function(target_interrogate target)
if(HAVE_PYTHON AND HAVE_INTERROGATE)
set(sources)
set(extensions)
set(want_all OFF)
@ -102,11 +101,10 @@ function(target_interrogate target)
# an IGATE_ prefix.
set_target_properties("${target}" PROPERTIES TARGET_SRCDIR
"${CMAKE_CURRENT_SOURCE_DIR}")
endif()
endfunction(target_interrogate)
#
# Function: interrogate_sources(target output database module)
# Function: interrogate_sources(target output database language_flags module)
#
# This function actually runs a component-level interrogation against 'target'.
# It generates the outfile.cxx (output) and dbfile.in (database) files, which
@ -116,8 +114,7 @@ endfunction(target_interrogate)
# The target must first have had sources selected with target_interrogate.
# Failure to do so will result in an error.
#
function(interrogate_sources target output database module)
if(HAVE_PYTHON AND HAVE_INTERROGATE)
function(interrogate_sources target output database language_flags)
get_target_property(sources "${target}" IGATE_SOURCES)
get_target_property(extensions "${target}" IGATE_EXTENSIONS)
@ -200,9 +197,10 @@ function(interrogate_sources target output database module)
-oc "${output}"
-od "${database}"
-srcdir "${srcdir}"
-module ${module} -library ${target}
-library ${target}
${INTERROGATE_OPTIONS}
${IGATE_FLAGS}
${language_flags}
${define_flags}
-S "${PROJECT_BINARY_DIR}/include"
-S "${PROJECT_SOURCE_DIR}/dtool/src/parser-inc"
@ -213,7 +211,6 @@ function(interrogate_sources target output database module)
DEPENDS interrogate ${sources} ${extensions} ${nfiles}
COMMENT "Interrogating ${target}"
)
endif()
endfunction(interrogate_sources)
#
@ -223,7 +220,7 @@ endfunction(interrogate_sources)
# listed before.
#
function(add_python_module module)
if(HAVE_PYTHON AND HAVE_INTERROGATE)
if(INTERROGATE_PYTHON_INTERFACE)
set(targets)
set(link_targets)
set(infiles)
@ -245,13 +242,11 @@ function(add_python_module module)
endif()
foreach(target ${targets})
interrogate_sources(${target} "${target}_igate.cxx" "${target}.in" "${module}")
interrogate_sources(${target} "${target}_igate.cxx" "${target}.in"
-python-native -module "panda3d.${module}")
get_target_property(target_extensions "${target}" IGATE_EXTENSIONS)
list(APPEND infiles "${target}.in")
list(APPEND sources "${target}_igate.cxx" ${target_extensions})
#get_target_property(target_links "${target}" LINK_LIBRARIES)
#target_link_libraries(${target}_igate ${target_links})
endforeach(target)
add_custom_command(