mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
CMake: Make Interrogate invocation friendly to multi-config generators
This commit is contained in:
parent
cfa4878955
commit
f744951d25
@ -113,7 +113,7 @@ function(target_interrogate target)
|
|||||||
# Also store where the build files are kept, so the Interrogate output can go
|
# Also store where the build files are kept, so the Interrogate output can go
|
||||||
# there as well.
|
# there as well.
|
||||||
set_target_properties("${target}" PROPERTIES
|
set_target_properties("${target}" PROPERTIES
|
||||||
TARGET_BINDIR "${CMAKE_CURRENT_BINARY_DIR}")
|
TARGET_BINDIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
|
||||||
|
|
||||||
endfunction(target_interrogate)
|
endfunction(target_interrogate)
|
||||||
|
|
||||||
@ -212,10 +212,12 @@ function(interrogate_sources target output database language_flags)
|
|||||||
set(define_flags "$<JOIN:\t$<SEMICOLON>$<TARGET_PROPERTY:${target},COMPILE_DEFINITIONS>,\t-D>")
|
set(define_flags "$<JOIN:\t$<SEMICOLON>$<TARGET_PROPERTY:${target},COMPILE_DEFINITIONS>,\t-D>")
|
||||||
|
|
||||||
# If this is a release build that has NDEBUG defined, we need that too:
|
# If this is a release build that has NDEBUG defined, we need that too:
|
||||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type)
|
foreach(build_type ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
|
||||||
if("${CMAKE_CXX_FLAGS_${build_type}}" MATCHES ".*NDEBUG.*")
|
string(TOUPPER "${build_type}" build_type)
|
||||||
list(APPEND define_flags "-DNDEBUG")
|
if(CMAKE_CXX_FLAGS_${build_type} MATCHES ".*NDEBUG.*")
|
||||||
|
list(APPEND define_flags "$<$<CONFIG:${build_type}>:-DNDEBUG>")
|
||||||
endif()
|
endif()
|
||||||
|
endforeach(build_type)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT "${output}" "${database}"
|
OUTPUT "${output}" "${database}"
|
||||||
@ -298,13 +300,14 @@ function(add_python_module module)
|
|||||||
get_target_property(workdir_abs "${target}" TARGET_BINDIR)
|
get_target_property(workdir_abs "${target}" TARGET_BINDIR)
|
||||||
if(NOT workdir_abs)
|
if(NOT workdir_abs)
|
||||||
# No TARGET_BINDIR was set, so we'll just use our current directory:
|
# No TARGET_BINDIR was set, so we'll just use our current directory:
|
||||||
set(workdir_abs "${CMAKE_CURRENT_BINARY_DIR}")
|
set(workdir_abs "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
|
||||||
endif()
|
endif()
|
||||||
# Keep command lines short
|
# Keep command lines short
|
||||||
file(RELATIVE_PATH workdir_rel "${CMAKE_CURRENT_BINARY_DIR}" "${workdir_abs}")
|
file(RELATIVE_PATH workdir_rel "${CMAKE_CURRENT_BINARY_DIR}" "${workdir_abs}")
|
||||||
|
|
||||||
interrogate_sources(${target}
|
interrogate_sources(${target}
|
||||||
"${workdir_abs}/${target}_igate.cxx" "${workdir_abs}/${target}.in"
|
"${workdir_abs}/${target}_igate.cxx"
|
||||||
|
"${workdir_abs}/${target}.in"
|
||||||
"-python-native;-module;${module}")
|
"-python-native;-module;${module}")
|
||||||
|
|
||||||
get_target_property(target_extensions "${target}" IGATE_EXTENSIONS)
|
get_target_property(target_extensions "${target}" IGATE_EXTENSIONS)
|
||||||
@ -315,9 +318,9 @@ function(add_python_module module)
|
|||||||
endforeach(target)
|
endforeach(target)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${module}_module.cxx"
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${module}_module.cxx"
|
||||||
COMMAND host_interrogate_module
|
COMMAND host_interrogate_module
|
||||||
-oc "${CMAKE_CURRENT_BINARY_DIR}/${module}_module.cxx"
|
-oc "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${module}_module.cxx"
|
||||||
-module ${modname} -library ${modname}
|
-module ${modname} -library ${modname}
|
||||||
${import_flags}
|
${import_flags}
|
||||||
${INTERROGATE_MODULE_OPTIONS}
|
${INTERROGATE_MODULE_OPTIONS}
|
||||||
@ -326,7 +329,7 @@ function(add_python_module module)
|
|||||||
COMMENT "Generating module ${module}")
|
COMMENT "Generating module ${module}")
|
||||||
|
|
||||||
add_python_target(${module} COMPONENT "${component}" EXPORT "${component}"
|
add_python_target(${module} COMPONENT "${component}" EXPORT "${component}"
|
||||||
"${module}_module.cxx" ${sources_abs} ${extensions})
|
"${CMAKE_CFG_INTDIR}/${module}_module.cxx" ${sources_abs} ${extensions})
|
||||||
target_link_libraries(${module} ${link_targets})
|
target_link_libraries(${module} ${link_targets})
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS "3.11")
|
if(CMAKE_VERSION VERSION_LESS "3.11")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user